summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
Diffstat (limited to 'accessibility')
-rwxr-xr-xaccessibility/bridge/org/openoffice/accessibility/AccessBridge.java245
-rwxr-xr-xaccessibility/bridge/org/openoffice/accessibility/KeyHandler.java138
-rw-r--r--accessibility/bridge/org/openoffice/accessibility/PopupWindow.java210
-rw-r--r--accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java654
-rw-r--r--accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component34
-rwxr-xr-xaccessibility/bridge/org/openoffice/accessibility/makefile.mk62
-rwxr-xr-xaccessibility/bridge/org/openoffice/accessibility/manifest2
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java176
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java71
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java233
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java367
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java53
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java191
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java73
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java386
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java545
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java64
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleRoleAdapter.java148
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java99
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java214
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java678
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java96
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Alert.java66
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Application.java45
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Button.java157
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java51
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java117
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Component.java740
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Container.java763
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java161
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Dialog.java633
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java89
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Frame.java646
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Icon.java76
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Label.java130
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/List.java452
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Menu.java328
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java167
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java99
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java35
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java222
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java50
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java126
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Separator.java71
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Table.java727
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java194
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java62
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java117
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Tree.java768
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/Window.java551
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java186
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java61
-rw-r--r--accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java270
-rwxr-xr-xaccessibility/bridge/org/openoffice/java/accessibility/makefile.mk115
-rw-r--r--accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx317
-rw-r--r--accessibility/bridge/source/java/exports.dxp4
-rw-r--r--accessibility/bridge/source/java/makefile.mk70
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx311
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx527
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx95
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx281
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx81
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx175
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx280
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx143
-rwxr-xr-xaccessibility/inc/accessibility/extended/AccessibleGridControl.hxx265
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx467
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx218
-rwxr-xr-xaccessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx102
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx226
-rwxr-xr-xaccessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx228
-rwxr-xr-xaccessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx168
-rwxr-xr-xaccessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx91
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx92
-rw-r--r--accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx107
-rw-r--r--accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx86
-rw-r--r--accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx156
-rw-r--r--accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx119
-rw-r--r--accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx213
-rw-r--r--accessibility/inc/accessibility/extended/accessiblelistbox.hxx125
-rw-r--r--accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx223
-rw-r--r--accessibility/inc/accessibility/extended/accessibletabbar.hxx120
-rw-r--r--accessibility/inc/accessibility/extended/accessibletabbarbase.hxx78
-rw-r--r--accessibility/inc/accessibility/extended/accessibletabbarpage.hxx137
-rw-r--r--accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx141
-rw-r--r--accessibility/inc/accessibility/extended/accessibletablistbox.hxx115
-rw-r--r--accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx122
-rw-r--r--accessibility/inc/accessibility/extended/listboxaccessible.hxx95
-rw-r--r--accessibility/inc/accessibility/extended/textwindowaccessibility.hxx711
-rw-r--r--accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx69
-rw-r--r--accessibility/inc/accessibility/helper/acc_factory.hxx50
-rw-r--r--accessibility/inc/accessibility/helper/accessiblestrings.hrc53
-rw-r--r--accessibility/inc/accessibility/helper/accresmgr.hxx72
-rw-r--r--accessibility/inc/accessibility/helper/characterattributeshelper.hxx60
-rw-r--r--accessibility/inc/accessibility/helper/listboxhelper.hxx196
-rw-r--r--accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx157
-rw-r--r--accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx102
-rw-r--r--accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx95
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx184
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx90
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx97
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx69
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx73
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx71
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx123
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx54
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx54
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx228
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx63
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx200
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx86
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx72
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx121
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx54
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx59
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx88
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx87
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx80
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx144
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx103
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx148
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx66
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx93
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx105
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx113
-rw-r--r--accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx170
-rw-r--r--accessibility/inc/makefile.mk47
-rw-r--r--accessibility/inc/pch/precompiled_accessibility.cxx29
-rw-r--r--accessibility/inc/pch/precompiled_accessibility.hxx37
-rwxr-xr-xaccessibility/prj/build.lst18
-rw-r--r--accessibility/prj/d.lst8
-rw-r--r--accessibility/prj/l10n1
-rw-r--r--accessibility/source/extended/AccessibleBrowseBox.cxx401
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxBase.cxx658
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx172
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx419
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx173
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxTable.cxx278
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx355
-rw-r--r--accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx354
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControl.cxx372
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlBase.cxx535
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlHeader.cxx284
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlHeaderCell.cxx170
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlTable.cxx376
-rw-r--r--accessibility/source/extended/AccessibleGridControlTableBase.cxx291
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlTableCell.cxx370
-rwxr-xr-xaccessibility/source/extended/AccessibleToolPanelDeck.cxx412
-rw-r--r--accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx459
-rw-r--r--accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx455
-rw-r--r--accessibility/source/extended/accessiblebrowseboxcell.cxx92
-rw-r--r--accessibility/source/extended/accessibleeditbrowseboxcell.cxx273
-rw-r--r--accessibility/source/extended/accessibleiconchoicectrl.cxx372
-rw-r--r--accessibility/source/extended/accessibleiconchoicectrlentry.cxx756
-rw-r--r--accessibility/source/extended/accessiblelistbox.cxx432
-rw-r--r--accessibility/source/extended/accessiblelistboxentry.cxx970
-rw-r--r--accessibility/source/extended/accessibletabbar.cxx554
-rw-r--r--accessibility/source/extended/accessibletabbarbase.cxx114
-rw-r--r--accessibility/source/extended/accessibletabbarpage.cxx511
-rw-r--r--accessibility/source/extended/accessibletabbarpagelist.cxx805
-rw-r--r--accessibility/source/extended/accessibletablistbox.cxx146
-rw-r--r--accessibility/source/extended/accessibletablistboxtable.cxx383
-rw-r--r--accessibility/source/extended/listboxaccessible.cxx103
-rwxr-xr-xaccessibility/source/extended/makefile.mk81
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx2254
-rwxr-xr-xaccessibility/source/helper/acc_factory.cxx552
-rw-r--r--accessibility/source/helper/accessiblestrings.src76
-rw-r--r--accessibility/source/helper/accresmgr.cxx84
-rw-r--r--accessibility/source/helper/characterattributeshelper.cxx119
-rw-r--r--accessibility/source/helper/makefile.mk53
-rw-r--r--accessibility/source/inc/floatingwindowaccessible.hxx45
-rw-r--r--accessibility/source/standard/accessiblemenubasecomponent.cxx783
-rw-r--r--accessibility/source/standard/accessiblemenucomponent.cxx471
-rw-r--r--accessibility/source/standard/accessiblemenuitemcomponent.cxx503
-rw-r--r--accessibility/source/standard/floatingwindowaccessible.cxx70
-rw-r--r--accessibility/source/standard/makefile.mk78
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx373
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx326
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx361
-rw-r--r--accessibility/source/standard/vclxaccessiblecombobox.cxx96
-rw-r--r--accessibility/source/standard/vclxaccessibledropdowncombobox.cxx142
-rw-r--r--accessibility/source/standard/vclxaccessibledropdownlistbox.cxx110
-rw-r--r--accessibility/source/standard/vclxaccessibleedit.cxx626
-rw-r--r--accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx85
-rw-r--r--accessibility/source/standard/vclxaccessiblefixedtext.cxx96
-rw-r--r--accessibility/source/standard/vclxaccessiblelist.cxx854
-rw-r--r--accessibility/source/standard/vclxaccessiblelistbox.cxx108
-rw-r--r--accessibility/source/standard/vclxaccessiblelistitem.cxx674
-rw-r--r--accessibility/source/standard/vclxaccessiblemenu.cxx255
-rw-r--r--accessibility/source/standard/vclxaccessiblemenubar.cxx211
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuitem.cxx607
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuseparator.cxx85
-rw-r--r--accessibility/source/standard/vclxaccessiblepopupmenu.cxx111
-rw-r--r--accessibility/source/standard/vclxaccessibleradiobutton.cxx314
-rw-r--r--accessibility/source/standard/vclxaccessiblescrollbar.cxx280
-rw-r--r--accessibility/source/standard/vclxaccessiblestatusbar.cxx366
-rw-r--r--accessibility/source/standard/vclxaccessiblestatusbaritem.cxx629
-rw-r--r--accessibility/source/standard/vclxaccessibletabcontrol.cxx515
-rw-r--r--accessibility/source/standard/vclxaccessibletabpage.cxx702
-rw-r--r--accessibility/source/standard/vclxaccessibletabpagewindow.cxx141
-rw-r--r--accessibility/source/standard/vclxaccessibletextcomponent.cxx362
-rw-r--r--accessibility/source/standard/vclxaccessibletextfield.cxx154
-rw-r--r--accessibility/source/standard/vclxaccessibletoolbox.cxx882
-rw-r--r--accessibility/source/standard/vclxaccessibletoolboxitem.cxx718
-rw-r--r--accessibility/util/acc.map7
-rw-r--r--accessibility/util/makefile.mk86
-rw-r--r--accessibility/workben/TODO13
-rw-r--r--accessibility/workben/makefile9
-rw-r--r--accessibility/workben/makefile.in31
-rw-r--r--accessibility/workben/makefile.mk39
-rw-r--r--accessibility/workben/org/openoffice/accessibility/Makefile6
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java702
-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.java322
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java412
-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.java237
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common34
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk55
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/makefile.common30
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/makefile.mk57
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/manifest3
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java154
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java163
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java89
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java217
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java123
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java92
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile40
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java215
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common35
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk51
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java195
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java115
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java119
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java126
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java148
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java160
-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.java310
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainerWindow.java35
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java147
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java267
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ServiceInterfaceView.java150
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java199
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java161
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java467
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java117
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common45
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk51
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java122
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/Makefile13
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java208
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java179
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java136
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java122
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common34
-rw-r--r--accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk51
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java92
-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/Makefile38
-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.common36
-rw-r--r--accessibility/workben/org/openoffice/accessibility/misc/makefile.mk55
272 files changed, 60078 insertions, 0 deletions
diff --git a/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java
new file mode 100755
index 000000000000..ec479fb3949d
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/accessibility/AccessBridge.java
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.accessibility;
+
+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.awt.XTopWindowListener;
+import com.sun.star.awt.XWindow;
+import com.sun.star.comp.loader.FactoryHelper;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.registry.*;
+import com.sun.star.uno.*;
+
+import org.openoffice.java.accessibility.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.accessibility.Accessible;
+
+
+public class AccessBridge {
+ //
+ protected static java.util.Hashtable topWindowMap = new java.util.Hashtable();
+
+ private static java.awt.Window getTopWindowImpl(XAccessible xAccessible) {
+ // Because it can not be garantied that
+ // WindowsAccessBridgeAdapter.registerTopWindow() is called
+ // before windowOpened(), we have to make this operation
+ // atomic.
+ synchronized (topWindowMap) {
+ String oid = UnoRuntime.generateOid(xAccessible);
+ java.awt.Window w = (java.awt.Window) topWindowMap.get(oid);
+
+ if (w == null) {
+ w = AccessibleObjectFactory.getTopWindow(xAccessible);
+
+ if (w != null) {
+ topWindowMap.put(oid, w);
+ }
+ }
+
+ return w;
+ }
+ }
+
+ protected static java.awt.Window getTopWindow(XAccessible xAccessible) {
+ if (xAccessible != null) {
+ XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext();
+ if (xAccessibleContext != null) {
+
+ // Toolkit reports the VCL peer windows as toplevels. These have an
+ // accessible parent which represents the native frame window
+ switch(xAccessibleContext.getAccessibleRole()) {
+ case AccessibleRole.ROOT_PANE:
+ case AccessibleRole.POPUP_MENU:
+ return getTopWindow(xAccessibleContext.getAccessibleParent());
+
+ case AccessibleRole.WINDOW:
+ case AccessibleRole.FRAME:
+ case AccessibleRole.DIALOG:
+ case AccessibleRole.ALERT:
+ return getTopWindowImpl(xAccessible);
+
+ default:
+ break;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ protected static java.awt.Window removeTopWindow(XAccessible xAccessible) {
+ if (xAccessible != null) {
+ XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext();
+ if (xAccessibleContext != null) {
+
+ // Toolkit reports the VCL peer windows as toplevels. These have an
+ // accessible parent which represents the native frame window
+ switch(xAccessibleContext.getAccessibleRole()) {
+ case AccessibleRole.ROOT_PANE:
+ case AccessibleRole.POPUP_MENU:
+ return removeTopWindow(xAccessibleContext.getAccessibleParent());
+
+ case AccessibleRole.WINDOW:
+ case AccessibleRole.FRAME:
+ case AccessibleRole.DIALOG:
+ return (java.awt.Window) topWindowMap.remove(UnoRuntime.generateOid(xAccessible));
+
+ default:
+ break;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public static XSingleServiceFactory __getServiceFactory(String implName,
+ XMultiServiceFactory multiFactory, XRegistryKey regKey) {
+ XSingleServiceFactory xSingleServiceFactory = null;
+
+ if (implName.equals(AccessBridge.class.getName())) {
+ // Initialize toolkit to register at Java <-> Windows access bridge
+ java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
+
+ xSingleServiceFactory = FactoryHelper.getServiceFactory(_AccessBridge.class,
+ _AccessBridge._serviceName, multiFactory, regKey);
+ }
+
+ return xSingleServiceFactory;
+ }
+
+ static public class _AccessBridge implements XTopWindowListener,
+ XInitialization, XComponent {
+ static final String _serviceName = "com.sun.star.accessibility.AccessBridge";
+ XComponentContext xComponentContext;
+
+ public _AccessBridge(XComponentContext xComponentContext) {
+ this.xComponentContext = xComponentContext;
+ }
+
+ /*
+ * XInitialization
+ */
+ public void initialize(java.lang.Object[] arguments) {
+ try {
+ // FIXME: Currently there is no way to determine if key event forwarding is needed or not,
+ // so we have to do it always ..
+ XExtendedToolkit unoToolkit = (XExtendedToolkit) AnyConverter.toObject(new Type(
+ XExtendedToolkit.class), arguments[0]);
+
+ if (unoToolkit != null) {
+ // FIXME this should be done in VCL
+ unoToolkit.addTopWindowListener(this);
+
+ String os = (String) System.getProperty("os.name");
+
+ // Try to initialize the WindowsAccessBridgeAdapter
+ if (os.startsWith("Windows")) {
+ WindowsAccessBridgeAdapter.attach(xComponentContext);
+ } else {
+ unoToolkit.addKeyHandler(new KeyHandler());
+ }
+ } else if (Build.DEBUG) {
+ System.err.println(
+ "argument 0 is not of type XExtendedToolkit.");
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ // FIXME: output
+ }
+ }
+
+ /*
+ * XTopWindowListener
+ */
+ public void windowOpened(com.sun.star.lang.EventObject event) {
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class,
+ event.Source);
+ java.awt.Window w = getTopWindow(xAccessible);
+ }
+
+ public void windowActivated(com.sun.star.lang.EventObject event) {
+ }
+
+ public void windowDeactivated(com.sun.star.lang.EventObject event) {
+ }
+
+ public void windowMinimized(com.sun.star.lang.EventObject event) {
+ }
+
+ public void windowNormalized(com.sun.star.lang.EventObject event) {
+ }
+
+ public void windowClosing(com.sun.star.lang.EventObject event) {
+ }
+
+ public void windowClosed(com.sun.star.lang.EventObject event) {
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(XAccessible.class,
+ event.Source);
+
+ java.awt.Window w = removeTopWindow(xAccessible);
+
+ if (w != null) {
+ w.dispose();
+ }
+ }
+
+ public void disposing(com.sun.star.lang.EventObject event) {
+ }
+
+ /*
+ * XComponent
+ */
+
+ public void addEventListener(com.sun.star.lang.XEventListener listener) {
+ }
+
+ public void removeEventListener(com.sun.star.lang.XEventListener listener) {
+ }
+
+ public void dispose() {
+ try {
+ java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().invokeAndWait(
+ new Runnable() {
+ public void run() {
+ }
+ } );
+ } catch (java.lang.InterruptedException e) {
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ }
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/accessibility/KeyHandler.java b/accessibility/bridge/org/openoffice/accessibility/KeyHandler.java
new file mode 100755
index 000000000000..1e9f2f6520ae
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/accessibility/KeyHandler.java
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.accessibility;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.awt.XKeyHandler;
+import org.openoffice.java.accessibility.AccessibleKeyBinding;
+import org.openoffice.java.accessibility.Build;
+
+import java.awt.*;
+import java.awt.event.KeyEvent;
+import javax.accessibility.*;
+
+public class KeyHandler extends Component implements XKeyHandler, java.awt.KeyEventDispatcher {
+ EventQueue eventQueue;
+
+ public class VCLKeyEvent extends KeyEvent implements Runnable {
+ boolean consumed = true;
+
+ public VCLKeyEvent(Component c, int id, int modifiers, int keyCode, char keyChar) {
+ super(c, id, System.currentTimeMillis(), modifiers, keyCode, keyChar);
+ }
+
+ public void run() {
+ // This is a no-op ..
+ }
+
+ public void setConsumed(boolean b) {
+ consumed = b;
+ }
+
+ public boolean isConsumed() {
+ return consumed;
+ }
+ }
+
+ public KeyHandler() {
+ eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
+ }
+
+ /** This method is called by the current KeyboardFocusManager requesting that this KeyEventDispatcher
+ * dispatch the specified event on its behalf
+ */
+ public boolean dispatchKeyEvent(java.awt.event.KeyEvent e) {
+ if (e instanceof VCLKeyEvent) {
+ VCLKeyEvent event = (VCLKeyEvent) e;
+ event.setConsumed(false);
+ return true;
+ }
+ return false;
+ }
+
+ /** Handler for KeyPressed events */
+ public boolean keyPressed(com.sun.star.awt.KeyEvent event) {
+// try {
+ VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_PRESSED,
+ AccessibleKeyBinding.convertModifiers(event.Modifiers),
+ AccessibleKeyBinding.convertKeyCode(event.KeyCode),
+ event.KeyChar != 0 ? event.KeyChar : KeyEvent.CHAR_UNDEFINED);
+
+ eventQueue.postEvent(vke);
+
+ // VCL events for TABs have empty KeyChar
+ if (event.KeyCode == com.sun.star.awt.Key.TAB ) {
+ event.KeyChar = '\t';
+ }
+
+ // Synthesize KEY_TYPED event to emulate Java behavior
+ if (event.KeyChar != 0) {
+ eventQueue.postEvent(new VCLKeyEvent(this,
+ KeyEvent.KEY_TYPED,
+ AccessibleKeyBinding.convertModifiers(event.Modifiers),
+ KeyEvent.VK_UNDEFINED,
+ event.KeyChar));
+ }
+
+ // Wait until the key event is processed
+ return false;
+// eventQueue.invokeAndWait(vke);
+// return vke.isConsumed();
+// } catch(java.lang.InterruptedException e) {
+// return false;
+// } catch(java.lang.reflect.InvocationTargetException e) {
+// return false;
+// }
+ }
+
+ /** Handler for KeyReleased events */
+ public boolean keyReleased(com.sun.star.awt.KeyEvent event) {
+// try {
+ VCLKeyEvent vke = new VCLKeyEvent(this, KeyEvent.KEY_RELEASED,
+ AccessibleKeyBinding.convertModifiers(event.Modifiers),
+ AccessibleKeyBinding.convertKeyCode(event.KeyCode),
+ event.KeyChar != 0 ? event.KeyChar : KeyEvent.CHAR_UNDEFINED);
+ eventQueue.postEvent(vke);
+
+ // Wait until the key event is processed
+ return false;
+// eventQueue.invokeAndWait(vke);
+// return vke.isConsumed();
+// } catch(java.lang.InterruptedException e) {
+// return false;
+// } catch(java.lang.reflect.InvocationTargetException e) {
+// return false;
+// }
+ }
+
+ public void disposing(com.sun.star.lang.EventObject event) {
+ java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
+ }
+};
diff --git a/accessibility/bridge/org/openoffice/accessibility/PopupWindow.java b/accessibility/bridge/org/openoffice/accessibility/PopupWindow.java
new file mode 100644
index 000000000000..a63b0589b4fa
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/accessibility/PopupWindow.java
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.accessibility;
+
+import org.openoffice.java.accessibility.*;
+
+
+/**
+ *
+ */
+public class PopupWindow extends java.awt.Window {
+ javax.accessibility.AccessibleContext accessibleContext = null;
+ ContainerProxy layeredPane = new ContainerProxy(javax.accessibility.AccessibleRole.LAYERED_PANE);
+ ContainerProxy rootPane = new ContainerProxy(javax.accessibility.AccessibleRole.ROOT_PANE);
+ ContainerProxy popupLayer = new ContainerProxy(javax.accessibility.AccessibleRole.PANEL);
+ boolean opened = false;
+ boolean visible = false;
+
+ /** Creates a new instance of PopupWindow */
+ public PopupWindow(java.awt.Window owner) {
+ super(owner);
+ super.add(rootPane);
+ rootPane.add(layeredPane);
+
+ javax.accessibility.AccessibleContext ac = rootPane.getAccessibleContext();
+
+ if (ac != null) {
+ ac.setAccessibleParent(this);
+ }
+ }
+
+ static PopupWindow create(
+ com.sun.star.accessibility.XAccessible xAccessible) {
+ java.awt.Window parent = java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager()
+ .getActiveWindow();
+
+ if (parent != null) {
+ PopupWindow w = new PopupWindow(parent);
+ w.setVisible(true);
+ AccessibleObjectFactory.invokeAndWait();
+ AccessibleObjectFactory.addChild(w, xAccessible);
+
+ return w;
+ }
+
+ return null;
+ }
+
+ public boolean isShowing() {
+ if (isVisible()) {
+ java.awt.Container parent = getParent();
+
+ return (parent == null) || parent.isShowing();
+ }
+
+ return false;
+ }
+
+ public void addNotify() {
+ }
+
+ public void removeNotify() {
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public void setVisible(boolean b) {
+ if (visible != b) {
+ visible = b;
+
+ if (b) {
+ // If it is the first show, fire WINDOW_OPENED event
+ if (!opened) {
+ AccessibleObjectFactory.postWindowOpened(this);
+ opened = true;
+ }
+ }
+ }
+ }
+
+ public java.awt.Component add(java.awt.Component c) {
+ popupLayer.add(c);
+ layeredPane.add(popupLayer);
+
+ if (c instanceof javax.accessibility.Accessible) {
+ javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext();
+
+ if (ac != null) {
+ ac.firePropertyChange(ac.ACCESSIBLE_CHILD_PROPERTY, null,
+ popupLayer.getAccessibleContext());
+ }
+ }
+
+ return c;
+ }
+
+ public void remove(java.awt.Component c) {
+ layeredPane.remove(popupLayer);
+
+ if (c instanceof javax.accessibility.Accessible) {
+ javax.accessibility.AccessibleContext ac = layeredPane.getAccessibleContext();
+
+ if (ac != null) {
+ ac.firePropertyChange(ac.ACCESSIBLE_CHILD_PROPERTY,
+ popupLayer.getAccessibleContext(), null);
+ }
+ }
+
+ popupLayer.remove(c);
+ }
+
+ public void dispose() {
+ setVisible(false);
+ AccessibleObjectFactory.postWindowClosed(this);
+ }
+
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ accessibleContext = new AccessiblePopupWindow();
+ }
+
+ return accessibleContext;
+ }
+
+ protected class AccessiblePopupWindow
+ extends java.awt.Window.AccessibleAWTWindow {
+ AccessiblePopupWindow() {
+ }
+ }
+
+ protected class ContainerProxy extends java.awt.Container
+ implements javax.accessibility.Accessible {
+ javax.accessibility.AccessibleContext accessibleContext = null;
+ javax.accessibility.AccessibleRole role;
+
+ protected ContainerProxy(javax.accessibility.AccessibleRole role) {
+ this.role = role;
+ }
+
+ public java.awt.Component add(java.awt.Component c) {
+ if (c instanceof javax.accessibility.Accessible) {
+ javax.accessibility.Accessible a = (javax.accessibility.Accessible) c;
+ javax.accessibility.AccessibleContext ac = a.getAccessibleContext();
+
+ if (ac != null) {
+ ac.setAccessibleParent(this);
+ }
+ }
+
+ return super.add(c);
+ }
+
+ public void remove(java.awt.Component c) {
+ if (c instanceof javax.accessibility.Accessible) {
+ javax.accessibility.Accessible a = (javax.accessibility.Accessible) c;
+ javax.accessibility.AccessibleContext ac = a.getAccessibleContext();
+
+ if (ac != null) {
+ ac.setAccessibleParent(null);
+ }
+ }
+
+ super.remove(c);
+ }
+
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ accessibleContext = new AccessibleContainerProxy();
+ }
+
+ return accessibleContext;
+ }
+
+ private class AccessibleContainerProxy
+ extends java.awt.Container.AccessibleAWTContainer {
+ AccessibleContainerProxy() {
+ }
+
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return ContainerProxy.this.role;
+ }
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java b/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java
new file mode 100644
index 000000000000..28e58940867d
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/accessibility/WindowsAccessBridgeAdapter.java
@@ -0,0 +1,654 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.accessibility;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.java.XJavaVM;
+import com.sun.star.uno.*;
+
+import org.openoffice.java.accessibility.*;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.accessibility.*;
+
+
+public class WindowsAccessBridgeAdapter {
+ private static Method registerVirtualFrame;
+ private static Method revokeVirtualFrame;
+ private static java.util.Hashtable frameMap;
+
+ protected static native byte[] getProcessID();
+
+ protected static native boolean createMapping(long jvmaccess);
+
+ // On Windows all native frames must be registered to the access bridge.
+ // Therefor the bridge exports two methods that we try to find here.
+ protected static void attach(XComponentContext xComponentContext) {
+ try {
+ Class bridge = Class.forName(
+ "com.sun.java.accessibility.AccessBridge");
+ Class[] parameterTypes = {
+ javax.accessibility.Accessible.class, Integer.class
+ };
+
+ if (bridge != null) {
+ registerVirtualFrame = bridge.getMethod("registerVirtualFrame",
+ parameterTypes);
+ revokeVirtualFrame = bridge.getMethod("revokeVirtualFrame",
+ parameterTypes);
+
+ // load the native dll
+ System.loadLibrary("java_uno_accessbridge");
+
+ Object any = xComponentContext.getValueByName(
+ "/singletons/com.sun.star.java.theJavaVirtualMachine");
+
+ if (AnyConverter.isObject(any)) {
+ XJavaVM xJavaVM = (XJavaVM) UnoRuntime.queryInterface(XJavaVM.class,
+ AnyConverter.toObject(new Type(XJavaVM.class), any));
+
+ if (xJavaVM != null) {
+ any = xJavaVM.getJavaVM(getProcessID());
+
+ if (AnyConverter.isLong(any)) {
+ createMapping(AnyConverter.toLong(any));
+ frameMap = new java.util.Hashtable();
+ }
+ }
+ }
+ }
+ } catch (NoSuchMethodException e) {
+ System.err.println("ERROR: incompatible AccessBridge found: " +
+ e.getMessage());
+
+ // Forward this exception to UNO to indicate that the service will
+ // not work correctly.
+ throw new com.sun.star.uno.RuntimeException(
+ "incompatible AccessBridge class: " + e.getMessage());
+ } catch (java.lang.SecurityException e) {
+ System.err.println("ERROR: no access to AccessBridge: " +
+ e.getMessage());
+
+ // Forward this exception to UNO to indicate that the service will not work correctly.
+ throw new com.sun.star.uno.RuntimeException(
+ "Security exception caught: " + e.getMessage());
+ } catch (ClassNotFoundException e) {
+ // Forward this exception to UNO to indicate that the service will not work correctly.
+ throw new com.sun.star.uno.RuntimeException(
+ "ClassNotFound exception caught: " + e.getMessage());
+ } catch (IllegalArgumentException e) {
+ System.err.println("IllegalArgumentException caught: " +
+ e.getMessage());
+
+ // Forward this exception to UNO to indicate that the service will not work correctly.
+ throw new com.sun.star.uno.RuntimeException(
+ "IllegalArgumentException caught: " + e.getMessage());
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.err.println("UNO IllegalArgumentException caught: " +
+ e.getMessage());
+
+ // Forward this exception to UNO to indicate that the service will not work correctly.
+ throw new com.sun.star.uno.RuntimeException(
+ "UNO IllegalArgumentException caught: " + e.getMessage());
+ }
+ }
+
+ protected static boolean isAttached() {
+ return frameMap != null;
+ }
+
+ protected static Accessible getAccessibleWrapper(XAccessible xAccessible) {
+ Accessible a = null;
+
+ try {
+ XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext();
+
+ if (xAccessibleContext != null) {
+ switch (xAccessibleContext.getAccessibleRole()) {
+ case AccessibleRole.LIST:
+ a = (Accessible) AccessibleObjectFactory.getAccessibleComponent(xAccessible);
+ if (a != null) {
+ a = new ListProxy(a.getAccessibleContext());
+ }
+ break;
+
+ case AccessibleRole.MENU:
+
+ Accessible tmp = (Accessible) AccessibleObjectFactory.getAccessibleComponent(xAccessible);
+ if (tmp != null) {
+ AccessibleContext ac = tmp.getAccessibleContext();
+
+ if (ac != null) {
+ a = new PopupMenuProxy(ac);
+ }
+ }
+
+ break;
+
+ case AccessibleRole.TOOL_TIP:
+ a = PopupWindow.create(xAccessible);
+ break;
+
+ default:
+ a = (Accessible) AccessBridge.getTopWindow(xAccessible);
+ break;
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+
+ return a;
+ }
+
+ /** Registers a native frame at the Java AccessBridge for Windows */
+ public static void registerTopWindow(int handle, XAccessible xAccessible) {
+ Integer hwnd = new Integer(handle);
+
+ if (!frameMap.contains(hwnd)) {
+ if (Build.DEBUG) {
+ System.err.println("Native frame " + hwnd + " of role " +
+ AccessibleRoleAdapter.getAccessibleRole(xAccessible) +
+ " has been opened");
+ }
+
+ Accessible a = getAccessibleWrapper(xAccessible);
+
+ if (a != null) {
+ Object[] args = { a, hwnd };
+
+ frameMap.put(hwnd, a);
+
+ if (Build.DEBUG) {
+ System.err.println("registering native frame " + hwnd);
+ }
+
+ try {
+ registerVirtualFrame.invoke(null, args);
+ } catch (IllegalAccessException e) {
+ System.err.println("IllegalAccessException caught: " +
+ e.getMessage());
+ } catch (IllegalArgumentException e) {
+ System.err.println("IllegalArgumentException caught: " +
+ e.getMessage());
+ } catch (InvocationTargetException e) {
+ System.err.println("InvokationTargetException caught: " +
+ e.getMessage());
+ }
+ }
+ }
+ }
+
+ /** Revokes a native frame at the Java AccessBridge for Windows */
+ public static void revokeTopWindow(int handle, XAccessible xAccessible) {
+ Integer hwnd = new Integer(handle);
+
+ Accessible a = (Accessible) frameMap.remove(hwnd);
+
+ if (a != null) {
+ Object[] args = { a, hwnd };
+
+ if (Build.DEBUG) {
+ System.err.println("revoking native frame " + hwnd);
+ }
+
+ try {
+ revokeVirtualFrame.invoke(null, args);
+ } catch (IllegalAccessException e) {
+ System.err.println("IllegalAccessException caught: " +
+ e.getMessage());
+ } catch (IllegalArgumentException e) {
+ System.err.println("IllegalArgumentException caught: " +
+ e.getMessage());
+ } catch (InvocationTargetException e) {
+ System.err.println("InvokationTargetException caught: " +
+ e.getMessage());
+ }
+ }
+
+ if (a instanceof PopupWindow) {
+ PopupWindow toolTipWindow = (PopupWindow) a;
+ toolTipWindow.removeAll();
+ toolTipWindow.dispose();
+ }
+ }
+
+ protected static class PopupMenuProxy extends AccessibleContext
+ implements Accessible, AccessibleComponent {
+ AccessibleContext menu;
+ AccessibleComponent menuComponent;
+ int x = 0; int y = 0; int width = 0; int height = 0;
+
+ PopupMenuProxy(AccessibleContext ac) {
+ menu = ac;
+ menuComponent = menu.getAccessibleComponent();
+
+ /** calculate the bounding rectangle by iterating over the
+ * the children.
+ */
+ int x2 = 0; int y2 = 0;
+ int count = ac.getAccessibleChildrenCount();
+ for (int i = 0; i < count; i++) {
+ Accessible a = menu.getAccessibleChild(i);
+
+ if (a != null) {
+ AccessibleContext childAC = a.getAccessibleContext();
+
+ if (childAC != null) {
+ AccessibleComponent comp = ac.getAccessibleComponent();
+
+ if (comp != null) {
+ java.awt.Point p = comp.getLocationOnScreen();
+ java.awt.Dimension d = comp.getSize();
+
+ if (p != null && d != null) {
+ if (p.x < x) {
+ x = p.x;
+ }
+ if (p.y < y) {
+ y = p.y;
+ }
+ if (p.x + d.width > x2) {
+ x2 = p.x + d.width;
+ }
+ if (p.y + d.height > y2) {
+ y2 = p.y + d.height;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ width = x2 - x;
+ height = y2 - y;
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ return this;
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleComponent getAccessibleComponent() {
+ return this;
+ }
+
+ /** Returns the AccessibleText associated with this object */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+ return menu.getAccessibleText();
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ return menu.getAccessibleStateSet();
+ }
+
+ public java.util.Locale getLocale() {
+ return menu.getLocale();
+ }
+
+ public int getAccessibleIndexInParent() {
+ return -1;
+ }
+
+ public int getAccessibleChildrenCount() {
+ return menu.getAccessibleChildrenCount();
+ }
+
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ return menu.getAccessibleChild(i);
+ }
+
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.POPUP_MENU;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+ public void addFocusListener(java.awt.event.FocusListener fl) {
+ menuComponent.addFocusListener(fl);
+ }
+
+ public void removeFocusListener(java.awt.event.FocusListener fl) {
+ menuComponent.removeFocusListener(fl);
+ }
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ return menuComponent.getBackground();
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ return menuComponent.getForeground();
+ }
+
+ public void setForeground(java.awt.Color c) {
+ menuComponent.setForeground(c);
+ }
+
+ public java.awt.Cursor getCursor() {
+ return menuComponent.getCursor();
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ menuComponent.setCursor(cursor);
+ }
+
+ public java.awt.Font getFont() {
+ return menuComponent.getFont();
+ }
+
+ public void setFont(java.awt.Font f) {
+ menuComponent.setFont(f);
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ return menuComponent.getFontMetrics(f);
+ }
+
+ public boolean isEnabled() {
+ return menuComponent.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ menuComponent.setEnabled(b);
+ }
+
+ public boolean isVisible() {
+ return menuComponent.isVisible();
+ }
+
+ public void setVisible(boolean b) {
+ menuComponent.setVisible(b);
+ }
+
+ public boolean isShowing() {
+ return menuComponent.isShowing();
+ }
+
+ public boolean contains(java.awt.Point p) {
+ java.awt.Dimension d = getSize();
+
+ if (Build.DEBUG) {
+ System.err.println("PopupMenuProxy.containsPoint(" + p.x + "," +
+ p.y + ") returns " +
+ (((d.width >= 0) && (p.x < d.width) && (d.height >= 0) &&
+ (p.y < d.height)) ? "true" : "false"));
+ }
+
+ if ((d.width >= 0) && (p.x < d.width) && (d.height >= 0) &&
+ (p.y < d.height)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ return new java.awt.Point(x,y);
+ }
+
+ /** Gets the location of this component in the form of a point specifying the component's top-left corner */
+ public java.awt.Point getLocation() {
+ // This object represents a toplevel, so this is the same as getLocationOnScreen()
+ return getLocationOnScreen();
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ return new java.awt.Rectangle(x, y, width, height);
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ return new java.awt.Dimension(width, height);
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the Accessible child, if one exists, contained at the local
+ * coordinate Point
+ */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ java.awt.Point p2 = menuComponent.getLocationOnScreen();
+ return menuComponent.getAccessibleAt(
+ new java.awt.Point(p.x + x - p2.x, p.y + y - p2.y));
+ }
+
+ public boolean isFocusTraversable() {
+ return menuComponent.isFocusTraversable();
+ }
+
+ public void requestFocus() {
+ menuComponent.requestFocus();
+ }
+ }
+
+ protected static class ListProxy extends AccessibleContext
+ implements Accessible, AccessibleComponent {
+ AccessibleContext list;
+ AccessibleComponent listComponent;
+
+ ListProxy(AccessibleContext ac) {
+ list = ac;
+ listComponent = list.getAccessibleComponent();
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ return this;
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleComponent getAccessibleComponent() {
+ return this;
+ }
+
+ /** Returns the AccessibleSelection associated with this object */
+ public javax.accessibility.AccessibleSelection getAccessibleSelection() {
+ return list.getAccessibleSelection();
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ return list.getAccessibleStateSet();
+ }
+
+ public java.util.Locale getLocale() {
+ return list.getLocale();
+ }
+
+ public int getAccessibleIndexInParent() {
+ return -1;
+ }
+
+ public int getAccessibleChildrenCount() {
+ return list.getAccessibleChildrenCount();
+ }
+
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ return list.getAccessibleChild(i);
+ }
+
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.LIST;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+ public void addFocusListener(java.awt.event.FocusListener fl) {
+ listComponent.addFocusListener(fl);
+ }
+
+ public void removeFocusListener(java.awt.event.FocusListener fl) {
+ listComponent.removeFocusListener(fl);
+ }
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ return listComponent.getBackground();
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ return listComponent.getForeground();
+ }
+
+ public void setForeground(java.awt.Color c) {
+ listComponent.setForeground(c);
+ }
+
+ public java.awt.Cursor getCursor() {
+ return listComponent.getCursor();
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ listComponent.setCursor(cursor);
+ }
+
+ public java.awt.Font getFont() {
+ return listComponent.getFont();
+ }
+
+ public void setFont(java.awt.Font f) {
+ listComponent.setFont(f);
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ return listComponent.getFontMetrics(f);
+ }
+
+ public boolean isEnabled() {
+ return listComponent.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ listComponent.setEnabled(b);
+ }
+
+ public boolean isVisible() {
+ return listComponent.isVisible();
+ }
+
+ public void setVisible(boolean b) {
+ listComponent.setVisible(b);
+ }
+
+ public boolean isShowing() {
+ return listComponent.isShowing();
+ }
+
+ public boolean contains(java.awt.Point p) {
+ return listComponent.contains(p);
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ return listComponent.getLocationOnScreen();
+ }
+
+ /** Gets the location of this component in the form of a point specifying
+ * the component's top-left corner
+ */
+ public java.awt.Point getLocation() {
+ // This object represents a toplevel object, so getLocation() should
+ // return the same as getLocationOnScreen().
+ return getLocationOnScreen();
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ java.awt.Point p = getLocationOnScreen();
+ java.awt.Dimension d = getSize();
+ return new java.awt.Rectangle(p.x, p.y, d.width, d.height);
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ return listComponent.getSize();
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the Accessible child, if one exists, contained at the local
+ * coordinate Point
+ */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ return listComponent.getAccessibleAt(p);
+ }
+
+ public boolean isFocusTraversable() {
+ return listComponent.isFocusTraversable();
+ }
+
+ public void requestFocus() {
+ listComponent.requestFocus();
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component b/accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component
new file mode 100644
index 000000000000..5fc897f2d5aa
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/accessibility/java_uno_accessbridge.component
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.Java2"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.accessibility.AccessBridge">
+ <service name="com.sun.star.accessibility.AccessBridge"/>
+ </implementation>
+</component>
diff --git a/accessibility/bridge/org/openoffice/accessibility/makefile.mk b/accessibility/bridge/org/openoffice/accessibility/makefile.mk
new file mode 100755
index 000000000000..1fa29f5bfcb1
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/accessibility/makefile.mk
@@ -0,0 +1,62 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJNAME = accessibility
+PRJ = ..$/..$/..$/..
+TARGET = java_uno_accessbridge
+PACKAGE = org$/openoffice$/accessibility
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+JARFILES = jurt.jar unoil.jar ridl.jar
+JAVAFILES = \
+ AccessBridge.java \
+ KeyHandler.java \
+ PopupWindow.java \
+ WindowsAccessBridgeAdapter.java
+
+JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+JARCLASSDIRS = $(PACKAGE) org/openoffice/java/accessibility
+CUSTOMMANIFESTFILE = manifest
+
+# --- Targets ------------------------------------------------------
+
+
+.INCLUDE : target.mk
+
+ALLTAR : $(MISC)/java_uno_accessbridge.component
+
+$(MISC)/java_uno_accessbridge.component .ERRREMOVE : \
+ $(SOLARENV)/bin/createcomponent.xslt java_uno_accessbridge.component
+ $(XSLTPROC) --nonet --stringparam uri \
+ '$(COMPONENTPREFIX_BASIS_JAVA)$(JARTARGET)' -o $@ \
+ $(SOLARENV)/bin/createcomponent.xslt java_uno_accessbridge.component
diff --git a/accessibility/bridge/org/openoffice/accessibility/manifest b/accessibility/bridge/org/openoffice/accessibility/manifest
new file mode 100755
index 000000000000..4b5ffd54d34b
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/accessibility/manifest
@@ -0,0 +1,2 @@
+RegistrationClassName: org.openoffice.accessibility.AccessBridge
+UNO-Type-Path:
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java b/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java
new file mode 100644
index 000000000000..be7b72df8732
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AbstractButton.java
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleState;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+/**
+ */
+public abstract class AbstractButton extends Component {
+
+ protected AbstractButton(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ protected abstract class AccessibleAbstractButton extends AccessibleUNOComponent
+ implements javax.accessibility.AccessibleAction {
+
+ /**
+ * Though the class is abstract, this should be called by all sub-classes
+ */
+ protected AccessibleAbstractButton() {
+ super();
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the AccessibleAction associated with this object that supports one or more actions */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ return this;
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText)
+ UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent);
+ if (unoAccessibleText != null) {
+ return new AccessibleTextImpl(unoAccessibleText);
+ } else {
+ return null;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the relation set of this object */
+ public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() {
+ try {
+ XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet();
+
+ if (unoAccessibleRelationSet == null) {
+ return null;
+ }
+
+ javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet();
+ int count = unoAccessibleRelationSet.getRelationCount();
+
+ for (int i = 0; i < count; i++) {
+ AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i);
+
+ switch (unoAccessibleRelation.RelationType) {
+ case AccessibleRelationType.MEMBER_OF:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ getAccessibleComponents(
+ unoAccessibleRelation.TargetSet)));
+ break;
+
+ case AccessibleRelationType.LABELED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABELED_BY,
+ getAccessibleComponents(
+ unoAccessibleRelation.TargetSet)));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return relationSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /*
+ * AccessibleAction
+ */
+
+ /** Performs the specified Action on the object */
+ public boolean doAccessibleAction(int param) {
+ if (param == 0) {
+ // HACK: this action might open a modal dialog and therefor block
+ // until the dialog is closed. In case of this thread being the
+ // AWT EventDispatcherThread this means, the opened dialog will
+ // not be accessible, so deligate this request to another thread.
+ if (java.awt.EventQueue.isDispatchThread()) {
+ Thread t = new Thread () {
+ public void run() {
+ AbstractButton.AccessibleAbstractButton.this.doAccessibleAction(0);
+ }
+ };
+ t.start();
+ return true;
+ } else {
+ // Actions of MenuItems may also be performed if the item is not
+ // visible, so just try ..
+ try {
+ XAccessibleContext xAccessibleContext = unoAccessibleContext;
+ if (xAccessibleContext != null) {
+ // Query for XAccessibleAction interface
+ XAccessibleAction xAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, xAccessibleContext);
+
+ if (xAccessibleAction != null) {
+ return xAccessibleAction.doAccessibleAction(0);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /** Returns a description of the specified action of the object */
+ public java.lang.String getAccessibleActionDescription(int param) {
+ return javax.swing.UIManager.getString("AbstractButton.clickText");
+ }
+
+ /** Returns the number of accessible actions available in this object */
+ public int getAccessibleActionCount() {
+ return 1;
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java
new file mode 100644
index 000000000000..e4905752d833
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleActionImpl.java
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.XAccessibleAction;
+
+/** The AccessibleActionWrapper maps the calls to the java AccessibleAction interface
+ * to the corresponding methods of the UNO XAccessibleAction interface.
+ */
+public class AccessibleActionImpl implements javax.accessibility.AccessibleAction {
+
+ protected XAccessibleAction unoObject;
+
+ /** Creates new AccessibleActionWrapper */
+ public AccessibleActionImpl(XAccessibleAction xAccessibleAction) {
+ unoObject = xAccessibleAction;
+ }
+
+ public boolean doAccessibleAction(int param) {
+ try {
+ return unoObject.doAccessibleAction(param);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ public java.lang.String getAccessibleActionDescription(int param) {
+ try {
+ return unoObject.getAccessibleActionDescription(param);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public int getAccessibleActionCount() {
+ try {
+ return unoObject.getAccessibleActionCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java
new file mode 100644
index 000000000000..5bac982756a2
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleComponentImpl.java
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+// import com.sun.star.accessibility.XAccessibleExtendedComponent;
+import com.sun.star.uno.UnoRuntime;
+
+public class AccessibleComponentImpl implements javax.accessibility.AccessibleComponent {
+
+ protected XAccessibleComponent unoObject;
+// protected XAccessibleExtendedComponent unoAccessibleExtendedComponent = null;
+
+ /** Creates new AccessibleComponentImpl */
+ public AccessibleComponentImpl(XAccessibleComponent xAccessibleComponent) {
+ unoObject = xAccessibleComponent;
+ }
+
+ protected boolean hasState(short state) {
+ try {
+ XAccessibleContext unoAccessibleContext = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, unoObject);
+ // All UNO accessibility implementations must support XAccessibleContext
+ // and return a valid XAccessibleStateSet ..
+ return unoAccessibleContext.getAccessibleStateSet().contains(state);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ } catch (java.lang.NullPointerException e) {
+ System.err.println("XAccessibleContext unsupported or no XAccessibleStateSet returned.");
+ return false;
+ }
+ }
+
+ /*
+ * XAccessibleComponent
+ */
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ try {
+ return new java.awt.Color(unoObject.getBackground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ try {
+ return new java.awt.Color(unoObject.getForeground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setForeground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Cursor getCursor() {
+ // Not supported by UNO accessibility API
+ return null;
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Font getFont() {
+ // FIXME
+ return null;
+ }
+
+ public void setFont(java.awt.Font f) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ // FIXME
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return hasState(AccessibleStateType.ENABLED);
+ }
+
+ public void setEnabled(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isVisible() {
+ return hasState(AccessibleStateType.VISIBLE);
+ }
+
+ public void setVisible(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isShowing() {
+ return hasState(AccessibleStateType.SHOWING);
+ }
+
+ public boolean contains(java.awt.Point p) {
+ try {
+ return unoObject.containsPoint(new com.sun.star.awt.Point(p.x, p.y));
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoObject.getLocationOnScreen();
+ return new java.awt.Point(unoPoint.X, unoPoint.Y);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the location of this component in the form of a point specifying the component's top-left corner */
+ public java.awt.Point getLocation() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoObject.getLocation();
+ return new java.awt.Point( unoPoint.X, unoPoint.Y );
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ try {
+ com.sun.star.awt.Rectangle unoRect = unoObject.getBounds();
+ return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ try {
+ com.sun.star.awt.Size unoSize = unoObject.getSize();
+ return new java.awt.Dimension(unoSize.Width, unoSize.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ // Not supported by this implementation
+ return null;
+ }
+
+ public boolean isFocusTraversable() {
+ return hasState(AccessibleStateType.FOCUSABLE);
+ }
+
+ public void requestFocus() {
+ unoObject.grabFocus();
+ }
+
+ /**
+ * Adds the specified focus listener to receive focus events from
+ * this component when this component gains input focus.
+ * If listener <code>l</code> is <code>null</code>,
+ * no exception is thrown and no action is performed.
+ */
+
+ public void addFocusListener(java.awt.event.FocusListener l) {
+ // Not supported by this implementation
+ }
+
+ /**
+ * Removes the specified focus listener so that it no longer
+ * receives focus events from this component. This method performs
+ * no function, nor does it throw an exception, if the listener
+ * specified by the argument was not previously added to this component.
+ * If listener <code>l</code> is <code>null</code>,
+ * no exception is thrown and no action is performed.
+ */
+
+ public void removeFocusListener(java.awt.event.FocusListener l) {
+ // Not supported by this implementation
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java
new file mode 100644
index 000000000000..4863b560ef71
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleEditableTextImpl.java
@@ -0,0 +1,367 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.awt.*;
+import com.sun.star.style.*;
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.AccessibleTextType;
+import com.sun.star.accessibility.XAccessibleEditableText;
+
+import javax.accessibility.AccessibleText;
+import javax.swing.text.StyleConstants;
+
+/** The GenericAccessibleEditableText mapps the calls to the java AccessibleEditableText
+ * interface to the corresponding methods of the UNO XAccessibleEditableText interface.
+ */
+public class AccessibleEditableTextImpl extends AccessibleTextImpl implements javax.accessibility.AccessibleEditableText {
+ final static double toPointFactor = 1 / (7/10 + 34.5);
+
+ /** Creates new GenericAccessibleEditableText object */
+ public AccessibleEditableTextImpl(XAccessibleEditableText xAccessibleEditableText) {
+ super(xAccessibleEditableText);
+ }
+
+ /** Cuts the text between two indices into the system clipboard */
+ public void cut(int startIndex, int endIndex) {
+ try {
+ ((XAccessibleEditableText) unoObject).cutText(startIndex, endIndex);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Deletes the text between two indices */
+ public void delete(int startIndex, int endIndex) {
+ try {
+ ((XAccessibleEditableText) unoObject).deleteText(startIndex, endIndex);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Returns the text range between two indices */
+ public String getTextRange(int startIndex, int endIndex) {
+ try {
+ return unoObject.getTextRange(startIndex, endIndex);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return null;
+ }
+
+ /** Inserts the specified string at the given index */
+ public void insertTextAtIndex(int index, String s){
+ try {
+ ((XAccessibleEditableText) unoObject).insertText(s, index);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Pastes the text form the system clipboard into the text starting at the specified index */
+ public void paste(int startIndex) {
+ try {
+ ((XAccessibleEditableText) unoObject).pasteText(startIndex);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Replaces the text between two indices with the specified string */
+ public void replaceText(int startIndex, int endIndex, String s) {
+ try {
+ ((XAccessibleEditableText) unoObject).replaceText(startIndex, endIndex, s);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Selects the text between two indices */
+ public void selectText(int startIndex, int endIndex) {
+ try {
+ unoObject.setSelection(startIndex, endIndex);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Sets the attributes for the text between two indices */
+ public void setAttributes(int startIndex, int endIndex, javax.swing.text.AttributeSet as) {
+ java.util.Vector propertyValues = new java.util.Vector();
+
+ // Convert Alignment attribute
+ Object attribute = as.getAttribute(StyleConstants.Alignment);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaAdjust";
+
+ switch (StyleConstants.getAlignment(as)) {
+ case StyleConstants.ALIGN_RIGHT:
+ propertyValue.Value = ParagraphAdjust.RIGHT;
+ break;
+ case StyleConstants.ALIGN_CENTER:
+ propertyValue.Value = ParagraphAdjust.CENTER;
+ break;
+ case StyleConstants.ALIGN_JUSTIFIED:
+ propertyValue.Value = ParagraphAdjust.BLOCK;
+ break;
+ default:
+ propertyValue.Value = ParagraphAdjust.LEFT;
+ break;
+ }
+ propertyValues.add(propertyValue);
+ }
+
+ // Convert Background attribute
+ attribute = as.getAttribute(StyleConstants.Background);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharBackColor";
+ propertyValue.Value = new Integer(StyleConstants.getBackground(as).getRGB());
+ propertyValues.add(propertyValue);
+ }
+
+ // FIXME: BidiLevel
+
+ // Set Bold attribute
+ attribute = as.getAttribute(StyleConstants.Bold);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharWeight";
+ if (StyleConstants.isBold(as)) {
+ propertyValue.Value = new Float(150);
+ } else {
+ propertyValue.Value = new Float(100);
+ }
+ propertyValues.add(propertyValue);
+ }
+
+ // FIXME: Java 1.4 ComponentAttribute, ComponentElementName, ComposedTextAttribute
+
+ // Set FirstLineIndent attribute
+ attribute = as.getAttribute(StyleConstants.FirstLineIndent);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaFirstLineIndent";
+ propertyValue.Value = new Double(StyleConstants.getFirstLineIndent(as) / toPointFactor);
+ propertyValues.add(propertyValue);
+ }
+
+ // Set font family attribute
+ attribute = as.getAttribute(StyleConstants.FontFamily);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharFontPitch";
+
+ if (StyleConstants.getFontFamily(as).equals( "Proportional" )) {
+ propertyValue.Value = new Short("2");
+ } else {
+ propertyValue.Value = new Short("1");
+ }
+ propertyValues.add(propertyValue);
+ }
+
+ // Set font size attribute
+ attribute = as.getAttribute(StyleConstants.FontSize);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharHeight";
+ propertyValue.Value = new Integer(StyleConstants.getFontSize(as));
+ propertyValues.add(propertyValue);
+ }
+
+ // Map foreground color
+ attribute = as.getAttribute(StyleConstants.Foreground);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharColor";
+ propertyValue.Value = new Integer (StyleConstants.getForeground(as).getRGB());
+ propertyValues.add(propertyValue);
+ }
+
+ // FIXME: IconAttribute, IconElementName
+
+ // Set italic attribute
+ attribute = as.getAttribute(StyleConstants.Italic);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharPosture";
+
+ if (StyleConstants.isItalic(as)) {
+ propertyValue.Value = FontSlant.ITALIC;
+ } else {
+ propertyValue.Value = FontSlant.DONTKNOW;
+ }
+ propertyValues.add(propertyValue);
+ }
+
+ // Set left indent attribute
+ attribute = as.getAttribute(StyleConstants.LeftIndent);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaFirstLeftMargin";
+ propertyValue.Value = new Integer(new Double(StyleConstants.getLeftIndent(as) / toPointFactor).intValue());
+ propertyValues.add(propertyValue);
+ }
+
+ // Set right indent attribute
+ attribute = as.getAttribute(StyleConstants.RightIndent);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaFirstRightMargin";
+ propertyValue.Value = new Integer(new Double(StyleConstants.getRightIndent(as) / toPointFactor).intValue());
+ propertyValues.add(propertyValue);
+ }
+
+ // Set line spacing attribute
+ attribute = as.getAttribute(StyleConstants.LineSpacing);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaLineSpacing";
+ propertyValue.Value = new Integer(new Double(StyleConstants.getLineSpacing(as) / toPointFactor).intValue());
+ propertyValues.add(propertyValue);
+ }
+
+ // FIXME: Java 1.4 NameAttribute, Orientation, ResolveAttribute
+
+ // Set space above attribute
+ attribute = as.getAttribute(StyleConstants.SpaceAbove);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaTopMargin";
+ propertyValue.Value = new Integer(new Double( StyleConstants.getSpaceAbove(as) / toPointFactor).intValue());
+ propertyValues.add(propertyValue);
+ }
+
+ // Set space below attribute
+ attribute = as.getAttribute(StyleConstants.SpaceBelow);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaBottomMargin";
+ propertyValue.Value = new Integer(new Double(StyleConstants.getSpaceBelow(as) / toPointFactor).intValue());
+ propertyValues.add(propertyValue);
+ }
+
+ // Set strike through attribute
+ attribute = as.getAttribute(StyleConstants.StrikeThrough);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharPosture";
+ if (StyleConstants.isStrikeThrough(as)) {
+ propertyValue.Value = new Short(FontStrikeout.SINGLE);
+ } else {
+ propertyValue.Value = new Short(FontStrikeout.NONE);
+ }
+ propertyValues.add(propertyValue);
+ }
+
+ // Set sub-/superscript attribute
+ attribute = as.getAttribute(StyleConstants.Superscript);
+ if (null == attribute) {
+ attribute = as.getAttribute(StyleConstants.Subscript);
+ }
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharEscapement";
+
+ if (StyleConstants.isSuperscript(as)) {
+ propertyValue.Value = new Short( "1" );
+ } else if (StyleConstants.isSubscript(as)) {
+ propertyValue.Value = new Short( "-1" );
+ } else {
+ propertyValue.Value = new Short( "0" );
+ }
+ propertyValues.add(propertyValue);
+ }
+
+ // Set tabset attribute
+ attribute = as.getAttribute(StyleConstants.TabSet);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "ParaTabStops";
+
+ javax.swing.text.TabSet tabSet = StyleConstants.getTabSet(as);
+ java.util.ArrayList tabStops = new java.util.ArrayList(tabSet.getTabCount());
+
+ for (int i = 0, max = tabSet.getTabCount(); i < max; i++) {
+ javax.swing.text.TabStop tab = tabSet.getTab(i);
+ com.sun.star.style.TabStop unoTab = new com.sun.star.style.TabStop();
+
+ unoTab.Position = new Double(tab.getPosition() / toPointFactor).intValue();
+
+ switch (tab.getAlignment()) {
+ case javax.swing.text.TabStop.ALIGN_CENTER:
+ unoTab.Alignment = TabAlign.CENTER;
+ break;
+ case javax.swing.text.TabStop.ALIGN_RIGHT:
+ unoTab.Alignment = TabAlign.RIGHT;
+ break;
+ case javax.swing.text.TabStop.ALIGN_DECIMAL:
+ unoTab.Alignment = TabAlign.DECIMAL;
+ break;
+ default:
+ unoTab.Alignment = TabAlign.LEFT;
+ break;
+ }
+
+ tabStops.add(unoTab);
+ }
+ propertyValue.Value = (com.sun.star.style.TabStop[]) tabStops.toArray();
+ propertyValues.add(propertyValue);
+ }
+
+ // Set underline attribute
+ attribute = as.getAttribute(StyleConstants.Underline);
+ if (null != attribute) {
+ com.sun.star.beans.PropertyValue propertyValue = new com.sun.star.beans.PropertyValue();
+ propertyValue.Name = "CharUnderline";
+
+ if (StyleConstants.isUnderline(as)) {
+ propertyValue.Value = new Short(FontUnderline.SINGLE);
+ } else {
+ propertyValue.Value = new Short(FontUnderline.NONE);
+ }
+ propertyValues.add(propertyValue);
+ }
+
+ try {
+ ((XAccessibleEditableText) unoObject).setAttributes(startIndex, endIndex, (com.sun.star.beans.PropertyValue[]) propertyValues.toArray());
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Sets the text contents to the specified string */
+ public void setTextContents(String s) {
+ try {
+ ((XAccessibleEditableText) unoObject).setText(s);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java
new file mode 100644
index 000000000000..3d4500d322df
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleExtendedState.java
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleState;
+
+public class AccessibleExtendedState extends AccessibleState {
+ public static final AccessibleState DEFUNCT;
+ public static final AccessibleState INDETERMINATE;
+ public static final AccessibleState MANAGES_DESCENDANTS;
+ public static final AccessibleState SENSITIVE;
+ public static final AccessibleState STALE;
+
+ static {
+ DEFUNCT = new AccessibleExtendedState("defunct");
+
+ // JAVA 1.5: will come with manages_descendants and indeterminate
+ INDETERMINATE = new AccessibleExtendedState("indeterminate");
+ MANAGES_DESCENDANTS = new AccessibleExtendedState("managesDescendants");
+
+ SENSITIVE = new AccessibleExtendedState("sensitive");
+ STALE = new AccessibleExtendedState("stale");
+ }
+
+ protected AccessibleExtendedState(String key) {
+ super(key);
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java
new file mode 100644
index 000000000000..1bb3bc5961ad
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleHypertextImpl.java
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import org.openoffice.java.accessibility.logging.*;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+/** The AccessibleHypertextImpl mapps all calls to the java AccessibleHypertext
+ * interface to the corresponding methods of the UNO XAccessibleHypertext
+ * interface.
+ */
+public class AccessibleHypertextImpl extends AccessibleTextImpl
+ implements javax.accessibility.AccessibleHypertext {
+
+ protected class Hyperlink extends javax.accessibility.AccessibleHyperlink {
+ protected XAccessibleHyperlink unoObject;
+
+ public Hyperlink(XAccessibleHyperlink xHyperlink) {
+ unoObject = xHyperlink;
+ }
+
+ public int getStartIndex() {
+ try {
+ System.err.println("StartIndex: " + unoObject.getStartIndex());
+ return unoObject.getStartIndex();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ public Object getAccessibleActionObject(int param) {
+ System.err.println("getActionObject");
+ try {
+ Object any = unoObject.getAccessibleActionObject(param);
+ if (AnyConverter.isString(any)) {
+ String url = AnyConverter.toString(any);
+ if (null != url) {
+ return new java.net.URL(url);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ } catch (java.net.MalformedURLException exception) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+
+ return null;
+ }
+
+ public int getEndIndex() {
+ try {
+ System.err.println("StartIndex: " + unoObject.getEndIndex());
+ return unoObject.getEndIndex();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ public Object getAccessibleActionAnchor(int param) {
+ System.err.println("getActionAnchor");
+ try {
+ Object any = unoObject.getAccessibleActionObject(param);
+ if (AnyConverter.isString(any)) {
+ System.err.println("Anchor: " + AnyConverter.toString(any));
+ return AnyConverter.toString(any);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return null;
+ }
+
+ public boolean isValid() {
+ return unoObject.isValid();
+ }
+
+ public boolean doAccessibleAction(int param) {
+ try {
+ return unoObject.doAccessibleAction(param);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ public String getAccessibleActionDescription(int param) {
+ try {
+ return unoObject.getAccessibleActionDescription(param);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+ public int getAccessibleActionCount() {
+ try {
+ return unoObject.getAccessibleActionCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+ }
+
+ /** Creates new AccessibleHypertextImpl */
+ public AccessibleHypertextImpl(XAccessibleHypertext xAccessibleHypertext) {
+ if (Build.PRODUCT) {
+ unoObject = xAccessibleHypertext;
+ } else {
+ String property = System.getProperty("AccessBridgeLogging");
+ if ((property != null) && (property.indexOf("text") != -1)) {
+ unoObject = new XAccessibleHypertextLog(xAccessibleHypertext);
+ } else {
+ unoObject = xAccessibleHypertext;
+ }
+ }
+ }
+
+ public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) {
+ try {
+ XAccessibleHypertext unoAccessibleHypertext = (XAccessibleHypertext)
+ UnoRuntime.queryInterface(XAccessibleHypertext.class, unoObject);
+ if (unoAccessibleHypertext != null) {
+ return new AccessibleHypertextImpl(unoAccessibleHypertext);
+ }
+
+ XAccessibleText unoAccessibleText = (XAccessibleText)
+ UnoRuntime.queryInterface(XAccessibleText.class, unoObject);
+ if (unoAccessibleText != null) {
+ return new AccessibleTextImpl(unoAccessibleText);
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return null;
+ }
+
+ public javax.accessibility.AccessibleHyperlink getLink(int param) {
+ try {
+ return new Hyperlink(((XAccessibleHypertext) unoObject).getHyperLink(param));
+ }
+
+ catch(com.sun.star.lang.IndexOutOfBoundsException exception) {
+ throw new IndexOutOfBoundsException(exception.getMessage());
+ }
+ }
+
+ public int getLinkCount() {
+ try {
+ return ((XAccessibleHypertext) unoObject).getHyperLinkCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ public int getLinkIndex(int param) {
+ try {
+ return ((XAccessibleHypertext) unoObject).getHyperLinkIndex(param);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return -1;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java
new file mode 100644
index 000000000000..ba41534f245b
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleIconImpl.java
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.XAccessibleImage;
+
+/**
+ */
+public class AccessibleIconImpl implements javax.accessibility.AccessibleIcon {
+
+ XAccessibleImage unoAccessibleImage;
+
+ public AccessibleIconImpl(XAccessibleImage xImage) {
+ unoAccessibleImage = xImage;
+ }
+
+ /** Gets the description of the icon */
+ public String getAccessibleIconDescription() {
+ try {
+ return unoAccessibleImage.getAccessibleImageDescription();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the height of the icon */
+ public int getAccessibleIconHeight() {
+ try {
+ return unoAccessibleImage.getAccessibleImageHeight();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Gets the width of the icon */
+ public int getAccessibleIconWidth() {
+ try {
+ return unoAccessibleImage.getAccessibleImageWidth();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Sets the description of the icon */
+ public void setAccessibleIconDescription(String s) {
+ // Not supported
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java
new file mode 100644
index 000000000000..1eb3201c5d68
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleKeyBinding.java
@@ -0,0 +1,386 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.awt.KeyStroke;
+
+/**
+ *
+ */
+public class AccessibleKeyBinding extends Object implements javax.accessibility.AccessibleKeyBinding {
+
+ XAccessibleKeyBinding unoAccessibleKeybinding;
+
+ public AccessibleKeyBinding(XAccessibleKeyBinding unoKB) {
+ unoAccessibleKeybinding = unoKB;
+ }
+
+ public static int convertModifiers(short s) {
+ int modifiers = 0;
+ if ((s & com.sun.star.awt.KeyModifier.SHIFT) != 0) {
+ modifiers = modifiers | java.awt.event.KeyEvent.SHIFT_DOWN_MASK;
+ }
+
+ if ((s & com.sun.star.awt.KeyModifier.MOD1) != 0) {
+ modifiers = modifiers | java.awt.event.KeyEvent.CTRL_DOWN_MASK;
+ }
+
+ if ((s & com.sun.star.awt.KeyModifier.MOD2) != 0) {
+ modifiers = modifiers | java.awt.event.KeyEvent.ALT_DOWN_MASK;
+ }
+
+ if ((s & com.sun.star.awt.KeyModifier.MOD3) != 0) {
+ modifiers = modifiers | java.awt.event.KeyEvent.META_DOWN_MASK;
+ }
+
+ return modifiers;
+ }
+
+ public static int convertKeyCode(short s) {
+ int keycode = java.awt.event.KeyEvent.VK_UNDEFINED;
+
+ switch(s) {
+ case com.sun.star.awt.Key.NUM0:
+ keycode = java.awt.event.KeyEvent.VK_0;
+ break;
+ case com.sun.star.awt.Key.NUM1:
+ keycode = java.awt.event.KeyEvent.VK_1;
+ break;
+ case com.sun.star.awt.Key.NUM2:
+ keycode = java.awt.event.KeyEvent.VK_2;
+ break;
+ case com.sun.star.awt.Key.NUM3:
+ keycode = java.awt.event.KeyEvent.VK_3;
+ break;
+ case com.sun.star.awt.Key.NUM4:
+ keycode = java.awt.event.KeyEvent.VK_4;
+ break;
+ case com.sun.star.awt.Key.NUM5:
+ keycode = java.awt.event.KeyEvent.VK_5;
+ break;
+ case com.sun.star.awt.Key.NUM6:
+ keycode = java.awt.event.KeyEvent.VK_6;
+ break;
+ case com.sun.star.awt.Key.NUM7:
+ keycode = java.awt.event.KeyEvent.VK_7;
+ break;
+ case com.sun.star.awt.Key.NUM8:
+ keycode = java.awt.event.KeyEvent.VK_8;
+ break;
+ case com.sun.star.awt.Key.NUM9:
+ keycode = java.awt.event.KeyEvent.VK_9;
+ break;
+ case com.sun.star.awt.Key.A:
+ keycode = java.awt.event.KeyEvent.VK_A;
+ break;
+ case com.sun.star.awt.Key.B:
+ keycode = java.awt.event.KeyEvent.VK_B;
+ break;
+ case com.sun.star.awt.Key.C:
+ keycode = java.awt.event.KeyEvent.VK_C;
+ break;
+ case com.sun.star.awt.Key.D:
+ keycode = java.awt.event.KeyEvent.VK_D;
+ break;
+ case com.sun.star.awt.Key.E:
+ keycode = java.awt.event.KeyEvent.VK_E;
+ break;
+ case com.sun.star.awt.Key.F:
+ keycode = java.awt.event.KeyEvent.VK_F;
+ break;
+ case com.sun.star.awt.Key.G:
+ keycode = java.awt.event.KeyEvent.VK_G;
+ break;
+ case com.sun.star.awt.Key.H:
+ keycode = java.awt.event.KeyEvent.VK_H;
+ break;
+ case com.sun.star.awt.Key.I:
+ keycode = java.awt.event.KeyEvent.VK_I;
+ break;
+ case com.sun.star.awt.Key.J:
+ keycode = java.awt.event.KeyEvent.VK_J;
+ break;
+ case com.sun.star.awt.Key.K:
+ keycode = java.awt.event.KeyEvent.VK_K;
+ break;
+ case com.sun.star.awt.Key.L:
+ keycode = java.awt.event.KeyEvent.VK_L;
+ break;
+ case com.sun.star.awt.Key.M:
+ keycode = java.awt.event.KeyEvent.VK_M;
+ break;
+ case com.sun.star.awt.Key.N:
+ keycode = java.awt.event.KeyEvent.VK_N;
+ break;
+ case com.sun.star.awt.Key.O:
+ keycode = java.awt.event.KeyEvent.VK_O;
+ break;
+ case com.sun.star.awt.Key.P:
+ keycode = java.awt.event.KeyEvent.VK_P;
+ break;
+ case com.sun.star.awt.Key.Q:
+ keycode = java.awt.event.KeyEvent.VK_Q;
+ break;
+ case com.sun.star.awt.Key.R:
+ keycode = java.awt.event.KeyEvent.VK_R;
+ break;
+ case com.sun.star.awt.Key.S:
+ keycode = java.awt.event.KeyEvent.VK_S;
+ break;
+ case com.sun.star.awt.Key.T:
+ keycode = java.awt.event.KeyEvent.VK_T;
+ break;
+ case com.sun.star.awt.Key.U:
+ keycode = java.awt.event.KeyEvent.VK_U;
+ break;
+ case com.sun.star.awt.Key.V:
+ keycode = java.awt.event.KeyEvent.VK_V;
+ break;
+ case com.sun.star.awt.Key.W:
+ keycode = java.awt.event.KeyEvent.VK_W;
+ break;
+ case com.sun.star.awt.Key.X:
+ keycode = java.awt.event.KeyEvent.VK_X;
+ break;
+ case com.sun.star.awt.Key.Y:
+ keycode = java.awt.event.KeyEvent.VK_Y;
+ break;
+ case com.sun.star.awt.Key.Z:
+ keycode = java.awt.event.KeyEvent.VK_Z;
+ break;
+ case com.sun.star.awt.Key.F1:
+ keycode = java.awt.event.KeyEvent.VK_F1;
+ break;
+ case com.sun.star.awt.Key.F2:
+ keycode = java.awt.event.KeyEvent.VK_F2;
+ break;
+ case com.sun.star.awt.Key.F3:
+ keycode = java.awt.event.KeyEvent.VK_F3;
+ break;
+ case com.sun.star.awt.Key.F4:
+ keycode = java.awt.event.KeyEvent.VK_F4;
+ break;
+ case com.sun.star.awt.Key.F5:
+ keycode = java.awt.event.KeyEvent.VK_F5;
+ break;
+ case com.sun.star.awt.Key.F6:
+ keycode = java.awt.event.KeyEvent.VK_F6;
+ break;
+ case com.sun.star.awt.Key.F7:
+ keycode = java.awt.event.KeyEvent.VK_F7;
+ break;
+ case com.sun.star.awt.Key.F8:
+ keycode = java.awt.event.KeyEvent.VK_F8;
+ break;
+ case com.sun.star.awt.Key.F9:
+ keycode = java.awt.event.KeyEvent.VK_F9;
+ break;
+ case com.sun.star.awt.Key.F10:
+ keycode = java.awt.event.KeyEvent.VK_F10;
+ break;
+ case com.sun.star.awt.Key.F11:
+ keycode = java.awt.event.KeyEvent.VK_F11;
+ break;
+ case com.sun.star.awt.Key.F12:
+ keycode = java.awt.event.KeyEvent.VK_F12;
+ break;
+ case com.sun.star.awt.Key.F13:
+ keycode = java.awt.event.KeyEvent.VK_F13;
+ break;
+ case com.sun.star.awt.Key.F14:
+ keycode = java.awt.event.KeyEvent.VK_F14;
+ break;
+ case com.sun.star.awt.Key.F15:
+ keycode = java.awt.event.KeyEvent.VK_F15;
+ break;
+ case com.sun.star.awt.Key.F16:
+ keycode = java.awt.event.KeyEvent.VK_F16;
+ break;
+ case com.sun.star.awt.Key.F17:
+ keycode = java.awt.event.KeyEvent.VK_F17;
+ break;
+ case com.sun.star.awt.Key.F18:
+ keycode = java.awt.event.KeyEvent.VK_F18;
+ break;
+ case com.sun.star.awt.Key.F19:
+ keycode = java.awt.event.KeyEvent.VK_F19;
+ break;
+ case com.sun.star.awt.Key.F20:
+ keycode = java.awt.event.KeyEvent.VK_F20;
+ break;
+ case com.sun.star.awt.Key.F21:
+ keycode = java.awt.event.KeyEvent.VK_F21;
+ break;
+ case com.sun.star.awt.Key.F22:
+ keycode = java.awt.event.KeyEvent.VK_F22;
+ break;
+ case com.sun.star.awt.Key.F23:
+ keycode = java.awt.event.KeyEvent.VK_F23;
+ break;
+ case com.sun.star.awt.Key.F24:
+ keycode = java.awt.event.KeyEvent.VK_F24;
+ break;
+ case com.sun.star.awt.Key.DOWN:
+ keycode = java.awt.event.KeyEvent.VK_DOWN;
+ break;
+ case com.sun.star.awt.Key.UP:
+ keycode = java.awt.event.KeyEvent.VK_UP;
+ break;
+ case com.sun.star.awt.Key.LEFT:
+ keycode = java.awt.event.KeyEvent.VK_LEFT;
+ break;
+ case com.sun.star.awt.Key.RIGHT:
+ keycode = java.awt.event.KeyEvent.VK_RIGHT;
+ break;
+ case com.sun.star.awt.Key.HOME:
+ keycode = java.awt.event.KeyEvent.VK_HOME;
+ break;
+ case com.sun.star.awt.Key.END:
+ keycode = java.awt.event.KeyEvent.VK_END;
+ break;
+ case com.sun.star.awt.Key.PAGEUP:
+ keycode = java.awt.event.KeyEvent.VK_PAGE_UP;
+ break;
+ case com.sun.star.awt.Key.PAGEDOWN:
+ keycode = java.awt.event.KeyEvent.VK_PAGE_DOWN;
+ break;
+ case com.sun.star.awt.Key.RETURN:
+ keycode = java.awt.event.KeyEvent.VK_ENTER;
+ break;
+ case com.sun.star.awt.Key.ESCAPE:
+ keycode = java.awt.event.KeyEvent.VK_ESCAPE;
+ break;
+ case com.sun.star.awt.Key.TAB:
+ keycode = java.awt.event.KeyEvent.VK_TAB;
+ break;
+ case com.sun.star.awt.Key.BACKSPACE:
+ keycode = java.awt.event.KeyEvent.VK_BACK_SPACE;
+ break;
+ case com.sun.star.awt.Key.SPACE:
+ keycode = java.awt.event.KeyEvent.VK_SPACE;
+ break;
+ case com.sun.star.awt.Key.INSERT:
+ keycode = java.awt.event.KeyEvent.VK_INSERT;
+ break;
+ case com.sun.star.awt.Key.DELETE:
+ keycode = java.awt.event.KeyEvent.VK_DELETE;
+ break;
+ case com.sun.star.awt.Key.ADD:
+ keycode = java.awt.event.KeyEvent.VK_ADD;
+ break;
+ case com.sun.star.awt.Key.SUBTRACT:
+ keycode = java.awt.event.KeyEvent.VK_SUBTRACT;
+ break;
+ case com.sun.star.awt.Key.MULTIPLY:
+ keycode = java.awt.event.KeyEvent.VK_MULTIPLY;
+ break;
+ case com.sun.star.awt.Key.DIVIDE:
+ keycode = java.awt.event.KeyEvent.VK_DIVIDE;
+ break;
+ case com.sun.star.awt.Key.POINT:
+ keycode = java.awt.event.KeyEvent.VK_PERIOD;
+ break;
+ case com.sun.star.awt.Key.COMMA:
+ keycode = java.awt.event.KeyEvent.VK_COMMA;
+ break;
+ case com.sun.star.awt.Key.LESS:
+ keycode = java.awt.event.KeyEvent.VK_LESS;
+ break;
+ case com.sun.star.awt.Key.GREATER:
+ keycode = java.awt.event.KeyEvent.VK_GREATER;
+ break;
+ case com.sun.star.awt.Key.EQUAL:
+ keycode = java.awt.event.KeyEvent.VK_EQUALS;
+ break;
+ case com.sun.star.awt.Key.CUT:
+ keycode = java.awt.event.KeyEvent.VK_CUT;
+ break;
+ case com.sun.star.awt.Key.COPY:
+ keycode = java.awt.event.KeyEvent.VK_COPY;
+ break;
+ case com.sun.star.awt.Key.PASTE:
+ keycode = java.awt.event.KeyEvent.VK_PASTE;
+ break;
+ case com.sun.star.awt.Key.UNDO:
+ keycode = java.awt.event.KeyEvent.VK_UNDO;
+ break;
+ case com.sun.star.awt.Key.FIND:
+ keycode = java.awt.event.KeyEvent.VK_FIND;
+ break;
+ case com.sun.star.awt.Key.PROPERTIES:
+ keycode = java.awt.event.KeyEvent.VK_PROPS;
+ break;
+ case com.sun.star.awt.Key.HELP:
+ keycode = java.awt.event.KeyEvent.VK_HELP;
+ break;
+ default:
+ ;
+ }
+ return keycode;
+ }
+
+ /*
+ * AccessibleKeyBinding
+ */
+
+ /** Returns a key binding for this object */
+ public Object getAccessibleKeyBinding(int i) {
+ try {
+ KeyStroke[] keys = unoAccessibleKeybinding.getAccessibleKeyBinding(i);
+ javax.swing.KeyStroke[] data = new javax.swing.KeyStroke[keys.length];
+ for (int j=0; j < keys.length; j++) {
+ int keyCode = convertKeyCode(keys[j].KeyCode);
+ if (keyCode != java.awt.event.KeyEvent.VK_UNDEFINED) {
+ data[j] = javax.swing.KeyStroke.getKeyStroke(keyCode, convertModifiers(keys[j].Modifiers));
+ } else {
+ data[j] = null;
+ }
+ }
+
+ if (keys.length == 1) {
+ return data[0];
+ } else {
+ return data;
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the number of key bindings for this object */
+ public int getAccessibleKeyBindingCount() {
+ try {
+ return unoAccessibleKeybinding.getAccessibleKeyBindingCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java
new file mode 100644
index 000000000000..129a3b820993
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleObjectFactory.java
@@ -0,0 +1,545 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import java.lang.ref.WeakReference;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleStateSet;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+import org.openoffice.java.accessibility.logging.XAccessibleEventLog;
+
+/**
+*/
+public class AccessibleObjectFactory {
+ // This type is needed for conversions from/to uno Any
+ public static final Type XAccessibleType = new Type(XAccessible.class);
+
+ private static java.util.Hashtable objectList = new java.util.Hashtable();
+ private static java.awt.FocusTraversalPolicy focusTraversalPolicy = new FocusTraversalPolicy();
+
+ private static java.awt.EventQueue theEventQueue = java.awt.Toolkit.getDefaultToolkit().
+ getSystemEventQueue();
+
+ public static java.awt.EventQueue getEventQueue() {
+ return theEventQueue;
+ }
+
+ public static void postFocusGained(java.awt.Component c) {
+ getEventQueue().postEvent(new java.awt.event.FocusEvent(c, java.awt.event.FocusEvent.FOCUS_GAINED));
+ }
+
+ public static void postWindowGainedFocus(java.awt.Window w) {
+ postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS);
+ }
+
+ public static void postWindowLostFocus(java.awt.Window w) {
+ postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_LOST_FOCUS);
+ }
+
+ public static void postWindowActivated(java.awt.Window w) {
+ postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_ACTIVATED);
+ }
+
+ public static void postWindowDeactivated(java.awt.Window w) {
+ postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_DEACTIVATED);
+ }
+
+ public static void postWindowOpened(java.awt.Window w) {
+ postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_OPENED);
+ }
+
+ public static void postWindowClosed(java.awt.Window w) {
+ postWindowEvent(w, java.awt.event.WindowEvent.WINDOW_CLOSED);
+ }
+
+ public static void invokeAndWait() {
+ try {
+ theEventQueue.invokeAndWait( new java.lang.Runnable () {
+ public void run() {
+ }
+ });
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ } catch (java.lang.InterruptedException e) {
+ }
+ }
+
+ private static void postWindowEvent(java.awt.Window w, int i) {
+ theEventQueue.postEvent(new java.awt.event.WindowEvent(w, i));
+ }
+
+ public static java.awt.Component getAccessibleComponent(XAccessible xAccessible) {
+ java.awt.Component c = null;
+ if (xAccessible != null) {
+ // Retrieve unique id for the original UNO object to be used as a hash key
+ String oid = UnoRuntime.generateOid(xAccessible);
+
+ // Check if we already have a wrapper object for this context
+ synchronized (objectList) {
+ WeakReference r = (WeakReference) objectList.get(oid);
+ if(r != null) {
+ c = (java.awt.Component) r.get();
+ }
+ }
+ }
+ return c;
+ }
+
+ public static void addChild(java.awt.Container parent, Object any) {
+ try {
+ addChild(parent, (XAccessible) AnyConverter.toObject(XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.err.println(e.getClass().getName() + " caught: " + e.getMessage());
+ }
+ }
+
+ public static void addChild(java.awt.Container parent, XAccessible child) {
+ try {
+ if (child != null) {
+ XAccessibleContext childAC = child.getAccessibleContext();
+ if (childAC != null) {
+ XAccessibleStateSet stateSet = childAC.getAccessibleStateSet();
+ if (stateSet != null) {
+ java.awt.Component c = getAccessibleComponent(child);
+
+ // Re-use existing wrapper if possible, create a new one otherwise
+ if (c != null) {
+ // Seems to be already in child list
+ if (parent.equals(c.getParent()))
+ return;
+ // Update general component states
+ c.setEnabled(stateSet.contains(AccessibleStateType.ENABLED));
+ c.setVisible(stateSet.contains(AccessibleStateType.VISIBLE));
+ } else {
+ c = createAccessibleComponentImpl(child, childAC, stateSet);
+ }
+
+ if (c != null) {
+ if (c instanceof java.awt.Container) {
+ populateContainer((java.awt.Container) c, childAC);
+ }
+ parent.add(c);
+ // Simulate focus gained event for new child
+ if (stateSet.contains(AccessibleStateType.FOCUSED)) {
+ postFocusGained(c);
+ }
+ }
+ }
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ System.err.println(e.getClass().getName() + " caught: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ protected static void removeChild(java.awt.Container parent, Object any) {
+ try {
+ XAccessible xAccessible = (XAccessible) AnyConverter.toObject(XAccessibleType, any);
+ java.awt.Component c = getAccessibleComponent(xAccessible);
+
+ if (c != null) {
+ parent.remove(c);
+
+ if (c instanceof java.awt.Container) {
+ clearContainer((java.awt.Container) c);
+ }
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.err.println(e.getClass().getName() + " caught: " + e.getMessage());
+ }
+ }
+
+
+ /**
+ * Removes all children from the container parent
+ */
+
+ protected static void clearContainer(java.awt.Container parent) {
+ // Purge all children from this container
+ int count = parent.getComponentCount();
+ for (int i = 0; i < count; i++) {
+ java.awt.Component c = parent.getComponent(i);
+ if (c instanceof java.awt.Container) {
+ clearContainer((java.awt.Container) c);
+ }
+ }
+ parent.removeAll();
+ }
+
+
+ /**
+ * Populates the given Container parent with wrapper objects for all children of parentAC. This method is
+ * intended to be called when a container is added using a CHILDREN_CHANGED event.
+ */
+
+ protected static void populateContainer(java.awt.Container parent, XAccessibleContext parentAC) {
+ if (parentAC != null) {
+ try {
+ int childCount = parentAC.getAccessibleChildCount();
+ for (int i=0; i<childCount; i++) {
+ addChild(parent, parentAC.getAccessibleChild(i));
+ }
+ } catch (java.lang.Exception e) {
+ System.err.println(e.getClass().getName() + " caught: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Populates the given Container parent with wrapper objects for all children of parentAC. This method is
+ * intended to be called when a new window has been opened.
+ */
+ protected static void populateContainer(java.awt.Container parent, XAccessibleContext parentAC, java.awt.Window frame) {
+ if (parentAC != null) {
+ try {
+ int childCount = parentAC.getAccessibleChildCount();
+ for (int i=0; i<childCount; i++) {
+ XAccessible child = parentAC.getAccessibleChild(i);
+ if (child != null) {
+ XAccessibleContext childAC = child.getAccessibleContext();
+ java.awt.Component c = createAccessibleComponent(child, childAC, frame);
+ if (c != null) {
+ if (c instanceof java.awt.Container) {
+ populateContainer((java.awt.Container) c, childAC, frame);
+ }
+ parent.add(c);
+ }
+ } else if (Build.DEBUG) {
+ System.err.println("ignoring not accessible child " + i);
+ }
+ }
+ }
+
+ catch (java.lang.Exception e) {
+ System.err.println(e.getClass().getName() + " caught: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected static java.awt.Component createAccessibleComponent(XAccessible xAccessible) {
+ try {
+ XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext();
+ if (xAccessibleContext != null) {
+ return createAccessibleComponentImpl(xAccessible, xAccessibleContext, xAccessibleContext.getAccessibleStateSet());
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ System.err.println(e.getClass().getName() + " caught: " + e.getMessage());
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ protected static java.awt.Component createAccessibleComponent(XAccessible xAccessible, XAccessibleContext xAccessibleContext,
+ java.awt.Window frame) {
+ if (xAccessibleContext != null) {
+ try {
+ XAccessibleStateSet xAccessibleStateSet = xAccessibleContext.getAccessibleStateSet();
+ java.awt.Component c = createAccessibleComponentImpl(xAccessible, xAccessibleContext, xAccessibleStateSet);
+ if (c != null) {
+ // Set this component as initial component
+ if (xAccessibleStateSet.contains(AccessibleStateType.FOCUSED)) {
+ if (frame instanceof NativeFrame) {
+ ((NativeFrame) frame).setInitialComponent(c);
+ }
+ }
+ return c;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ System.err.println(e.getClass().getName() + " caught: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ protected static java.awt.Component createAccessibleComponentImpl(XAccessible xAccessible, XAccessibleContext xAccessibleContext,
+ XAccessibleStateSet xAccessibleStateSet) {
+ java.awt.Component c = null;
+ short role = xAccessibleContext.getAccessibleRole();
+ switch (role) {
+ case AccessibleRole.CANVAS:
+ c = new Container(javax.accessibility.AccessibleRole.CANVAS,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.CHECK_BOX:
+ c = new CheckBox(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.COMBO_BOX:
+ c = new ComboBox(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.DOCUMENT:
+ c = new Container(javax.accessibility.AccessibleRole.CANVAS,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.EMBEDDED_OBJECT:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.END_NOTE:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.FILLER:
+ c = new Container(javax.accessibility.AccessibleRole.FILLER,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.FOOTNOTE:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.FOOTER:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.GRAPHIC:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.HEADER:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.ICON:
+ c = new Icon(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.LABEL:
+ c = new Label(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.LAYERED_PANE:
+ c = new Container(javax.accessibility.AccessibleRole.LAYERED_PANE,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.LIST:
+ if (xAccessibleStateSet.contains(AccessibleStateType.MANAGES_DESCENDANTS)) {
+ c = new List(xAccessible, xAccessibleContext);
+ } else {
+ c = new Container(javax.accessibility.AccessibleRole.LIST,
+ xAccessible, xAccessibleContext);
+ }
+ break;
+ case AccessibleRole.MENU:
+ c = new Menu(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.MENU_BAR:
+ c = new MenuContainer(javax.accessibility.AccessibleRole.MENU_BAR, xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.MENU_ITEM:
+ c = new MenuItem(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.POPUP_MENU:
+ c = new MenuContainer(javax.accessibility.AccessibleRole.POPUP_MENU, xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.OPTION_PANE:
+ c = new Container(javax.accessibility.AccessibleRole.OPTION_PANE,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.PAGE_TAB:
+ c = new Container(javax.accessibility.AccessibleRole.PAGE_TAB, xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.PAGE_TAB_LIST:
+ c = new Container(javax.accessibility.AccessibleRole.PAGE_TAB_LIST, xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.PARAGRAPH:
+ case AccessibleRole.HEADING:
+ c = new Paragraph(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.PANEL:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.PUSH_BUTTON:
+ c = new Button(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.RADIO_BUTTON:
+ c = new RadioButton(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.ROOT_PANE:
+ c = new Container(javax.accessibility.AccessibleRole.ROOT_PANE,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.SCROLL_BAR:
+ c = new ScrollBar(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.SCROLL_PANE:
+ c = new Container(javax.accessibility.AccessibleRole.SCROLL_PANE,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.SEPARATOR:
+ c = new Separator(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.SHAPE:
+ c = new Container(javax.accessibility.AccessibleRole.CANVAS,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.SPLIT_PANE:
+ c = new Container(javax.accessibility.AccessibleRole.SPLIT_PANE,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.STATUS_BAR:
+ c = new Container(javax.accessibility.AccessibleRole.STATUS_BAR,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.COLUMN_HEADER:
+ case AccessibleRole.TABLE:
+ if (xAccessibleStateSet.contains(AccessibleStateType.MANAGES_DESCENDANTS)) {
+ c = new Table(xAccessible, xAccessibleContext,
+ xAccessibleStateSet.contains(AccessibleStateType.MULTI_SELECTABLE));
+ } else {
+ c = new Container(javax.accessibility.AccessibleRole.TABLE,
+ xAccessible, xAccessibleContext);
+ }
+ break;
+ case AccessibleRole.TABLE_CELL:
+ if( xAccessibleContext.getAccessibleChildCount() > 0 )
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ else
+ c = new Label(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.TEXT:
+ c = new TextComponent(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.TEXT_FRAME:
+ c = new Container(javax.accessibility.AccessibleRole.PANEL,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.TOGGLE_BUTTON:
+ c = new ToggleButton(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.TOOL_BAR:
+ c = new Container(javax.accessibility.AccessibleRole.TOOL_BAR,
+ xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.TOOL_TIP:
+ c = new ToolTip(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.TREE:
+ c = new Tree(xAccessible, xAccessibleContext);
+ break;
+ case AccessibleRole.VIEW_PORT:
+ c = new Container(javax.accessibility.AccessibleRole.VIEWPORT,
+ xAccessible, xAccessibleContext);
+ break;
+ default:
+ System.err.println("Unmapped accessible object " + role);
+ System.err.println("usually mapped to " + AccessibleRoleAdapter.getAccessibleRole(role));
+ c = new Container(AccessibleRoleAdapter.getAccessibleRole(role),
+ xAccessible, xAccessibleContext);
+ break;
+ }
+ if (c != null) {
+ // Add the newly created object to the cache list
+ synchronized (objectList) {
+ objectList.put(c.toString(), new WeakReference(c));
+ if (Build.DEBUG) {
+// System.out.println("Object cache now contains " + objectList.size() + " objects.");
+ }
+ }
+
+ AccessibleStateAdapter.setComponentState(c, xAccessibleStateSet);
+
+ if (! Build.PRODUCT) {
+ String property = System.getProperty("AccessBridgeLogging");
+ if ((property != null) && (property.indexOf("event") != -1)) {
+ XAccessibleEventLog.addEventListener(xAccessibleContext, c);
+ }
+ }
+ }
+
+ return c;
+ }
+
+ protected static void disposing(java.awt.Component c) {
+ if (c != null) {
+ synchronized (objectList) {
+ objectList.remove(c.toString());
+ }
+ }
+ }
+
+ public static java.awt.Window getTopWindow(XAccessible xAccessible) {
+ XAccessibleContext xAccessibleContext = xAccessible.getAccessibleContext();
+
+ if (xAccessibleContext != null) {
+ short role = xAccessibleContext.getAccessibleRole();
+ XAccessibleStateSet xAccessibleStateSet = xAccessibleContext.getAccessibleStateSet();
+ XAccessibleComponent xAccessibleComponent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext);
+
+ java.awt.Window w;
+ if (role == AccessibleRole.DIALOG) {
+ w = new Dialog(new Application(),
+ xAccessibleContext.getAccessibleName(),
+ xAccessibleStateSet.contains(AccessibleStateType.MODAL),
+ xAccessibleComponent);
+ } else if (role == AccessibleRole.ALERT) {
+ w = new Alert(new Application(),
+ xAccessibleContext.getAccessibleName(),
+ xAccessibleStateSet.contains(AccessibleStateType.MODAL),
+ xAccessibleComponent);
+ } else if (role == AccessibleRole.FRAME) {
+ w = new Frame(xAccessibleContext.getAccessibleName(),
+ xAccessibleComponent);
+ } else if (role == AccessibleRole.WINDOW) {
+ java.awt.Window activeWindow =
+ java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
+ if (activeWindow != null) {
+ w = new Window(activeWindow, xAccessibleComponent);
+ } else {
+ if (Build.DEBUG) {
+ System.err.println("no active frame found for Window: " + role);
+ }
+ return null;
+ }
+ } else {
+ if (Build.DEBUG) {
+ System.err.println("invalid role for toplevel window: " + role);
+ }
+ return null;
+ }
+ populateContainer(w, xAccessibleContext, w);
+ w.setFocusTraversalPolicy(focusTraversalPolicy);
+ w.setVisible(true);
+
+ // Make the new window the focused one if it has an initialy focused object set.
+ java.awt.Component c = ((NativeFrame) w).getInitialComponent();
+ if (c != null) {
+ postWindowGainedFocus(w);
+ }
+ return w;
+ }
+
+ return null;
+ }
+}
+
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java
new file mode 100644
index 000000000000..2f1709acac45
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRelationAdapter.java
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import javax.accessibility.Accessible;
+import com.sun.star.accessibility.AccessibleRelation;
+import com.sun.star.accessibility.XAccessible;
+
+/**
+ */
+public abstract class AccessibleRelationTypeMap {
+
+ final static String[] data = {
+ null,
+ javax.accessibility.AccessibleRelation.CONTROLLED_BY,
+ javax.accessibility.AccessibleRelation.CONTROLLED_BY,
+ javax.accessibility.AccessibleRelation.CONTROLLER_FOR,
+ javax.accessibility.AccessibleRelation.CONTROLLER_FOR,
+ javax.accessibility.AccessibleRelation.LABEL_FOR,
+ javax.accessibility.AccessibleRelation.LABEL_FOR,
+ javax.accessibility.AccessibleRelation.LABELED_BY,
+ javax.accessibility.AccessibleRelation.LABELED_BY,
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ javax.accessibility.AccessibleRelation.MEMBER_OF
+ };
+
+ public static void fillAccessibleRelationSet(javax.accessibility.AccessibleRelationSet s, AccessibleRelation[] relations) {
+ AccessibleObjectFactory factory = AccessibleObjectFactory.getDefault();
+ for(int i=0; i<relations.length; i++) {
+ if( relations[i].RelationType < data.length && data[relations[i].RelationType] != null ) {
+ javax.accessibility.AccessibleRelation r =
+ new javax.accessibility.AccessibleRelation(data[relations[i].RelationType]);
+
+ r.setTarget(factory.getAccessibleObjectSet(relations[i].TargetSet));
+ s.add(r);
+ }
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRoleAdapter.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRoleAdapter.java
new file mode 100644
index 000000000000..c7f630fdd3ab
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleRoleAdapter.java
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+
+/** This class maps the AccessibleRole(s) of the UNO accessibility API
+ * to the corresponding javax.accessibility objects.
+ */
+public abstract class AccessibleRoleAdapter {
+
+ /* This array is used as a mapping between the UNO AccessibleRole
+ * and the AccessibleRole objects of the Java accessibility API.
+ */
+ public static final javax.accessibility.AccessibleRole[] data = {
+ javax.accessibility.AccessibleRole.UNKNOWN,
+ javax.accessibility.AccessibleRole.ALERT,
+ javax.accessibility.AccessibleRole.COLUMN_HEADER,
+ javax.accessibility.AccessibleRole.CANVAS,
+ javax.accessibility.AccessibleRole.CHECK_BOX,
+ javax.accessibility.AccessibleRole.CHECK_BOX, // CHECK_MENU_ITEM
+ javax.accessibility.AccessibleRole.COLOR_CHOOSER,
+ javax.accessibility.AccessibleRole.COMBO_BOX,
+ javax.accessibility.AccessibleRole.DATE_EDITOR,
+ javax.accessibility.AccessibleRole.DESKTOP_ICON,
+ javax.accessibility.AccessibleRole.DESKTOP_PANE,
+ javax.accessibility.AccessibleRole.DIRECTORY_PANE,
+ javax.accessibility.AccessibleRole.DIALOG,
+ javax.accessibility.AccessibleRole.CANVAS, // DOCUMENT
+ javax.accessibility.AccessibleRole.PANEL, // EMBEDDED_OBJECT
+ javax.accessibility.AccessibleRole.PANEL, // ENDNOTE
+ javax.accessibility.AccessibleRole.FILE_CHOOSER,
+ javax.accessibility.AccessibleRole.FILLER,
+ javax.accessibility.AccessibleRole.FONT_CHOOSER,
+ javax.accessibility.AccessibleRole.FOOTER,
+ javax.accessibility.AccessibleRole.PANEL, // FOOTNOTE
+ javax.accessibility.AccessibleRole.FRAME,
+ javax.accessibility.AccessibleRole.GLASS_PANE,
+ javax.accessibility.AccessibleRole.PANEL, // GRAPHIC
+ javax.accessibility.AccessibleRole.GROUP_BOX,
+ javax.accessibility.AccessibleRole.HEADER,
+ javax.accessibility.AccessibleRole.TEXT, // HEADING
+ javax.accessibility.AccessibleRole.HYPERLINK,
+ javax.accessibility.AccessibleRole.ICON,
+ javax.accessibility.AccessibleRole.INTERNAL_FRAME,
+ javax.accessibility.AccessibleRole.LABEL,
+ javax.accessibility.AccessibleRole.LAYERED_PANE,
+ javax.accessibility.AccessibleRole.LIST,
+ javax.accessibility.AccessibleRole.LABEL, // LIST_ITEM - required by Zoomtext
+ javax.accessibility.AccessibleRole.MENU,
+ javax.accessibility.AccessibleRole.MENU_BAR,
+ javax.accessibility.AccessibleRole.MENU_ITEM,
+ javax.accessibility.AccessibleRole.OPTION_PANE,
+ javax.accessibility.AccessibleRole.PAGE_TAB,
+ javax.accessibility.AccessibleRole.PAGE_TAB_LIST,
+ javax.accessibility.AccessibleRole.PANEL,
+ javax.accessibility.AccessibleRole.PARAGRAPH,
+ javax.accessibility.AccessibleRole.PASSWORD_TEXT,
+ javax.accessibility.AccessibleRole.POPUP_MENU,
+ javax.accessibility.AccessibleRole.PUSH_BUTTON,
+ javax.accessibility.AccessibleRole.PROGRESS_BAR,
+ javax.accessibility.AccessibleRole.RADIO_BUTTON,
+ javax.accessibility.AccessibleRole.RADIO_BUTTON, // RADIO_MENU_ITEM
+ javax.accessibility.AccessibleRole.ROW_HEADER,
+ javax.accessibility.AccessibleRole.ROOT_PANE,
+ javax.accessibility.AccessibleRole.SCROLL_BAR,
+ javax.accessibility.AccessibleRole.SCROLL_PANE,
+ javax.accessibility.AccessibleRole.CANVAS, // SHAPE
+ javax.accessibility.AccessibleRole.SEPARATOR,
+ javax.accessibility.AccessibleRole.SLIDER,
+ javax.accessibility.AccessibleRole.SPIN_BOX,
+ javax.accessibility.AccessibleRole.SPLIT_PANE,
+ javax.accessibility.AccessibleRole.STATUS_BAR,
+ javax.accessibility.AccessibleRole.TABLE,
+ javax.accessibility.AccessibleRole.LABEL, // TABLE_CELL - required by ZoomText
+ javax.accessibility.AccessibleRole.TEXT,
+ javax.accessibility.AccessibleRole.PANEL, // TEXT_FRAME
+ javax.accessibility.AccessibleRole.TOGGLE_BUTTON,
+ javax.accessibility.AccessibleRole.TOOL_BAR,
+ javax.accessibility.AccessibleRole.TOOL_TIP,
+ javax.accessibility.AccessibleRole.TREE,
+ javax.accessibility.AccessibleRole.VIEWPORT,
+ javax.accessibility.AccessibleRole.WINDOW,
+ javax.accessibility.AccessibleRole.RADIO_BUTTON, // BUTTON_DROPDOWN
+ javax.accessibility.AccessibleRole.RADIO_BUTTON, // BUTTON_MENU
+ javax.accessibility.AccessibleRole.PANEL, // CAPTION
+ javax.accessibility.AccessibleRole.PANEL, // CHART
+ javax.accessibility.AccessibleRole.EDITBAR,
+ javax.accessibility.AccessibleRole.PANEL, // FORM
+ javax.accessibility.AccessibleRole.PANEL, // IMAGE_MAP
+ javax.accessibility.AccessibleRole.PANEL, // NOTE
+ javax.accessibility.AccessibleRole.PANEL, // PAGE
+ javax.accessibility.AccessibleRole.RULER,
+ javax.accessibility.AccessibleRole.PANEL, // SECTION
+ javax.accessibility.AccessibleRole.LABEL, // TREE_ITEM
+ javax.accessibility.AccessibleRole.TABLE // TREE_TABLE
+ };
+
+ public static javax.accessibility.AccessibleRole getAccessibleRole(short role) {
+ if(role < data.length) {
+ if(data[role] == null) {
+ System.err.println("Unmapped role: " + role);
+ }
+ return data[role];
+ }
+ // FIXME: remove debug out
+ System.err.println("Unmappable role: " + role);
+ return null;
+ }
+
+ public static javax.accessibility.AccessibleRole getAccessibleRole(XAccessible unoAccessible) {
+ try {
+ XAccessibleContext unoAccessibleContext = unoAccessible.getAccessibleContext();
+ if (unoAccessibleContext != null) {
+ return getAccessibleRole(unoAccessibleContext.getAccessibleRole());
+ }
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return javax.accessibility.AccessibleRole.UNKNOWN;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java
new file mode 100644
index 000000000000..6e40c1e7a78d
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleSelectionImpl.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+
+class AccessibleSelectionImpl implements javax.accessibility.AccessibleSelection {
+ XAccessibleSelection unoAccessibleSelection;
+
+ AccessibleSelectionImpl(XAccessibleSelection xAccessibleSelection) {
+ unoAccessibleSelection = xAccessibleSelection;
+ }
+
+ /** Returns an Accessible representing the specified selected child of the object */
+ public javax.accessibility.Accessible getAccessibleSelection(int i) {
+ try {
+ return (javax.accessibility.Accessible) AccessibleObjectFactory.getAccessibleComponent(
+ unoAccessibleSelection.getSelectedAccessibleChild(i));
+ } catch (com.sun.star.uno.Exception e) {
+ return null;
+ }
+ }
+
+ /** Adds the specified Accessible child of the object to the object's selection */
+ public void addAccessibleSelection(int i) {
+ try {
+ unoAccessibleSelection.selectAccessibleChild(i);
+ } catch (com.sun.star.uno.Exception e) {
+ }
+ }
+
+ /** Clears the selection in the object, so that no children in the object are selected */
+ public void clearAccessibleSelection() {
+ try {
+ unoAccessibleSelection.clearAccessibleSelection();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Returns the number of Accessible children currently selected */
+ public int getAccessibleSelectionCount() {
+ try {
+ return unoAccessibleSelection.getSelectedAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Determines if the current child of this object is selected */
+ public boolean isAccessibleChildSelected(int i) {
+ try {
+ return unoAccessibleSelection.isAccessibleChildSelected(i);
+ } catch (com.sun.star.uno.Exception e) {
+ return false;
+ }
+ }
+
+ /** Removes the specified child of the object from the object's selection */
+ public void removeAccessibleSelection(int i) {
+ try {
+ unoAccessibleSelection.deselectAccessibleChild(i);
+ } catch (com.sun.star.uno.Exception e) {
+ }
+ }
+
+ /** Causes every child of the object to be selected if the object supports multiple selection */
+ public void selectAllAccessibleSelection() {
+ try {
+ unoAccessibleSelection.selectAllAccessibleChildren();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java
new file mode 100644
index 000000000000..ea1979a545ed
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleStateAdapter.java
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.accessibility.XAccessibleStateSet;
+
+public class AccessibleStateAdapter {
+
+ private static final AccessibleState[] stateTypeMap = {
+ null,
+ AccessibleState.ACTIVE,
+ AccessibleState.ARMED,
+ AccessibleState.BUSY,
+ AccessibleState.CHECKED,
+ AccessibleExtendedState.DEFUNCT,
+ AccessibleState.EDITABLE,
+ AccessibleState.ENABLED,
+ AccessibleState.EXPANDABLE,
+ AccessibleState.EXPANDED,
+ AccessibleState.FOCUSABLE,
+ AccessibleState.FOCUSED,
+ AccessibleState.HORIZONTAL,
+ AccessibleState.ICONIFIED,
+ AccessibleExtendedState.INDETERMINATE,
+ AccessibleExtendedState.MANAGES_DESCENDANTS,
+ AccessibleState.MODAL,
+ AccessibleState.MULTI_LINE,
+ AccessibleState.MULTISELECTABLE,
+ AccessibleState.OPAQUE,
+ AccessibleState.PRESSED,
+ AccessibleState.RESIZABLE,
+ AccessibleState.SELECTABLE,
+ AccessibleState.SELECTED,
+ AccessibleExtendedState.SENSITIVE,
+ AccessibleState.SHOWING,
+ AccessibleState.SINGLE_LINE,
+ AccessibleExtendedState.STALE,
+ AccessibleState.TRANSIENT,
+ AccessibleState.VERTICAL,
+ AccessibleState.VISIBLE
+ };
+
+ private static void printToplevelStateMessage(AccessibleState s, java.awt.Component c) {
+ System.err.println("*** ERROR *** " + s + " state is a toplevel window state " + c);
+ }
+
+ private static String getDisplayName(java.awt.Component c) {
+ javax.accessibility.Accessible a = (javax.accessibility.Accessible) c;
+ if( a != null) {
+ javax.accessibility.AccessibleContext ac = a.getAccessibleContext();
+ return "[" + ac.getAccessibleRole() + "] " + ac.getAccessibleName();
+ } else {
+ return c.toString();
+ }
+ }
+
+ private static void printOutOfSyncMessage(AccessibleState s, java.awt.Component c, boolean enabled) {
+ System.err.println("*** ERROR *** " + s + " state out of sync (UNO state set: " + !enabled + ", Java component state: " + enabled + ") for " + getDisplayName(c));
+ }
+
+ public static AccessibleState getAccessibleState(Object any) {
+ try {
+ if (AnyConverter.isShort(any)) {
+ return getAccessibleState(AnyConverter.toShort(any));
+ }
+ return null;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null;
+ }
+ }
+
+ public static AccessibleState getAccessibleState(short unoStateType) {
+ if (unoStateType > 0 && unoStateType < stateTypeMap.length) {
+ return stateTypeMap[unoStateType];
+ }
+ return null;
+ }
+
+ public static AccessibleStateSet getDefunctStateSet() {
+ AccessibleStateSet ass = new AccessibleStateSet();
+ ass.add(AccessibleExtendedState.DEFUNCT);
+ return ass;
+ }
+
+ public static void setComponentState(java.awt.Component c,
+ XAccessibleStateSet xAccessibleStateSet) {
+
+ try {
+ if (xAccessibleStateSet != null) {
+ // Set the boundings of the component if it is visible ..
+ if (!xAccessibleStateSet.contains(AccessibleStateType.VISIBLE)) {
+ c.setVisible(false);
+ }
+ // Set the components' enabled state ..
+ if (!xAccessibleStateSet.contains(AccessibleStateType.ENABLED)) {
+ c.setEnabled(false);
+ }
+ // Set the components' focusable state ..
+ if (!xAccessibleStateSet.contains(AccessibleStateType.FOCUSABLE)) {
+ c.setFocusable(false);
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ public static AccessibleStateSet getAccessibleStateSet(java.awt.Component c,
+ XAccessibleStateSet xAccessibleStateSet) {
+
+ try {
+ if (xAccessibleStateSet != null) {
+ AccessibleStateSet as = new AccessibleStateSet();
+ short[] unoStateTypes = xAccessibleStateSet.getStates();
+ for (int i=0; i<unoStateTypes.length; i++) {
+ if (unoStateTypes[i] > 0 &&
+ unoStateTypes[i] < stateTypeMap.length) {
+ as.add(stateTypeMap[unoStateTypes[i]]);
+ }
+ }
+
+ // Note: COLLAPSED does not exists in the UAA.
+ if (as.contains(AccessibleState.EXPANDABLE) &&
+ ! as.contains(AccessibleState.EXPANDED)) {
+ as.add(AccessibleState.COLLAPSED);
+ }
+
+ // Sync office and Java FOCUSED state
+ boolean isFocusInSync;
+ if (c.isFocusOwner()) {
+ isFocusInSync = !as.add(AccessibleState.FOCUSED);
+ } else {
+ isFocusInSync = !as.remove(AccessibleState.FOCUSED);
+ }
+
+ // Sync office and Java ACTIVE state
+ boolean isActiveInSync;
+ if (c instanceof java.awt.Window && ((java.awt.Window) c).isActive()) {
+ isActiveInSync = !as.add(AccessibleState.ACTIVE);
+ } else {
+ isActiveInSync = !as.remove(AccessibleState.ACTIVE);
+ }
+
+ // Report out-of-sync messages
+ if (!Build.PRODUCT) {
+ if (!isFocusInSync) {
+ printOutOfSyncMessage(AccessibleState.FOCUSED, c, c.isFocusOwner());
+ }
+ if (!isActiveInSync) {
+ printOutOfSyncMessage(AccessibleState.ACTIVE, c, ((java.awt.Window) c).isActive());
+ }
+ if (as.contains(AccessibleState.ENABLED) != c.isEnabled()) {
+ printOutOfSyncMessage(AccessibleState.ENABLED, c, c.isEnabled());
+ }
+ if (as.contains(AccessibleState.FOCUSABLE) != c.isFocusable()) {
+ printOutOfSyncMessage(AccessibleState.FOCUSABLE, c, c.isFocusable());
+ }
+ if (as.contains(AccessibleState.SHOWING) != c.isShowing()) {
+ printOutOfSyncMessage(AccessibleState.SHOWING, c, c.isShowing());
+ }
+ if (as.contains(AccessibleState.VISIBLE) != c.isVisible()) {
+ printOutOfSyncMessage(AccessibleState.VISIBLE, c, c.isVisible());
+ }
+
+ // The following states are for toplevel windows only
+ if (! (c instanceof java.awt.Window)) {
+ if (as.contains(AccessibleState.ACTIVE)) {
+ printToplevelStateMessage(AccessibleState.ACTIVE, c);
+ }
+ if (as.contains(AccessibleState.ICONIFIED)) {
+ printToplevelStateMessage(AccessibleState.ICONIFIED, c);
+ }
+ if (as.contains(AccessibleState.MODAL)) {
+ printToplevelStateMessage(AccessibleState.MODAL, c);
+ }
+ }
+ }
+ return as;
+ }
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return getDefunctStateSet();
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java
new file mode 100644
index 000000000000..c3bcbde2a71a
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleTextImpl.java
@@ -0,0 +1,678 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.awt.*;
+import com.sun.star.style.*;
+import com.sun.star.uno.*;
+
+import org.openoffice.java.accessibility.logging.*;
+
+import java.text.BreakIterator;
+import java.util.Locale;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleText;
+
+import javax.swing.text.StyleConstants;
+
+/** The GenericAccessibleEditableText mapps the calls to the java AccessibleEditableText
+ * interface to the corresponding methods of the UNO XAccessibleEditableText interface.
+ */
+public class AccessibleTextImpl implements javax.accessibility.AccessibleText {
+ final static double toPointFactor = 1 / ((7 / 10) + 34.5);
+ final static String[] attributeList = {
+ "ParaAdjust", "CharBackColor", "CharWeight", "ParaFirstLineIndent",
+ "CharFontPitch", "CharHeight", "CharColor", "CharPosture",
+ "ParaLeftMargin", "ParaLineSpacing", "ParaTopMargin", "ParaBottomMargin",
+ "CharStrikeout", "CharEscapement", "ParaTabStops", "CharUnderline"
+ };
+
+ final static String[] localeAttributeList = {
+ "CharLocale", "CharLocaleAsian", "CharLocaleComplex"
+ };
+
+ XAccessibleText unoObject;
+ private javax.swing.text.TabSet tabSet = null;
+ private javax.swing.text.TabStop[] tabStops = null;
+ private static Type TextSegmentType = new Type(TextSegment.class);
+ private static Type UnoLocaleType = new Type(com.sun.star.lang.Locale.class);
+
+ /** Creates new GenericAccessibleEditableText object */
+ public AccessibleTextImpl(XAccessibleText xAccessibleText) {
+
+ if (Build.PRODUCT) {
+ unoObject = xAccessibleText;
+ } else {
+ String property = System.getProperty("AccessBridgeLogging");
+ if ((property != null) && (property.indexOf("text") != -1)) {
+ unoObject = new XAccessibleTextLog(xAccessibleText);
+ } else {
+ unoObject = xAccessibleText;
+ }
+ }
+ }
+
+ public AccessibleTextImpl() {
+ }
+
+ public static javax.accessibility.AccessibleText get(com.sun.star.uno.XInterface unoObject) {
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText)
+ UnoRuntime.queryInterface(XAccessibleText.class, unoObject);
+ if (unoAccessibleText != null) {
+ return new AccessibleTextImpl(unoAccessibleText);
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return null;
+ }
+
+ protected static Object convertTextSegment(Object any) {
+ try {
+ if (AnyConverter.isObject(any)) {
+ TextSegment ts = (TextSegment)
+ AnyConverter.toObject(TextSegmentType, any);
+ if (ts != null) {
+ // Since there is nothing like a "range" object in the JAA yet,
+ // the Object[3] is a private negotiation with the JABG
+ Object[] array = { new Integer(ts.SegmentStart),
+ new Integer(ts.SegmentEnd), ts.SegmentText };
+ return array;
+ }
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+
+ return null;
+ }
+
+ /** Returns the locale object.
+ *
+ * Since switching the UI language only takes effect on the next
+ * office start, UI elements can return a cached value here - given
+ * that Java UNO initializes the default locale correctly, this is
+ * the perfect place to grab this cached values.
+ *
+ * However, since there are more sophisticated components with
+ * potentially more than one locale, we first check for the
+ * CharLocale[Asian|Complex] property.
+ */
+
+ protected java.util.Locale getLocale(int index) {
+ try {
+ com.sun.star.beans.PropertyValue[] propertyValues =
+ unoObject.getCharacterAttributes(index, localeAttributeList);
+
+ if (null != propertyValues) {
+ for (int i = 0; i < propertyValues.length; i++) {
+ com.sun.star.lang.Locale unoLocale = (com.sun.star.lang.Locale)
+ AnyConverter.toObject(UnoLocaleType, propertyValues[i]);
+ if (unoLocale != null) {
+ return new java.util.Locale(unoLocale.Language, unoLocale.Country);
+ }
+ }
+ }
+
+ return java.util.Locale.getDefault();
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return java.util.Locale.getDefault();
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return java.util.Locale.getDefault();
+ }
+ }
+
+
+ /** Returns the string after a given index
+ *
+ * The Java word iterator has a different understanding of what
+ * a word is than the word iterator used by OOo, so we use the
+ * Java iterators to ensure maximal compatibility with Java.
+ */
+ public String getAfterIndex(int part, int index) {
+ switch (part) {
+ case AccessibleText.CHARACTER:
+ try {
+ String s = unoObject.getText();
+ return s.substring(index+1, index+2);
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case AccessibleText.WORD:
+ try {
+ String s = unoObject.getText();
+ BreakIterator words = BreakIterator.getWordInstance(getLocale(index));
+ words.setText(s);
+ int start = words.following(index);
+ if (start == BreakIterator.DONE || start >= s.length()) {
+ return null;
+ }
+ int end = words.following(start);
+ if (end == BreakIterator.DONE || end >= s.length()) {
+ return null;
+ }
+ return s.substring(start, end);
+ } catch (IllegalArgumentException e) {
+ return null;
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case AccessibleText.SENTENCE:
+ try {
+ String s = unoObject.getText();
+ BreakIterator sentence =
+ BreakIterator.getSentenceInstance(getLocale(index));
+ sentence.setText(s);
+ int start = sentence.following(index);
+ if (start == BreakIterator.DONE || start >= s.length()) {
+ return null;
+ }
+ int end = sentence.following(start);
+ if (end == BreakIterator.DONE || end >= s.length()) {
+ return null;
+ }
+ return s.substring(start, end);
+ } catch (IllegalArgumentException e) {
+ return null;
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case 4:
+ try {
+ TextSegment ts = unoObject.getTextBehindIndex(index, AccessibleTextType.LINE);
+ return ts.SegmentText;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ // Workaround for #104847#
+ if (index > 0 && getCharCount() == index) {
+ return getAfterIndex(part, index - 1);
+ }
+ return null;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null;
+ }
+ case 5:
+ try {
+ TextSegment ts = unoObject.getTextBehindIndex(index, AccessibleTextType.ATTRIBUTE_RUN);
+ return ts.SegmentText;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null;
+ }
+ default:
+ return null;
+ }
+ }
+
+ /** Returns the zero-based offset of the caret */
+ public int getCaretPosition() {
+ try {
+ return unoObject.getCaretPosition();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the start offset within the selected text */
+ public int getSelectionStart() {
+ try {
+ int index = unoObject.getSelectionStart();
+
+ if (index == -1) {
+ index = getCaretPosition();
+ }
+
+ return index;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ protected void setAttribute(javax.swing.text.MutableAttributeSet as,
+ com.sun.star.beans.PropertyValue property) {
+ try {
+ // Map alignment attribute
+ if (property.Name.equals("ParaAdjust")) {
+ ParagraphAdjust adjust = null;
+
+ if (property.Value instanceof ParagraphAdjust) {
+ adjust = (ParagraphAdjust) property.Value;
+ } else if (property.Value instanceof Any) {
+ adjust = (ParagraphAdjust) AnyConverter.toObject(new Type(
+ ParagraphAdjust.class), property.Value);
+ } else {
+ adjust = ParagraphAdjust.fromInt(AnyConverter.toInt(
+ property.Value));
+ }
+
+ if (adjust != null) {
+ if (adjust.equals(ParagraphAdjust.LEFT)) {
+ StyleConstants.setAlignment(as,
+ StyleConstants.ALIGN_LEFT);
+ } else if (adjust.equals(ParagraphAdjust.RIGHT)) {
+ StyleConstants.setAlignment(as,
+ StyleConstants.ALIGN_RIGHT);
+ } else if (adjust.equals(ParagraphAdjust.CENTER)) {
+ StyleConstants.setAlignment(as,
+ StyleConstants.ALIGN_CENTER);
+ } else if (adjust.equals(ParagraphAdjust.BLOCK) ||
+ adjust.equals(ParagraphAdjust.STRETCH)) {
+ StyleConstants.setAlignment(as,
+ StyleConstants.ALIGN_JUSTIFIED);
+ }
+ } else if (Build.DEBUG) {
+ System.err.println(
+ "Invalid property value for key ParaAdjust: " +
+ property.Value.getClass().getName());
+ }
+
+ // Map background color
+ } else if (property.Name.equals("CharBackColor")) {
+ StyleConstants.setBackground(as,
+ new java.awt.Color(AnyConverter.toInt(property.Value)));
+
+ // FIXME: BidiLevel
+ // Set bold attribute
+ } else if (property.Name.equals("CharWeight")) {
+ boolean isBold = AnyConverter.toFloat(property.Value) > 125;
+ StyleConstants.setBold(as, isBold);
+
+ // FIXME: Java 1.4 ComponentAttribute, ComponentElementName, ComposedTextAttribute
+ // Set FirstLineIndent attribute
+ } else if (property.Name.equals("ParaFirstLineIndent")) {
+ StyleConstants.setFirstLineIndent(as,
+ (float) (toPointFactor * AnyConverter.toInt(property.Value)));
+
+ // Set font family attribute
+ } else if (property.Name.equals("CharFontPitch")) {
+ if (AnyConverter.toShort(property.Value) == 2) {
+ StyleConstants.setFontFamily(as, "Proportional");
+ }
+
+ // Set font size attribute
+ } else if (property.Name.equals("CharHeight")) {
+ StyleConstants.setFontSize(as,
+ (int) AnyConverter.toFloat(property.Value));
+
+ // Map foreground color
+ } else if (property.Name.equals("CharColor")) {
+ StyleConstants.setForeground(as,
+ new java.awt.Color(AnyConverter.toInt(property.Value)));
+
+ // FIXME: IconAttribute, IconElementName
+ // Set italic attribute
+ } else if (property.Name.equals("CharPosture")) {
+ FontSlant fs = null;
+
+ if (property.Value instanceof FontSlant) {
+ fs = (FontSlant) property.Value;
+ } else if (property.Value instanceof Any) {
+ fs = (FontSlant) AnyConverter.toObject(new Type(
+ FontSlant.class), property.Value);
+ }
+
+ if (fs != null) {
+ StyleConstants.setItalic(as, FontSlant.ITALIC.equals(fs));
+ }
+
+ // Set left indent attribute
+ } else if (property.Name.equals("ParaLeftMargin")) {
+ StyleConstants.setLeftIndent(as,
+ (float) (toPointFactor * AnyConverter.toInt(property.Value)));
+
+ // Set right indent attribute
+ } else if (property.Name.equals("ParaRightMargin")) {
+ StyleConstants.setRightIndent(as,
+ (float) (toPointFactor * AnyConverter.toInt(property.Value)));
+ }
+ // Set line spacing attribute
+ else if (property.Name.equals("ParaLineSpacing")) {
+ LineSpacing ls = null;
+
+ if (property.Value instanceof LineSpacing) {
+ ls = (LineSpacing) property.Value;
+ } else if (property.Value instanceof Any) {
+ ls = (LineSpacing) AnyConverter.toObject(new Type(
+ LineSpacing.class), property.Value);
+ }
+
+ if (ls != null) {
+ StyleConstants.setLineSpacing(as,
+ (float) (toPointFactor * ls.Height));
+ }
+ }
+ // FIXME: Java 1.4 NameAttribute, Orientation, ResolveAttribute
+ // Set space above attribute
+ else if (property.Name.equals("ParaTopMargin")) {
+ StyleConstants.setSpaceAbove(as,
+ (float) (toPointFactor * AnyConverter.toInt(property.Value)));
+ }
+ // Set space below attribute
+ else if (property.Name.equals("ParaBottomMargin")) {
+ StyleConstants.setSpaceBelow(as,
+ (float) (toPointFactor * AnyConverter.toInt(property.Value)));
+
+ // Set strike through attribute
+ } else if (property.Name.equals("CharStrikeout")) {
+ boolean isStrikeThrough = (FontStrikeout.NONE != AnyConverter.toShort(property.Value));
+ StyleConstants.setStrikeThrough(as, isStrikeThrough);
+
+ // Set sub-/superscript attribute
+ } else if (property.Name.equals("CharEscapement")) {
+ short value = AnyConverter.toShort(property.Value);
+
+ if (value > 0) {
+ StyleConstants.setSuperscript(as, true);
+ } else if (value < 0) {
+ StyleConstants.setSubscript(as, true);
+ }
+
+ // Set tabset attribute
+ } else if (property.Name.equals("ParaTabStops")) {
+ TabStop[] unoTabStops = (TabStop[]) AnyConverter.toArray(property.Value);
+ javax.swing.text.TabStop[] tabStops = new javax.swing.text.TabStop[unoTabStops.length];
+
+ for (int index2 = 0; index2 < unoTabStops.length; index2++) {
+ float pos = (float) (toPointFactor * unoTabStops[index2].Position);
+
+ if (unoTabStops[index2].Alignment.equals(TabAlign.LEFT)) {
+ tabStops[index2] = new javax.swing.text.TabStop(pos,
+ javax.swing.text.TabStop.ALIGN_LEFT,
+ javax.swing.text.TabStop.LEAD_NONE);
+ } else if (unoTabStops[index2].Alignment.equals(
+ TabAlign.CENTER)) {
+ tabStops[index2] = new javax.swing.text.TabStop(pos,
+ javax.swing.text.TabStop.ALIGN_CENTER,
+ javax.swing.text.TabStop.LEAD_NONE);
+ } else if (unoTabStops[index2].Alignment.equals(
+ TabAlign.RIGHT)) {
+ tabStops[index2] = new javax.swing.text.TabStop(pos,
+ javax.swing.text.TabStop.ALIGN_RIGHT,
+ javax.swing.text.TabStop.LEAD_NONE);
+ } else if (unoTabStops[index2].Alignment.equals(
+ TabAlign.DECIMAL)) {
+ tabStops[index2] = new javax.swing.text.TabStop(pos,
+ javax.swing.text.TabStop.ALIGN_DECIMAL,
+ javax.swing.text.TabStop.LEAD_NONE);
+ } else {
+ tabStops[index2] = new javax.swing.text.TabStop(pos);
+ }
+ }
+
+ // Re-use tabSet object if possible to make AttributeSet.equals work
+ if ((this.tabSet == null) ||
+ !java.util.Arrays.equals(tabStops, this.tabStops)) {
+ this.tabStops = tabStops;
+ this.tabSet = new javax.swing.text.TabSet(tabStops);
+ }
+
+ StyleConstants.setTabSet(as, this.tabSet);
+
+ // Set underline attribute
+ } else if (property.Name.equals("CharUnderline")) {
+ boolean isUnderline = (FontUnderline.NONE != AnyConverter.toShort(property.Value));
+ StyleConstants.setUnderline(as, isUnderline);
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ if (Build.DEBUG) {
+ System.err.println("*** ERROR *** " + e.getClass().getName() +
+ " caught for property " + property.Name + ": " +
+ e.getMessage());
+ System.err.println(" value is of type " +
+ property.Value.getClass().getName());
+ }
+ }
+ }
+
+ /** Returns the AttributSet for a given character at a given index */
+ public javax.swing.text.AttributeSet getCharacterAttribute(int index) {
+ try {
+ com.sun.star.beans.PropertyValue[] propertyValues = unoObject.getCharacterAttributes(index,
+ attributeList);
+ javax.swing.text.SimpleAttributeSet attributeSet = new javax.swing.text.SimpleAttributeSet();
+
+ if (null != propertyValues) {
+ for (int i = 0; i < propertyValues.length; i++) {
+ setAttribute(attributeSet, propertyValues[i]);
+ }
+ }
+
+ return attributeSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ if ((index > 0) && (getCharCount() == index)) {
+ return getCharacterAttribute(index - 1);
+ }
+ return null;
+ }
+ }
+
+ /** Given a point in local coordinates, return the zero-based index of the character under that point */
+ public int getIndexAtPoint(java.awt.Point point) {
+ try {
+ return unoObject.getIndexAtPoint(new Point(point.x, point.y));
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the end offset within the selected text */
+ public int getSelectionEnd() {
+ try {
+ int index = unoObject.getSelectionEnd();
+
+ if (index == -1) {
+ index = getCaretPosition();
+ }
+
+ return index;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the string before a given index
+ *
+ * The Java word iterator has a different understanding of what
+ * a word is than the word iterator used by OOo, so we use the
+ * Java iterators to ensure maximal compatibility with Java.
+ */
+ public java.lang.String getBeforeIndex(int part, int index) {
+ switch (part) {
+ case AccessibleText.CHARACTER:
+ try {
+ String s = unoObject.getText();
+ return s.substring(index-1, index);
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case AccessibleText.WORD:
+ try {
+ String s = unoObject.getText();
+ BreakIterator words = BreakIterator.getWordInstance(getLocale(index));
+ words.setText(s);
+ int end = words.following(index);
+ end = words.previous();
+ int start = words.previous();
+ if (start == BreakIterator.DONE) {
+ return null;
+ }
+ return s.substring(start, end);
+ } catch (IllegalArgumentException e) {
+ return null;
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case AccessibleText.SENTENCE:
+ try {
+ String s = unoObject.getText();
+ BreakIterator sentence =
+ BreakIterator.getSentenceInstance(getLocale(index));
+ sentence.setText(s);
+ int end = sentence.following(index);
+ end = sentence.previous();
+ int start = sentence.previous();
+ if (start == BreakIterator.DONE) {
+ return null;
+ }
+ return s.substring(start, end);
+ } catch (IllegalArgumentException e) {
+ return null;
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case 4:
+ try {
+ TextSegment ts = unoObject.getTextBeforeIndex(index, AccessibleTextType.LINE);
+ return ts.SegmentText;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ // Workaround for #104847#
+ if (index > 0 && getCharCount() == index) {
+ return getBeforeIndex(part, index - 1);
+ }
+ return null;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null;
+ }
+ case 5:
+ try {
+ TextSegment ts = unoObject.getTextBeforeIndex(index, AccessibleTextType.ATTRIBUTE_RUN);
+ return ts.SegmentText;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null;
+ }
+ default:
+ return null;
+ }
+ }
+
+
+ /** Returns the string at a given index
+ *
+ * The Java word iterator has a different understanding of what
+ * a word is than the word iterator used by OOo, so we use the
+ * Java iterators to ensure maximal compatibility with Java.
+ */
+ public java.lang.String getAtIndex(int part, int index) {
+ switch (part) {
+ case AccessibleText.CHARACTER:
+ try {
+ String s = unoObject.getText();
+ return s.substring(index, index + 1);
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case AccessibleText.WORD:
+ try {
+ String s = unoObject.getText();
+ BreakIterator words = BreakIterator.getWordInstance(getLocale(index));
+ words.setText(s);
+ int end = words.following(index);
+ return s.substring(words.previous(), end);
+ } catch (IllegalArgumentException e) {
+ return null;
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case AccessibleText.SENTENCE:
+ try {
+ String s = unoObject.getText();
+ BreakIterator sentence =
+ BreakIterator.getSentenceInstance(getLocale(index));
+ sentence.setText(s);
+ int end = sentence.following(index);
+ return s.substring(sentence.previous(), end);
+ } catch (IllegalArgumentException e) {
+ return null;
+ } catch (IndexOutOfBoundsException e) {
+ return null;
+ }
+ case 4:
+ try {
+ TextSegment ts = unoObject.getTextAtIndex(index, AccessibleTextType.LINE);
+ return ts.SegmentText;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ // Workaround for #104847#
+ if (index > 0 && getCharCount() == index) {
+ return getAtIndex(part, index - 1);
+ }
+ return null;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null;
+ }
+ case 5:
+ try {
+ TextSegment ts = unoObject.getTextAtIndex(index, AccessibleTextType.ATTRIBUTE_RUN);
+ return ts.SegmentText;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ return null;
+ }
+
+ default:
+ return null;
+ }
+ }
+
+ /** Returns the number of characters (valid indicies) */
+ public int getCharCount() {
+ try {
+ return unoObject.getCharacterCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+
+ return 0;
+ }
+
+ /** Returns the portion of the text that is selected */
+ public java.lang.String getSelectedText() {
+ try {
+ return unoObject.getSelectedText();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+
+ return null;
+ }
+
+ /** Determines the bounding box of the character at the given index into the string */
+ public java.awt.Rectangle getCharacterBounds(int index) {
+ try {
+ Rectangle unoRect = unoObject.getCharacterBounds(index);
+ return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ if ((index > 0) && (getCharCount() == index)) {
+ return getCharacterBounds(index - 1);
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+
+ return new java.awt.Rectangle();
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java
new file mode 100644
index 000000000000..cabbf3f5d323
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/AccessibleValueImpl.java
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.XAccessibleValue;
+import com.sun.star.uno.AnyConverter;
+
+/** The AccessibleValueImpl mappes the calls to the java AccessibleValue
+ * interface to the corresponding methods of the UNO XAccessibleValue interface
+ */
+public class AccessibleValueImpl implements javax.accessibility.AccessibleValue {
+ protected XAccessibleValue unoObject;
+
+ /** Creates new AccessibleValueImpl */
+ public AccessibleValueImpl(XAccessibleValue xAccessibleValue) {
+ unoObject = xAccessibleValue;
+ }
+
+ public static java.lang.Number toNumber(java.lang.Object any) {
+ try {
+ if(AnyConverter.isByte(any)) {
+ return new Byte(AnyConverter.toByte(any));
+ } else if (AnyConverter.isShort(any)) {
+ return new Short(AnyConverter.toShort(any));
+ } else if (AnyConverter.isInt(any)) {
+ return new Integer(AnyConverter.toInt(any));
+ } else if (AnyConverter.isLong(any)) {
+ return new Long(AnyConverter.toLong(any));
+ } else if (AnyConverter.isFloat(any)) {
+ return new Float(AnyConverter.toFloat(any));
+ } else if (AnyConverter.isDouble(any)) {
+ return new Double(AnyConverter.toDouble(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+
+ return null;
+ }
+
+ public java.lang.Number getMinimumAccessibleValue() {
+ try {
+ return toNumber(unoObject.getMinimumValue());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public java.lang.Number getCurrentAccessibleValue() {
+ try {
+ return toNumber(unoObject.getCurrentValue());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public java.lang.Number getMaximumAccessibleValue() {
+ try {
+ return toNumber(unoObject.getMaximumValue());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public boolean setCurrentAccessibleValue(java.lang.Number number) {
+ try {
+ return unoObject.setCurrentValue(number);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Alert.java b/accessibility/bridge/org/openoffice/java/accessibility/Alert.java
new file mode 100644
index 000000000000..e853fabecba0
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Alert.java
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleRole;
+import com.sun.star.accessibility.*;
+
+public class Alert extends Dialog {
+
+ protected Alert(java.awt.Frame owner, XAccessibleComponent xAccessibleComponent) {
+ super(owner, xAccessibleComponent);
+ }
+
+ protected Alert(java.awt.Frame owner, String name, XAccessibleComponent xAccessibleComponent) {
+ super(owner, name, xAccessibleComponent);
+ }
+
+ protected Alert(java.awt.Frame owner, String name, boolean modal, XAccessibleComponent xAccessibleComponent) {
+ super(owner, name, modal, xAccessibleComponent);
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ accessibleContext = new AccessibleAlert();
+ accessibleContext.setAccessibleName(getTitle());
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleAlert extends AccessibleDialog {
+
+ protected AccessibleAlert() {
+ super();
+ }
+
+ public AccessibleRole getAccessibleRole() {
+ return AccessibleRole.ALERT;
+ }
+ };
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Application.java b/accessibility/bridge/org/openoffice/java/accessibility/Application.java
new file mode 100644
index 000000000000..c67da714f4df
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Application.java
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+
+public class Application extends java.awt.Frame implements Accessible {
+
+ protected AccessibleContext accessibleContext = null;
+
+ protected Application() {
+ super();
+ }
+
+ public boolean isShowing() {
+ return true;
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Button.java b/accessibility/bridge/org/openoffice/java/accessibility/Button.java
new file mode 100644
index 000000000000..44bccc30ffc1
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Button.java
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+class Button extends AbstractButton implements javax.accessibility.Accessible {
+
+ public Button(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleButtonListener();
+ }
+
+ protected class AccessibleButtonListener
+ extends AccessibleUNOComponentListener {
+ protected AccessibleButtonListener() {
+ super();
+ }
+
+ protected javax.accessibility.AccessibleContext getContext( Object any ) {
+ try {
+ XAccessible xAccessible = (XAccessible)
+ AnyConverter.toObject( AccessibleObjectFactory.XAccessibleType, any );
+
+ javax.accessibility.Accessible accessible =
+ (javax.accessibility.Accessible) Button.this.getComponent( xAccessible );
+
+ return accessible.getAccessibleContext();
+ } catch( com.sun.star.uno.Exception e ) {
+ return null;
+ }
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.CHILD:
+ java.awt.Component c = getComponent(unoAccessible);
+
+ Object values[] = { null, null };
+
+ if (AnyConverter.isObject(event.OldValue)) {
+ values[0] = getContext( event.OldValue );
+ }
+
+ if (AnyConverter.isObject(event.NewValue)) {
+ values[1] = getContext( event.NewValue);
+ }
+
+ firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ values[0], values[1]);
+ break;
+
+ default:
+ super.notifyEvent(event);
+ }
+ }
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleButton();
+ }
+
+ protected java.awt.Component getComponent(XAccessible unoAccessible) {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(unoAccessible);
+
+ if (c == null) {
+ c = AccessibleObjectFactory.createAccessibleComponent(unoAccessible);
+
+ if (c instanceof javax.accessibility.Accessible) {
+ ((javax.accessibility.Accessible) c).getAccessibleContext()
+ .setAccessibleParent(this);
+ }
+
+ if( c instanceof java.awt.Container ) {
+ AccessibleObjectFactory.populateContainer((java.awt.Container) c, unoAccessible.getAccessibleContext() );
+ }
+ }
+
+ return c;
+ }
+
+ protected class AccessibleButton extends AccessibleAbstractButton {
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.PUSH_BUTTON;
+ }
+
+ /** Returns the number of accessible children of the object */
+ public int getAccessibleChildrenCount() {
+ try {
+ return unoAccessibleContext.getAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the specified Accessible child of the object */
+ public synchronized javax.accessibility.Accessible getAccessibleChild( int i) {
+ try {
+ return (javax.accessibility.Accessible) getComponent( unoAccessibleContext.getAccessibleChild(i) );
+ } catch (com.sun.star.uno.RuntimeException e) {
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ }
+ return null;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ try {
+ java.awt.Component c = getComponent(unoAccessibleComponent.getAccessibleAtPoint(
+ new com.sun.star.awt.Point(p.x, p.y)));
+
+ return (javax.accessibility.Accessible) c;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java b/accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java
new file mode 100644
index 000000000000..624dfd048c89
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/CheckBox.java
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+class CheckBox extends ToggleButton {
+
+ public CheckBox(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleCheckBox();
+ }
+
+ protected class AccessibleCheckBox extends AccessibleToggleButton {
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.CHECK_BOX;
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java b/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java
new file mode 100644
index 000000000000..5f5cf4a34374
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/ComboBox.java
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
+import javax.swing.SwingConstants;
+
+
+/**
+ */
+public class ComboBox extends Container {
+ private XAccessibleAction unoAccessibleAction = null;
+
+ public ComboBox(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(javax.accessibility.AccessibleRole.COMBO_BOX, xAccessible,
+ xAccessibleContext);
+ }
+
+ /** Appends the specified component to the end of this container */
+ public java.awt.Component add(java.awt.Component c) {
+ // List should be always the first child
+ if (c instanceof List) {
+ return super.add(c, 0);
+ } else {
+ return super.add(c);
+ }
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleComboBox();
+ }
+
+ protected class AccessibleComboBox extends AccessibleContainer
+ implements javax.accessibility.AccessibleAction {
+ /**
+ * Though the class is abstract, this should be called by all sub-classes
+ */
+ protected AccessibleComboBox() {
+ super();
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the AccessibleAction associated with this object that supports one or more actions */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ if (unoAccessibleAction == null) {
+ unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface(XAccessibleAction.class,
+ unoAccessibleContext);
+
+ if (unoAccessibleAction == null) {
+ return null;
+ }
+ }
+
+ return this;
+ }
+
+ /*
+ * AccessibleAction
+ */
+
+ /** Performs the specified Action on the object */
+ public boolean doAccessibleAction(int param) {
+ if (param == 0) {
+ try {
+ return unoAccessibleAction.doAccessibleAction(0);
+ } catch (com.sun.star.uno.Exception e) {
+ }
+ }
+
+ return false;
+ }
+
+ /** Returns a description of the specified action of the object */
+ public java.lang.String getAccessibleActionDescription(int param) {
+ return javax.swing.UIManager.getString("ComboBox.togglePopupText");
+ }
+
+ /** Returns the number of accessible actions available in this object */
+ public int getAccessibleActionCount() {
+ return 1;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Component.java b/accessibility/bridge/org/openoffice/java/accessibility/Component.java
new file mode 100644
index 000000000000..21043e1f5098
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Component.java
@@ -0,0 +1,740 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleState;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+public abstract class Component extends java.awt.Component {
+ public static final Type RectangleType = new Type(com.sun.star.awt.Rectangle.class);
+ public static final Type SelectionType = new Type(com.sun.star.awt.Selection.class);
+
+ protected XAccessible unoAccessible;
+ protected XAccessibleContext unoAccessibleContext;
+ protected XAccessibleComponent unoAccessibleComponent;
+
+ protected boolean disposed = false;
+
+ protected Component(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super();
+ unoAccessible = xAccessible;
+ unoAccessibleContext = xAccessibleContext;
+ unoAccessibleComponent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class, xAccessibleContext);
+ // Add the event listener right away, because the global focus notification doesn't
+ // work yet ..
+ XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
+ UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
+ unoAccessibleComponent);
+ if (broadcaster != null) {
+ broadcaster.addEventListener(createEventListener());
+ }
+ }
+
+ /**
+ * Determines whether this <code>Component</code> is showing on screen.
+ * This means that the component must be visible, and it must be in a
+ * <code>container</code> that is visible and showing.
+ * @see #addNotify
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public boolean isShowing() {
+ if (isVisible()) {
+ java.awt.Container parent = getParent();
+ return (parent == null) || parent.isShowing();
+ }
+ return false;
+ }
+
+ /**
+ * Makes this <code>Component</code> displayable by connecting it to a
+ * native screen resource.
+ * This method is called internally by the toolkit and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public void addNotify() {
+ }
+
+ /**
+ * Makes this <code>Component</code> undisplayable by destroying it native
+ * screen resource.
+ * This method is called by the toolkit internally and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #addNotify
+ * @since JDK1.0
+ */
+ public void removeNotify() {
+ }
+
+ /*
+ * Fake the java focus handling. This is necessary to keep OOo focus
+ * in sync with the java focus. See java.awt.DefaultKeyboardFocusManager
+ * for implementation details.
+ **/
+
+ /** Requests focus for this object */
+ public void requestFocus() {
+ }
+
+ /** Requests focus for this object */
+ public boolean requestFocus(boolean temporary) {
+ // Must be a no-op to make focus handling work
+ return true;
+ }
+
+ /** Requests the focus for this object in the containing window */
+ public boolean requestFocusInWindow() {
+ return requestFocusInWindow(false);
+ }
+
+ /** Requests the focus for this object in the containing window */
+ protected boolean requestFocusInWindow(boolean temporary) {
+ if (isFocusable() && isVisible()) {
+ getEventQueue().postEvent(new java.awt.event.FocusEvent(this, java.awt.event.FocusEvent.FOCUS_GAINED, temporary));
+ return true;
+ }
+ return false;
+ }
+
+ public Object[] getAccessibleComponents(Object[] targetSet) {
+ try {
+ java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
+ for (int i=0; i < targetSet.length; i++) {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
+ (XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i]));
+ if (c != null) {
+ list.add(c);
+ }
+ }
+ list.trimToSize();
+ return list.toArray();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ protected java.awt.EventQueue getEventQueue() {
+ return java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
+ }
+
+ protected class PropertyChangeBroadcaster implements Runnable {
+ String propertyName;
+ Object oldValue;
+ Object newValue;
+
+ public PropertyChangeBroadcaster(String name, Object param1, Object param2) {
+ propertyName = name;
+ oldValue = param1;
+ newValue = param2;
+ }
+
+ public void run() {
+ // Because this code is executed in the DispatchThread, it is better to catch every
+ // exception that might occur
+ try {
+ AccessibleContext ac = accessibleContext;
+ if (ac != null) {
+ ac.firePropertyChange(propertyName, oldValue, newValue);
+ }
+ } catch (java.lang.Exception e) {
+ if (Build.DEBUG) {
+ System.err.println(e.getClass().getName() + " caught propagating " + propertyName + " event: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ protected void firePropertyChange(String property, Object oldValue, Object newValue) {
+ getEventQueue().invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue));
+ }
+
+ protected void fireStatePropertyChange(AccessibleState state, boolean set) {
+ PropertyChangeBroadcaster broadcaster;
+
+// if (Build.DEBUG) {
+// System.err.println("[" + AccessibleRoleAdapter.getAccessibleRole(unoAccessibleContext.getAccessibleRole()) + "] " +
+// unoAccessibleContext.getAccessibleName() + " is " + (set ? "now " : "no longer ") + state);
+// }
+
+ if (set) {
+ broadcaster = new PropertyChangeBroadcaster(
+ accessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, state);
+ } else {
+ broadcaster = new PropertyChangeBroadcaster(
+ accessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ state, null);
+ }
+ getEventQueue().invokeLater(broadcaster);
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleUNOComponentListener implements XAccessibleEventListener {
+
+ protected AccessibleUNOComponentListener() {
+ }
+
+ protected void setComponentState(short state, boolean enable) {
+ switch (state) {
+ case AccessibleStateType.ACTIVE:
+ // Only frames should be active
+ break;
+ case AccessibleStateType.ARMED:
+ fireStatePropertyChange(AccessibleState.ARMED, enable);
+ break;
+ case AccessibleStateType.CHECKED:
+ fireStatePropertyChange(AccessibleState.CHECKED, enable);
+ break;
+ case AccessibleStateType.ENABLED:
+ setEnabled(enable);
+ // Since we can't access awt.Componet.accessibleContext, we need to fire
+ // this event manually ..
+ fireStatePropertyChange(AccessibleState.ENABLED, enable);
+ break;
+ case AccessibleStateType.FOCUSED:
+ getEventQueue().postEvent(new java.awt.event.FocusEvent(
+ Component.this, enable ?
+ java.awt.event.FocusEvent.FOCUS_GAINED :
+ java.awt.event.FocusEvent.FOCUS_LOST));
+ break;
+ case AccessibleStateType.PRESSED:
+ fireStatePropertyChange(AccessibleState.PRESSED, enable);
+ break;
+ case AccessibleStateType.SELECTED:
+ fireStatePropertyChange(AccessibleState.SELECTED, enable);
+ break;
+ case AccessibleStateType.SENSITIVE:
+ // This state equals ENABLED in OOo (but not in Gtk+) and does not exist in Java 1.5
+ break;
+ case AccessibleStateType.SHOWING:
+// fireStatePropertyChange(AccessibleState.SHOWING, enable);
+ break;
+ case AccessibleStateType.VISIBLE:
+ Component.this.setVisible(enable);
+ break;
+ default:
+ if (Build.DEBUG) {
+ System.err.println("[component]: " + getName() + "unexpected state change " + state);
+ }
+ break;
+ }
+ }
+
+ /** Updates the accessible name and fires the appropriate PropertyChangedEvent */
+ protected void handleNameChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ if (accessibleContext != null) {
+ accessibleContext.setAccessibleName(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the accessible description and fires the appropriate PropertyChangedEvent */
+ protected void handleDescriptionChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ if (accessibleContext != null) {
+ accessibleContext.setAccessibleDescription(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the internal states and fires the appropriate PropertyChangedEvent */
+ protected void handleStateChangedEvent(Object any1, Object any2) {
+ try {
+ if (AnyConverter.isShort(any1)) {
+ setComponentState(AnyConverter.toShort(any1), false);
+ }
+
+ if (AnyConverter.isShort(any2)) {
+ setComponentState(AnyConverter.toShort(any2), true);
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+
+ if ( !disposed ) {
+
+ switch (event.EventId) {
+ case AccessibleEventId.ACTION_CHANGED:
+ firePropertyChange(accessibleContext.ACCESSIBLE_ACTION_PROPERTY,
+ toNumber(event.OldValue), toNumber(event.NewValue));
+ break;
+ case AccessibleEventId.NAME_CHANGED:
+ // Set the accessible name for the corresponding context, which will fire a property
+ // change event itself
+ handleNameChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.DESCRIPTION_CHANGED:
+ // Set the accessible description for the corresponding context, which will fire a property
+ // change event itself - so do not set propertyName !
+ handleDescriptionChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ if (Build.DEBUG) {
+ System.out.println("Unexpected child event for object of role " + getAccessibleContext().getAccessibleRole());
+ }
+ break;
+ case AccessibleEventId.STATE_CHANGED:
+ // Update the internal state set and fire the appropriate PropertyChangedEvent
+ handleStateChangedEvent(event.OldValue, event.NewValue);
+ break;
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
+ break;
+ case AccessibleEventId.TEXT_CHANGED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY,
+ AccessibleTextImpl.convertTextSegment(event.OldValue),
+ AccessibleTextImpl.convertTextSegment(event.NewValue));
+ break;
+ /*
+ * the Java AccessBridge for GNOME maps SELECTION_PROPERTY change events
+ * for objects of role TEXT to object:text-selection-changed
+ */
+ case AccessibleEventId.TEXT_SELECTION_CHANGED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, null);
+ break;
+ case AccessibleEventId.CARET_CHANGED:
+ firePropertyChange(accessibleContext.ACCESSIBLE_CARET_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue));
+ break;
+ case AccessibleEventId.VALUE_CHANGED:
+ firePropertyChange(accessibleContext.ACCESSIBLE_VALUE_PROPERTY, toNumber(event.OldValue), toNumber(event.NewValue));
+ default:
+ // Warn about unhandled events
+ if(Build.DEBUG) {
+ System.out.println(this + ": unhandled accessibility event id=" + event.EventId);
+ }
+ }
+ }
+ }
+
+ /** Called by OpenOffice process to notify that the UNO component is disposing */
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ disposed = true;
+ AccessibleObjectFactory.disposing(Component.this);
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleUNOComponentListener();
+ }
+
+ protected javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** This method actually creates the AccessibleContext object returned by
+ * getAccessibleContext().
+ */
+ protected javax.accessibility.AccessibleContext createAccessibleContext() {
+ return null;
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public final javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ try {
+ AccessibleContext ac = createAccessibleContext();
+ if (ac != null) {
+ // Set accessible name and description here to avoid
+ // unnecessary property change events later ..
+ ac.setAccessibleName(unoAccessibleContext.getAccessibleName());
+ ac.setAccessibleDescription(unoAccessibleContext.getAccessibleDescription());
+ accessibleContext = ac;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ return accessibleContext;
+ }
+
+ protected abstract class AccessibleUNOComponent extends java.awt.Component.AccessibleAWTComponent
+ implements javax.accessibility.AccessibleExtendedComponent {
+
+ protected java.awt.event.ComponentListener accessibleComponentHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when shown/hidden..
+ */
+ protected class AccessibleComponentHandler implements java.awt.event.ComponentListener {
+ public void componentHidden(java.awt.event.ComponentEvent e) {
+ AccessibleUNOComponent.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ AccessibleState.VISIBLE, null);
+ }
+
+ public void componentShown(java.awt.event.ComponentEvent e) {
+ AccessibleUNOComponent.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, AccessibleState.VISIBLE);
+ }
+
+ public void componentMoved(java.awt.event.ComponentEvent e) {
+ }
+
+ public void componentResized(java.awt.event.ComponentEvent e) {
+ }
+ } // inner class AccessibleComponentHandler
+
+ protected java.awt.event.FocusListener accessibleFocusHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when focus events happen
+ */
+ protected class AccessibleFocusHandler implements java.awt.event.FocusListener {
+ public void focusGained(java.awt.event.FocusEvent event) {
+ AccessibleUNOComponent.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, AccessibleState.FOCUSED);
+ if (Build.DEBUG) {
+ System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is now focused");
+ }
+ }
+ public void focusLost(java.awt.event.FocusEvent event) {
+ AccessibleUNOComponent.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ AccessibleState.FOCUSED, null);
+ if (Build.DEBUG) {
+ System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is no longer focused");
+ }
+ }
+ } // inner class AccessibleFocusHandler
+
+ protected int propertyChangeListenerCount = 0;
+
+ /**
+ * Add a PropertyChangeListener to the listener list.
+ *
+ * @param listener The PropertyChangeListener to be added
+ */
+ public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (propertyChangeListenerCount++ == 0) {
+ accessibleComponentHandler = new AccessibleComponentHandler();
+ Component.this.addComponentListener(accessibleComponentHandler);
+
+ accessibleFocusHandler = new AccessibleFocusHandler();
+ Component.this.addFocusListener(accessibleFocusHandler);
+ }
+ super.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Remove a PropertyChangeListener from the listener list.
+ * This removes a PropertyChangeListener that was registered
+ * for all properties.
+ *
+ * @param listener The PropertyChangeListener to be removed
+ */
+ public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (--propertyChangeListenerCount == 0) {
+ Component.this.removeComponentListener(accessibleComponentHandler);
+ accessibleComponentHandler = null;
+
+ Component.this.removeFocusListener(accessibleFocusHandler);
+ accessibleFocusHandler = null;
+ }
+ super.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Gets the current state set of this object.
+ *
+ * @return an instance of <code>AccessibleStateSet</code>
+ * containing the current state set of the object
+ * @see AccessibleState
+ */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ if (disposed)
+ return AccessibleStateAdapter.getDefunctStateSet();
+
+ try {
+ return AccessibleStateAdapter.getAccessibleStateSet(Component.this,
+ unoAccessibleContext.getAccessibleStateSet());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return AccessibleStateAdapter.getDefunctStateSet();
+ }
+ }
+
+ /** Gets the locale of the component */
+ public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException {
+ try {
+ com.sun.star.lang.Locale unoLocale = unoAccessible.getAccessibleContext().getLocale();
+ return new java.util.Locale(unoLocale.Language, unoLocale.Country);
+ } catch (IllegalAccessibleComponentStateException e) {
+ throw new java.awt.IllegalComponentStateException(e.getMessage());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return java.util.Locale.getDefault();
+ }
+ }
+
+ /*
+ * AccessibleExtendedComponent
+ */
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getBackground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getForeground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setForeground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Cursor getCursor() {
+ // Not supported by UNO accessibility API
+ return null;
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Font getFont() {
+ // FIXME
+ return null;
+ }
+
+ public void setFont(java.awt.Font f) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ // FIXME
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return Component.this.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isVisible() {
+ return Component.this.isVisible();
+ }
+
+ public void setVisible(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isShowing() {
+ return Component.this.isShowing();
+ }
+
+ public boolean contains(java.awt.Point p) {
+ try {
+ return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y));
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen();
+// if (Build.DEBUG) {
+// System.err.println("Returning location on screen( " + unoPoint.X + ", " + unoPoint.Y + " )" );
+// }
+ return new java.awt.Point(unoPoint.X, unoPoint.Y);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the location of this component in the form of a point specifying the component's top-left corner */
+ public java.awt.Point getLocation() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation();
+ return new java.awt.Point( unoPoint.X, unoPoint.Y );
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ try {
+ com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds();
+ return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ try {
+ com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize();
+ return new java.awt.Dimension(unoSize.Width, unoSize.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ // Not supported by this implementation
+ return null;
+ }
+
+ public boolean isFocusTraversable() {
+ return Component.this.isFocusable();
+ }
+
+ public void requestFocus() {
+ unoAccessibleComponent.grabFocus();
+ }
+
+ public String getToolTipText() {
+ try {
+ XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent)
+ UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent);
+ if (unoAccessibleExtendedComponent != null) {
+ return unoAccessibleExtendedComponent.getToolTipText();
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ return null;
+ }
+
+ public String getTitledBorderText() {
+ try {
+ XAccessibleExtendedComponent unoAccessibleExtendedComponent = (XAccessibleExtendedComponent)
+ UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, unoAccessibleComponent);
+ if (unoAccessibleExtendedComponent != null) {
+ return unoAccessibleExtendedComponent.getTitledBorderText();
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ return null;
+ }
+
+ public javax.accessibility.AccessibleKeyBinding getAccessibleKeyBinding() {
+ try {
+ XAccessibleAction unoAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
+ if (unoAccessibleAction != null) {
+ XAccessibleKeyBinding unoAccessibleKeyBinding = unoAccessibleAction.getAccessibleActionKeyBinding(0);
+ if (unoAccessibleKeyBinding != null) {
+ return new AccessibleKeyBinding(unoAccessibleKeyBinding);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ return null;
+ }
+ }
+
+ // Extract a number from a UNO any
+ public static java.lang.Number toNumber(java.lang.Object any) {
+ try {
+ if (AnyConverter.isByte(any)) {
+ return new Byte(AnyConverter.toByte(any));
+ } else if (AnyConverter.isShort(any)) {
+ return new Short(AnyConverter.toShort(any));
+ } else if (AnyConverter.isInt(any)) {
+ return new Integer(AnyConverter.toInt(any));
+ } else if (AnyConverter.isLong(any)) {
+ return new Long(AnyConverter.toLong(any));
+ } else if (AnyConverter.isFloat(any)) {
+ return new Float(AnyConverter.toFloat(any));
+ } else if (AnyConverter.isDouble(any)) {
+ return new Double(AnyConverter.toDouble(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ throw new IllegalArgumentException(e.getMessage());
+ }
+ return null;
+ }
+
+ public String toString() {
+ return UnoRuntime.generateOid(unoAccessible);
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Container.java b/accessibility/bridge/org/openoffice/java/accessibility/Container.java
new file mode 100644
index 000000000000..257cdab8b757
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Container.java
@@ -0,0 +1,763 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleState;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+public class Container extends java.awt.Container implements javax.accessibility.Accessible {
+
+ protected XAccessible unoAccessible;
+ protected XAccessibleContext unoAccessibleContext;
+ protected XAccessibleComponent unoAccessibleComponent = null;
+
+ protected javax.accessibility.AccessibleRole accessibleRole;
+ protected javax.accessibility.AccessibleText accessibleText;
+ protected boolean disposed = false;
+
+ protected Container(javax.accessibility.AccessibleRole role,
+ XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ accessibleRole = role;
+ unoAccessible = xAccessible;
+ unoAccessibleContext = xAccessibleContext;
+ unoAccessibleComponent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class,
+ xAccessibleContext);
+
+ // Add the event listener right away, because the global focus notification doesn't
+ // work yet ..
+ XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
+ UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
+ unoAccessibleContext);
+ if (broadcaster != null) {
+ broadcaster.addEventListener(createEventListener());
+ }
+ }
+
+ /**
+ * Determines whether this <code>Container</code> is showing on screen.
+ * This means that the component must be visible, and it must be in a
+ * <code>container</code> that is visible and showing.
+ * @see #addNotify
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public boolean isShowing() {
+ if (isVisible()) {
+ java.awt.Container parent = getParent();
+ return (parent == null) || parent.isShowing();
+ }
+ return false;
+ }
+
+ /**
+ * Makes this <code>Container</code> displayable by connecting it to a
+ * native screen resource.
+ * This method is called internally by the toolkit and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public void addNotify() {
+ }
+
+ /**
+ * Makes this <code>Container</code> undisplayable by destroying it native
+ * screen resource.
+ * This method is called by the toolkit internally and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #addNotify
+ * @since JDK1.0
+ */
+ public void removeNotify() {
+ }
+
+ /*
+ * Fake the java focus handling. This is necessary to keep OOo focus
+ * in sync with the java focus. See java.awt.DefaultKeyboardFocusManager
+ * for implementation details.
+ **/
+
+ /** Requests focus for this object */
+ public void requestFocus() {
+ }
+
+ /** Requests focus for this object */
+ public boolean requestFocus(boolean temporary) {
+ // Must be a no-op to make focus handling work
+ return true;
+ }
+
+ /** Requests the focus for this object in the containing window */
+ public boolean requestFocusInWindow() {
+ return requestFocusInWindow(false);
+ }
+
+ /** Requests the focus for this object in the containing window */
+ protected boolean requestFocusInWindow(boolean temporary) {
+ if (isFocusable() && isVisible()) {
+ getEventQueue().postEvent(new java.awt.event.FocusEvent(this, java.awt.event.FocusEvent.FOCUS_GAINED, temporary));
+ return true;
+ }
+ return false;
+ }
+
+ public Object[] getAccessibleComponents(Object[] targetSet) {
+ try {
+ java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
+ for (int i=0; i < targetSet.length; i++) {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
+ (XAccessible) UnoRuntime.queryInterface(XAccessible.class, targetSet[i]));
+ if (c != null) {
+ list.add(c);
+ }
+ }
+ list.trimToSize();
+ return list.toArray();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ protected java.awt.EventQueue getEventQueue() {
+ return java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
+ }
+
+ protected class PropertyChangeBroadcaster implements Runnable {
+ String propertyName;
+ Object oldValue;
+ Object newValue;
+
+ public PropertyChangeBroadcaster(String name, Object param1, Object param2) {
+ propertyName = name;
+ oldValue = param1;
+ newValue = param2;
+ }
+
+ public void run() {
+ // Because this code is executed in the DispatchThread, it is better tocatch every
+ // exception that might occur
+ try {
+ AccessibleContext ac = Container.this.accessibleContext;
+ if (ac != null) {
+ ac.firePropertyChange(propertyName, oldValue, newValue);
+ }
+ } catch (java.lang.Exception e) {
+ if (Build.DEBUG) {
+ System.err.println(e.getClass().getName() + " caught propagating " + propertyName + " event: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ protected void firePropertyChange(String property, Object oldValue, Object newValue) {
+ getEventQueue().invokeLater(new PropertyChangeBroadcaster(property, oldValue, newValue));
+ }
+
+ protected void fireStatePropertyChange(AccessibleState state, boolean set) {
+ PropertyChangeBroadcaster broadcaster;
+ if (set) {
+ broadcaster = new PropertyChangeBroadcaster(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, state);
+ } else {
+ broadcaster = new PropertyChangeBroadcaster(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ state, null);
+ }
+ getEventQueue().invokeLater(broadcaster);
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleContainerListener implements XAccessibleEventListener {
+
+ protected AccessibleContainerListener() {
+ }
+
+ protected java.awt.EventQueue getEventQueue() {
+ return java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
+ }
+
+ protected void setComponentState(short state, boolean enable) {
+ switch (state) {
+ case AccessibleStateType.ACTIVE:
+ // Only frames should be active
+ break;
+ case AccessibleStateType.ENABLED:
+ setEnabled(enable);
+ // Since we can't access awt.Componet.accessibleContext, we need to fire
+ // this event manually ..
+ fireStatePropertyChange(AccessibleState.ENABLED, enable);
+ break;
+ case AccessibleStateType.FOCUSED:
+ getEventQueue().postEvent(new java.awt.event.FocusEvent(
+ Container.this, enable ?
+ java.awt.event.FocusEvent.FOCUS_GAINED :
+ java.awt.event.FocusEvent.FOCUS_LOST));
+ break;
+ case AccessibleStateType.SELECTED:
+ fireStatePropertyChange(AccessibleState.SELECTED, enable);
+ break;
+ case AccessibleStateType.SENSITIVE:
+ // This state equals ENABLED in OOo (but not in Gtk+) and does not exist in Java 1.5
+ break;
+ case AccessibleStateType.SHOWING:
+ case AccessibleStateType.VISIBLE:
+ setVisible(enable);
+ break;
+ default:
+ if (Build.DEBUG) {
+ System.err.println(Container.this + "unexpected state change " + state);
+ }
+ break;
+ }
+ }
+ /** Updates the accessible name and fires the appropriate PropertyChangedEvent */
+ protected void handleNameChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ if (accessibleContext != null) {
+ accessibleContext.setAccessibleName(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the accessible description and fires the appropriate PropertyChangedEvent */
+ protected void handleDescriptionChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ if (accessibleContext != null) {
+ accessibleContext.setAccessibleDescription(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the internal states and fires the appropriate PropertyChangedEvent */
+ protected void handleStateChangedEvent(Object any1, Object any2) {
+ try {
+ if (AnyConverter.isShort(any1)) {
+ setComponentState(AnyConverter.toShort(any1), false);
+ }
+
+ if (AnyConverter.isShort(any2)) {
+ setComponentState(AnyConverter.toShort(any2), true);
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /* This event is only necessary because some objects in the office don't know their parent
+ * and are therefor unable to revoke and re-insert themselves.
+ */
+ protected void handleAllChildrenChangedEvent() {
+ javax.accessibility.Accessible parent = (javax.accessibility.Accessible) getParent();
+ if (parent != null) {
+ javax.accessibility.AccessibleContext parentAC = parent.getAccessibleContext();
+ if (parentAC != null) {
+
+ parentAC.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ Container.this,
+ null);
+
+ AccessibleObjectFactory.clearContainer(Container.this);
+ AccessibleObjectFactory.populateContainer(Container.this, unoAccessibleContext);
+
+ parentAC.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null,
+ Container.this);
+ }
+ }
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+
+ if ( !disposed ) {
+
+ switch (event.EventId) {
+ case AccessibleEventId.NAME_CHANGED:
+ // Set the accessible name for the corresponding context, which will fire a property
+ // change event itself
+ handleNameChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.DESCRIPTION_CHANGED:
+ // Set the accessible description for the corresponding context, which will fire a property
+ // change event itself - so do not set propertyName !
+ handleDescriptionChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.STATE_CHANGED:
+ // Update the internal state set and fire the appropriate PropertyChangedEvent
+ handleStateChangedEvent(event.OldValue, event.NewValue);
+ break;
+ case AccessibleEventId.TEXT_CHANGED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY,
+ AccessibleTextImpl.convertTextSegment(event.OldValue),
+ AccessibleTextImpl.convertTextSegment(event.NewValue));
+ break;
+ case AccessibleEventId.CHILD:
+ if (AnyConverter.isObject(event.OldValue)) {
+ AccessibleObjectFactory.removeChild(Container.this, event.OldValue);
+ } else if (AnyConverter.isObject(event.NewValue)) {
+ AccessibleObjectFactory.addChild(Container.this, event.NewValue);
+ }
+ break;
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
+ break;
+ /*
+ * the Java AccessBridge for GNOME maps SELECTION_PROPERTY change events
+ * for objects of role TEXT to object:text-selection-changed
+ */
+ case AccessibleEventId.TEXT_SELECTION_CHANGED:
+ case AccessibleEventId.SELECTION_CHANGED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY, null, null);
+ break;
+ case AccessibleEventId.INVALIDATE_ALL_CHILDREN:
+ handleAllChildrenChangedEvent();
+ break;
+ default:
+ // Warn about unhandled events
+ if(Build.DEBUG) {
+ System.out.println(this + ": unhandled accessibility event id=" + event.EventId);
+ }
+ }
+ }
+ }
+
+ /** Called by OpenOffice process to notify that the UNO component is disposing */
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ disposed = true;
+ AccessibleObjectFactory.disposing(Container.this);
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleContainerListener();
+ }
+
+ protected javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** This method actually creates the AccessibleContext object returned by
+ * getAccessibleContext().
+ */
+ protected javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleContainer();
+ }
+
+ /** Returns the AccessibleContext associated with this object */
+ public final javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ try {
+ AccessibleContext ac = createAccessibleContext();
+ if (ac != null) {
+ // Set accessible name and description here to avoid
+ // unnecessary property change events later ..
+ ac.setAccessibleName(unoAccessibleContext.getAccessibleName());
+ ac.setAccessibleDescription(unoAccessibleContext.getAccessibleDescription());
+ accessibleContext = ac;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleContainer extends java.awt.Container.AccessibleAWTContainer {
+
+ protected AccessibleContainer() {
+ /* Since getAccessibleText() is heavily used by the java access
+ * bridge for gnome and the gnome at-tools, we do a query interface
+ * here and remember the result.
+ */
+ accessibleText = AccessibleTextImpl.get(unoAccessibleContext);
+ }
+
+ protected AccessibleContainer(boolean query) {
+ /* This constructor is explicitly for subclasses that implement
+ * AccessibleHypertext and therefor the default constructor would
+ * bring unnecessary overhead.
+ */
+ }
+
+ protected java.awt.event.ComponentListener accessibleComponentHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when shown/hidden..
+ */
+ protected class AccessibleComponentHandler implements java.awt.event.ComponentListener {
+ public void componentHidden(java.awt.event.ComponentEvent e) {
+ AccessibleContainer.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ AccessibleState.VISIBLE, null);
+ }
+
+ public void componentShown(java.awt.event.ComponentEvent e) {
+ AccessibleContainer.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, AccessibleState.VISIBLE);
+ }
+
+ public void componentMoved(java.awt.event.ComponentEvent e) {
+ }
+
+ public void componentResized(java.awt.event.ComponentEvent e) {
+ }
+ } // inner class AccessibleContainerHandler
+
+ protected java.awt.event.FocusListener accessibleFocusHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when focus events happen
+ */
+ protected class AccessibleFocusHandler implements java.awt.event.FocusListener {
+ public void focusGained(java.awt.event.FocusEvent event) {
+ AccessibleContainer.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, AccessibleState.FOCUSED);
+ if (Build.DEBUG) {
+ System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is now focused");
+ }
+ }
+ public void focusLost(java.awt.event.FocusEvent event) {
+ AccessibleContainer.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ AccessibleState.FOCUSED, null);
+ if (Build.DEBUG) {
+ System.err.println("[" + getAccessibleRole() + "] " + getAccessibleName() + " is no longer focused");
+ }
+ }
+ } // inner class AccessibleFocusHandler
+
+ protected java.awt.event.ContainerListener accessibleContainerHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when children added/removed.
+ */
+
+ protected class AccessibleContainerHandler implements java.awt.event.ContainerListener {
+ public void componentAdded(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleContainer.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null, ((javax.accessibility.Accessible) c).getAccessibleContext());
+ }
+ }
+ public void componentRemoved(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleContainer.this.firePropertyChange(
+ AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ ((javax.accessibility.Accessible) c).getAccessibleContext(), null);
+ }
+ }
+ }
+
+ protected int propertyChangeListenerCount = 0;
+
+ /**
+ * Add a PropertyChangeListener to the listener list.
+ *
+ * @param listener The PropertyChangeListener to be added
+ */
+ public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (propertyChangeListenerCount++ == 0) {
+ accessibleFocusHandler = new AccessibleFocusHandler();
+ Container.this.addFocusListener(accessibleFocusHandler);
+
+ accessibleContainerHandler = new AccessibleContainerHandler();
+ Container.this.addContainerListener(accessibleContainerHandler);
+
+ accessibleComponentHandler = new AccessibleComponentHandler();
+ Container.this.addComponentListener(accessibleComponentHandler);
+ }
+ super.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Remove a PropertyChangeListener from the listener list.
+ * This removes a PropertyChangeListener that was registered
+ * for all properties.
+ *
+ * @param listener The PropertyChangeListener to be removed
+ */
+ public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (--propertyChangeListenerCount == 0) {
+ Container.this.removeComponentListener(accessibleComponentHandler);
+ accessibleComponentHandler = null;
+
+ Container.this.removeContainerListener(accessibleContainerHandler);
+ accessibleContainerHandler = null;
+
+ Container.this.removeFocusListener(accessibleFocusHandler);
+ accessibleFocusHandler = null;
+ }
+ super.removePropertyChangeListener(listener);
+ }
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return accessibleRole;
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ return accessibleText;
+ }
+
+ /**
+ * Gets the current state set of this object.
+ *
+ * @return an instance of <code>AccessibleStateSet</code>
+ * containing the current state set of the object
+ * @see AccessibleState
+ */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ if (disposed)
+ return AccessibleStateAdapter.getDefunctStateSet();
+
+ try {
+ return AccessibleStateAdapter.getAccessibleStateSet(Container.this,
+ unoAccessibleContext.getAccessibleStateSet());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return AccessibleStateAdapter.getDefunctStateSet();
+ }
+ }
+
+ /** Returns the AccessibleSelection interface for this object */
+ public javax.accessibility.AccessibleSelection getAccessibleSelection() {
+ try {
+ XAccessibleSelection unoAccessibleSelection = (XAccessibleSelection)
+ UnoRuntime.queryInterface(XAccessibleSelection.class, unoAccessibleContext);
+ if (unoAccessibleSelection != null) {
+ return new AccessibleSelectionImpl(unoAccessibleSelection);
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+
+ return null;
+ }
+
+ /** Gets the locale of the component */
+ public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException {
+ try {
+ com.sun.star.lang.Locale unoLocale = unoAccessible.getAccessibleContext().getLocale();
+ return new java.util.Locale(unoLocale.Language, unoLocale.Country);
+ } catch (IllegalAccessibleComponentStateException e) {
+ throw new java.awt.IllegalComponentStateException(e.getMessage());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return super.getLocale();
+ }
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getBackground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getForeground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setForeground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Cursor getCursor() {
+ // Not supported by UNO accessibility API
+ return null;
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Font getFont() {
+ // FIXME
+ return null;
+ }
+
+ public void setFont(java.awt.Font f) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ // FIXME
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return Container.this.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isVisible() {
+ return Container.this.isVisible();
+ }
+
+ public void setVisible(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isShowing() {
+ return Container.this.isShowing();
+ }
+
+ public boolean contains(java.awt.Point p) {
+ try {
+ return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y));
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen();
+ return new java.awt.Point(unoPoint.X, unoPoint.Y);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the location of this component in the form of a point specifying the component's top-left corner */
+ public java.awt.Point getLocation() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation();
+ return new java.awt.Point( unoPoint.X, unoPoint.Y );
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ try {
+ com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds();
+ return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ try {
+ com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize();
+ return new java.awt.Dimension(unoSize.Width, unoSize.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ try {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
+ unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y)));
+
+ return (javax.accessibility.Accessible) c;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public boolean isFocusTraversable() {
+ return Container.this.isFocusable();
+ }
+
+ public void requestFocus() {
+ unoAccessibleComponent.grabFocus();
+ }
+ }
+
+ public String toString() {
+ return UnoRuntime.generateOid(unoAccessible);
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java b/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java
new file mode 100644
index 000000000000..5b8c45b716b4
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/DescendantManager.java
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+
+import javax.accessibility.AccessibleState;
+
+
+public abstract class DescendantManager extends Component {
+ protected XAccessibleSelection unoAccessibleSelection = null;
+ protected javax.accessibility.Accessible activeDescendant = null;
+ protected boolean multiselectable = false;
+
+ protected DescendantManager(XAccessible xAccessible,
+ XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ protected DescendantManager(XAccessible xAccessible,
+ XAccessibleContext xAccessibleContext, boolean multiselectable) {
+ super(xAccessible, xAccessibleContext);
+ this.multiselectable = multiselectable;
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleDescendantManagerListener
+ extends AccessibleUNOComponentListener {
+ protected AccessibleDescendantManagerListener() {
+ unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
+ unoAccessibleContext);
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.SELECTION_CHANGED:
+ firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY,
+ null, null);
+
+ break;
+
+ default:
+ super.notifyEvent(event);
+ }
+ }
+ }
+
+ protected abstract class AccessibleDescendantManager
+ extends AccessibleUNOComponent
+ implements javax.accessibility.AccessibleSelection {
+ protected AccessibleDescendantManager() {
+ unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
+ unoAccessibleContext);
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Returns the number of accessible children of the object */
+ public int getAccessibleChildrenCount() {
+ try {
+ return unoAccessibleContext.getAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the AccessibleSelection interface for this object */
+ public javax.accessibility.AccessibleSelection getAccessibleSelection() {
+ return (unoAccessibleSelection != null) ? this : null;
+ }
+
+ /*
+ * AccessibleSelection
+ */
+
+ /** Adds the specified Accessible child of the object to the object's selection */
+ public void addAccessibleSelection(int i) {
+ try {
+ unoAccessibleSelection.selectAccessibleChild(i);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Clears the selection in the object, so that no children in the object are selected */
+ public void clearAccessibleSelection() {
+ try {
+ unoAccessibleSelection.clearAccessibleSelection();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Returns the number of Accessible children currently selected */
+ public int getAccessibleSelectionCount() {
+ try {
+ return unoAccessibleSelection.getSelectedAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Determines if the current child of this object is selected */
+ public boolean isAccessibleChildSelected(int i) {
+ try {
+ return unoAccessibleSelection.isAccessibleChildSelected(i);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Removes the specified child of the object from the object's selection */
+ public void removeAccessibleSelection(int i) {
+ try {
+ unoAccessibleSelection.deselectAccessibleChild(i);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Causes every child of the object to be selected if the object supports multiple selection */
+ public void selectAllAccessibleSelection() {
+ try {
+ unoAccessibleSelection.selectAllAccessibleChildren();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java b/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java
new file mode 100644
index 000000000000..dcb067368996
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Dialog.java
@@ -0,0 +1,633 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleState;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+public class Dialog extends java.awt.Dialog implements javax.accessibility.Accessible, NativeFrame {
+ protected XAccessibleComponent unoAccessibleComponent;
+
+ boolean opened = false;
+ boolean visible = false;
+ boolean active = false;
+
+ java.awt.EventQueue eventQueue = null;
+
+ protected Dialog(java.awt.Frame owner, XAccessibleComponent xAccessibleComponent) {
+ super(owner);
+ initialize(xAccessibleComponent);
+ }
+
+ protected Dialog(java.awt.Frame owner, String name, XAccessibleComponent xAccessibleComponent) {
+ super(owner, name);
+ initialize(xAccessibleComponent);
+ }
+
+ protected Dialog(java.awt.Frame owner, String name, boolean modal, XAccessibleComponent xAccessibleComponent) {
+ super(owner, name, modal);
+ initialize(xAccessibleComponent);
+ }
+
+ private void initialize(XAccessibleComponent xAccessibleComponent) {
+ unoAccessibleComponent = xAccessibleComponent;
+ eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
+ XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
+ UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
+ xAccessibleComponent);
+ if (broadcaster != null) {
+ broadcaster.addEventListener(new AccessibleDialogListener());
+ }
+ }
+
+ java.awt.Component initialComponent = null;
+
+ public java.awt.Component getInitialComponent() {
+ return initialComponent;
+ }
+
+ public void setInitialComponent(java.awt.Component c) {
+ initialComponent = c;
+ }
+
+ public Integer getHWND() {
+ return null;
+ }
+
+ /**
+ * Determines whether this <code>Component</code> is showing on screen.
+ * This means that the component must be visible, and it must be in a
+ * <code>container</code> that is visible and showing.
+ * @see #addNotify
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public boolean isShowing() {
+ if (isVisible()) {
+ java.awt.Container parent = getParent();
+ return (parent == null) || parent.isShowing();
+ }
+ return false;
+ }
+
+ /**
+ * Makes this <code>Component</code> displayable by connecting it to a
+ * native screen resource.
+ * This method is called internally by the toolkit and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public void addNotify() {
+// createHierarchyEvents(0, null, null, 0, false);
+ }
+
+ /**
+ * Makes this <code>Component</code> undisplayable by destroying it native
+ * screen resource.
+ * This method is called by the toolkit internally and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #addNotify
+ * @since JDK1.0
+ */
+ public void removeNotify() {
+ }
+
+ /**
+ * Determines if the object is visible. Note: this means that the
+ * object intends to be visible; however, it may not in fact be
+ * showing on the screen because one of the objects that this object
+ * is contained by is not visible. To determine if an object is
+ * showing on the screen, use <code>isShowing</code>.
+ *
+ * @return true if object is visible; otherwise, false
+ */
+ public boolean isVisible(){
+ return visible;
+ }
+
+ /**
+ * Shows or hides this component depending on the value of parameter
+ * <code>b</code>.
+ * @param b if <code>true</code>, shows this component;
+ * otherwise, hides this component
+ * @see #isVisible
+ * @since JDK1.1
+ */
+ public void setVisible(boolean b) {
+ if (visible != b){
+ visible = b;
+ if (b) {
+ // If it is the first show, fire WINDOW_OPENED event
+ if (!opened) {
+ postWindowEvent(java.awt.event.WindowEvent.WINDOW_OPENED);
+ opened = true;
+ }
+ postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_SHOWN);
+ } else {
+ postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_HIDDEN);
+ }
+ }
+ }
+
+ public void dispose() {
+ setVisible(false);
+ postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED);
+ }
+
+ protected void postWindowEvent(int i) {
+ eventQueue.postEvent(new java.awt.event.WindowEvent(this, i));
+ }
+
+ protected void postComponentEvent(int i) {
+ eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i));
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleDialogListener implements XAccessibleEventListener {
+
+ protected AccessibleDialogListener() {
+ }
+
+ protected void setComponentState(short state, boolean enable) {
+ switch (state) {
+ case AccessibleStateType.ACTIVE:
+ active = enable;
+ if (enable) {
+ AccessibleObjectFactory.postWindowActivated(Dialog.this);
+ } else {
+ AccessibleObjectFactory.postWindowLostFocus(Dialog.this);
+ }
+ break;
+ case AccessibleStateType.ICONIFIED:
+ postWindowEvent(enable ?
+ java.awt.event.WindowEvent.WINDOW_ICONIFIED :
+ java.awt.event.WindowEvent.WINDOW_DEICONIFIED);
+ break;
+ case AccessibleStateType.VISIBLE:
+ Dialog.this.setVisible(enable);
+ break;
+ default:
+ if (Build.DEBUG) {
+ System.err.println("[dialog]: " + getTitle() + "unexpected state change " + state);
+ }
+ break;
+ }
+ }
+
+ /** Updates the accessible name and fires the appropriate PropertyChangedEvent */
+ protected void handleNameChangedEvent(Object any) {
+ try {
+ String title = AnyConverter.toString(any);
+ setTitle(title);
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac!= null) {
+ ac.setAccessibleName(title);
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the accessible description and fires the appropriate PropertyChangedEvent */
+ protected void handleDescriptionChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac!= null) {
+ ac.setAccessibleDescription(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the internal states and fires the appropriate PropertyChangedEvent */
+ protected void handleStateChangedEvent(Object any1, Object any2) {
+ try {
+ if (AnyConverter.isShort(any1)) {
+ setComponentState(AnyConverter.toShort(any1), false);
+ }
+
+ if (AnyConverter.isShort(any2)) {
+ setComponentState(AnyConverter.toShort(any2), true);
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Fires a visible data property change event */
+ protected void handleVisibleDataEvent() {
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac != null) {
+ ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
+ }
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.NAME_CHANGED:
+ // Set the accessible name for the corresponding context, which will fire a property
+ // change event itself
+ handleNameChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.DESCRIPTION_CHANGED:
+ // Set the accessible description for the corresponding context, which will fire a property
+ // change event itself - so do not set propertyName !
+ handleDescriptionChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.STATE_CHANGED:
+ // Update the internal state set and fire the appropriate PropertyChangedEvent
+ handleStateChangedEvent(event.OldValue, event.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ if (AnyConverter.isObject(event.OldValue)) {
+ AccessibleObjectFactory.removeChild(Dialog.this, event.OldValue);
+ } else if (AnyConverter.isObject(event.NewValue)) {
+ AccessibleObjectFactory.addChild(Dialog.this, event.NewValue);
+ }
+ break;
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ handleVisibleDataEvent();
+ break;
+ default:
+ // Warn about unhandled events
+ if(Build.DEBUG) {
+ System.out.println(this + ": unhandled accessibility event id=" + event.EventId);
+ }
+ }
+ }
+
+ /** Called by OpenOffice process to notify that the UNO component is disposing */
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ }
+ }
+
+ javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ accessibleContext = new AccessibleDialog();
+ accessibleContext.setAccessibleName(getTitle());
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleDialog extends java.awt.Dialog.AccessibleAWTDialog {
+ protected AccessibleDialog() {
+ super();
+ }
+
+ protected java.awt.event.ComponentListener accessibleComponentHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when shown/hidden..
+ */
+ protected class AccessibleComponentHandler implements java.awt.event.ComponentListener {
+ public void componentHidden(java.awt.event.ComponentEvent e) {
+ AccessibleDialog.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ javax.accessibility.AccessibleState.VISIBLE, null);
+ }
+
+ public void componentShown(java.awt.event.ComponentEvent e) {
+ AccessibleDialog.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, javax.accessibility.AccessibleState.VISIBLE);
+ }
+
+ public void componentMoved(java.awt.event.ComponentEvent e) {
+ }
+
+ public void componentResized(java.awt.event.ComponentEvent e) {
+ }
+ } // inner class AccessibleComponentHandler
+
+ protected java.awt.event.WindowListener accessibleWindowHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when window events happen
+ */
+ protected class AccessibleWindowHandler implements java.awt.event.WindowListener {
+ /** Invoked when the Window is set to be the active Window. */
+ public void windowActivated(java.awt.event.WindowEvent e) {
+ AccessibleDialog.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, javax.accessibility.AccessibleState.ACTIVE);
+ if (Build.DEBUG) {
+ System.err.println("[Dialog] " + getTitle() + " is now active");
+ }
+ }
+
+ /** Invoked when a window has been closed as the result of calling dispose on the window. */
+ public void windowClosed(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[Dialog] " + getTitle() + " has been closed");
+ }
+ }
+
+ /** Invoked when the user attempts to close the window from the window's system menu. */
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[Dialog] " + getTitle() + " is closing");
+ }
+ }
+
+ /** Invoked when a Window is no longer the active Window. */
+ public void windowDeactivated(java.awt.event.WindowEvent e) {
+ AccessibleDialog.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ javax.accessibility.AccessibleState.ACTIVE, null);
+ if (Build.DEBUG) {
+ System.err.println("[Dialog] " + getTitle() + " is no longer active");
+ }
+ }
+
+ /** Invoked when a window is changed from a minimized to a normal state. */
+ public void windowDeiconified(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[Dialog] " + getTitle() + " has been deiconified");
+ }
+ }
+
+ /** Invoked when a window is changed from a normal to a minimized state. */
+ public void windowIconified(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[Dialog] " + getTitle() + " has been iconified");
+ }
+ }
+
+ /** Invoked the first time a window is made visible. */
+ public void windowOpened(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[Dialog] " + getTitle() + " has been opened");
+ }
+ }
+
+ } // inner class AccessibleWindowHandler
+
+ protected java.awt.event.ContainerListener accessibleContainerHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when children added/removed.
+ */
+
+ protected class AccessibleContainerHandler implements java.awt.event.ContainerListener {
+ public void componentAdded(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleDialog.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null, ((javax.accessibility.Accessible) c).getAccessibleContext());
+ }
+ }
+ public void componentRemoved(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleDialog.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ ((javax.accessibility.Accessible) c).getAccessibleContext(), null);
+ }
+ }
+ }
+
+ protected int propertyChangeListenerCount = 0;
+
+ /**
+ * Add a PropertyChangeListener to the listener list.
+ *
+ * @param listener The PropertyChangeListener to be added
+ */
+ public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (propertyChangeListenerCount++ == 0) {
+ accessibleWindowHandler = new AccessibleWindowHandler();
+ Dialog.this.addWindowListener(accessibleWindowHandler);
+
+ accessibleContainerHandler = new AccessibleContainerHandler();
+ Dialog.this.addContainerListener(accessibleContainerHandler);
+
+ accessibleComponentHandler = new AccessibleComponentHandler();
+ Dialog.this.addComponentListener(accessibleComponentHandler);
+ }
+ super.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Remove a PropertyChangeListener from the listener list.
+ * This removes a PropertyChangeListener that was registered
+ * for all properties.
+ *
+ * @param listener The PropertyChangeListener to be removed
+ */
+ public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (--propertyChangeListenerCount == 0) {
+ Dialog.this.removeComponentListener(accessibleComponentHandler);
+ accessibleComponentHandler = null;
+
+ Dialog.this.removeContainerListener(accessibleContainerHandler);
+ accessibleContainerHandler = null;
+
+ Dialog.this.removeWindowListener(accessibleWindowHandler);
+ accessibleWindowHandler = null;
+ }
+ super.removePropertyChangeListener(listener);
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getBackground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getForeground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setForeground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Cursor getCursor() {
+ // Not supported by UNO accessibility API
+ return null;
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Font getFont() {
+ // FIXME
+ return null;
+ }
+
+ public void setFont(java.awt.Font f) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ // FIXME
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return Dialog.this.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isVisible() {
+ return Dialog.this.isVisible();
+ }
+
+ public void setVisible(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isShowing() {
+ return Dialog.this.isShowing();
+ }
+
+ public boolean contains(java.awt.Point p) {
+ try {
+ return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y));
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen();
+ return new java.awt.Point(unoPoint.X, unoPoint.Y);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the location of this component in the form of a point specifying the component's top-left corner */
+ public java.awt.Point getLocation() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation();
+ return new java.awt.Point( unoPoint.X, unoPoint.Y );
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ try {
+ com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds();
+ return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ try {
+ com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize();
+ return new java.awt.Dimension(unoSize.Width, unoSize.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ try {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
+ unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y)));
+
+ return (javax.accessibility.Accessible) c;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public boolean isFocusTraversable() {
+ return Dialog.this.isFocusable();
+ }
+
+ public void requestFocus() {
+ unoAccessibleComponent.grabFocus();
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java b/accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java
new file mode 100644
index 000000000000..75f6c91354f4
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/FocusTraversalPolicy.java
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+
+public class FocusTraversalPolicy extends java.awt.FocusTraversalPolicy {
+
+ protected javax.accessibility.Accessible getSelectedAccessibleChild(javax.accessibility.Accessible a) {
+ javax.accessibility.AccessibleContext ac = a.getAccessibleContext();
+ if (ac != null) {
+ javax.accessibility.AccessibleSelection as = ac.getAccessibleSelection();
+ if (as != null) {
+ return as.getAccessibleSelection(0);
+ }
+ }
+ return null;
+ }
+
+ /** Returns the Component that should receive the focus after aComponent */
+ public java.awt.Component getComponentAfter(java.awt.Container focusCycleRoot,
+ java.awt.Component aComponent) {
+ return null;
+ }
+
+ /** Returns the Component that should receive the focus before aComponent */
+ public java.awt.Component getComponentBefore(java.awt.Container focusCycleRoot,
+ java.awt.Component aComponent) {
+ return null;
+ }
+
+ /** Returns the default Component to focus */
+ public java.awt.Component getDefaultComponent(java.awt.Container focusCycleRoot) {
+ // getDefaultComponent must not return null for Windows to make them focusable.
+ if (focusCycleRoot instanceof NativeFrame) {
+ java.awt.Component c = ((NativeFrame) focusCycleRoot).getInitialComponent();
+ if (c != null) {
+ return c;
+ }
+ }
+
+ if (focusCycleRoot instanceof javax.accessibility.Accessible) {
+ return (java.awt.Component) getSelectedAccessibleChild((javax.accessibility.Accessible) focusCycleRoot);
+ }
+ return null;
+ }
+
+ /** Returns the first Component in the traversal cycle */
+ public java.awt.Component getFirstComponent(java.awt.Container focusCycleRoot) {
+ return null;
+ }
+
+ /** Returns the Component that should receive the focus when a Window is made visible for the first time */
+ public java.awt.Component getInitialComponent(java.awt.Window window) {
+ if (window instanceof NativeFrame) {
+ return ((NativeFrame) window).getInitialComponent();
+ }
+ return null;
+ }
+
+ /** Returns the last Component in the traversal cycle */
+ public java.awt.Component getLastComponent(java.awt.Container focusCycleRoot) {
+ return null;
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Frame.java b/accessibility/bridge/org/openoffice/java/accessibility/Frame.java
new file mode 100644
index 000000000000..b7f37b2d6b18
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Frame.java
@@ -0,0 +1,646 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+public class Frame extends java.awt.Frame implements javax.accessibility.Accessible, NativeFrame {
+ protected XAccessibleComponent unoAccessibleComponent;
+
+ boolean opened = false;
+ boolean visible = false;
+ boolean active = false;
+
+ java.awt.EventQueue eventQueue = null;
+
+ protected Frame(XAccessibleComponent xAccessibleComponent) {
+ initialize(xAccessibleComponent);
+ }
+
+ protected Frame(String name, XAccessibleComponent xAccessibleComponent) {
+ super(name);
+ initialize(xAccessibleComponent);
+ }
+
+ private void initialize(XAccessibleComponent xAccessibleComponent) {
+ unoAccessibleComponent = xAccessibleComponent;
+ eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
+ XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
+ UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
+ unoAccessibleComponent);
+ if (broadcaster != null) {
+ broadcaster.addEventListener(new AccessibleFrameListener());
+ }
+ }
+
+ java.awt.Component initialComponent = null;
+
+ public java.awt.Component getInitialComponent() {
+ return initialComponent;
+ }
+
+ public void setInitialComponent(java.awt.Component c) {
+ initialComponent = c;
+ }
+
+ public Integer getHWND() {
+ return null;
+ }
+
+ /**
+ * Determines whether this <code>Component</code> is showing on screen.
+ * This means that the component must be visible, and it must be in a
+ * <code>container</code> that is visible and showing.
+ * @see #addNotify
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public boolean isShowing() {
+ if (isVisible()) {
+ java.awt.Container parent = getParent();
+ return (parent == null) || parent.isShowing();
+ }
+ return false;
+ }
+
+ /**
+ * Makes this <code>Component</code> displayable by connecting it to a
+ * native screen resource.
+ * This method is called internally by the toolkit and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public void addNotify() {
+// createHierarchyEvents(0, null, null, 0, false);
+ }
+
+ /**
+ * Makes this <code>Component</code> undisplayable by destroying it native
+ * screen resource.
+ * This method is called by the toolkit internally and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #addNotify
+ * @since JDK1.0
+ */
+ public void removeNotify() {
+ }
+
+ /**
+ * Determines if the object is visible. Note: this means that the
+ * object intends to be visible; however, it may not in fact be
+ * showing on the screen because one of the objects that this object
+ * is contained by is not visible. To determine if an object is
+ * showing on the screen, use <code>isShowing</code>.
+ *
+ * @return true if object is visible; otherwise, false
+ */
+ public boolean isVisible(){
+ return visible;
+ }
+
+ /**
+ * Shows or hides this component depending on the value of parameter
+ * <code>b</code>.
+ * @param b if <code>true</code>, shows this component;
+ * otherwise, hides this component
+ * @see #isVisible
+ * @since JDK1.1
+ */
+ public void setVisible(boolean b) {
+ if (visible != b){
+ visible = b;
+ if (b) {
+ // If it is the first show, fire WINDOW_OPENED event
+ if (!opened) {
+ postWindowEvent(java.awt.event.WindowEvent.WINDOW_OPENED);
+ opened = true;
+ }
+ postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_SHOWN);
+ } else {
+ postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_HIDDEN);
+ }
+ }
+ }
+
+ public void dispose() {
+ setVisible(false);
+ postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED);
+ }
+
+ protected void postWindowEvent(int i) {
+ eventQueue.postEvent(new java.awt.event.WindowEvent(this, i));
+ }
+
+ protected void postComponentEvent(int i) {
+ eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i));
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleFrameListener implements XAccessibleEventListener {
+
+ protected AccessibleFrameListener() {
+ }
+
+ // The only expected state changes are ACTIVE and VISIBLE
+ protected void setComponentState(short state, boolean enable) {
+ switch (state) {
+ case AccessibleStateType.ACTIVE:
+ active = enable;
+ if (enable) {
+ AccessibleObjectFactory.postWindowActivated(Frame.this);
+ } else {
+ AccessibleObjectFactory.postWindowLostFocus(Frame.this);
+ }
+ break;
+ case AccessibleStateType.ICONIFIED:
+ if (Build.DEBUG) {
+ System.err.println("[frame]" + getTitle() + (enable ? " is now " : " is no longer ") + "iconified");
+ }
+ postWindowEvent(enable ?
+ java.awt.event.WindowEvent.WINDOW_ICONIFIED :
+ java.awt.event.WindowEvent.WINDOW_DEICONIFIED);
+ break;
+ case AccessibleStateType.VISIBLE:
+ Frame.this.setVisible(enable);
+ break;
+ default:
+ if (Build.DEBUG) {
+ System.err.println("[frame]: " + getTitle() + "unexpected state change " + state);
+ }
+ break;
+ }
+ }
+
+ /** Updates the accessible name and fires the appropriate PropertyChangedEvent */
+ protected void handleNameChangedEvent(Object any) {
+ try {
+ String title = AnyConverter.toString(any);
+ setTitle(title);
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac!= null) {
+ ac.setAccessibleName(title);
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the accessible description and fires the appropriate PropertyChangedEvent */
+ protected void handleDescriptionChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac!= null) {
+ ac.setAccessibleDescription(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the internal states and fires the appropriate PropertyChangedEvent */
+ protected void handleStateChangedEvent(Object any1, Object any2) {
+ try {
+ if (AnyConverter.isShort(any1)) {
+ setComponentState(AnyConverter.toShort(any1), false);
+ }
+
+ if (AnyConverter.isShort(any2)) {
+ setComponentState(AnyConverter.toShort(any2), true);
+ }
+ }
+
+ catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Fires a visible data property change event */
+ protected void handleVisibleDataEvent() {
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac != null) {
+ ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
+ }
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.NAME_CHANGED:
+ // Set the accessible name for the corresponding context, which will fire a property
+ // change event itself
+ handleNameChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.DESCRIPTION_CHANGED:
+ // Set the accessible description for the corresponding context, which will fire a property
+ // change event itself - so do not set propertyName !
+ handleDescriptionChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.STATE_CHANGED:
+ // Update the internal state set and fire the appropriate PropertyChangedEvent
+ handleStateChangedEvent(event.OldValue, event.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ if (AnyConverter.isObject(event.OldValue)) {
+ AccessibleObjectFactory.removeChild(Frame.this, event.OldValue);
+ } else if (AnyConverter.isObject(event.NewValue)) {
+ AccessibleObjectFactory.addChild(Frame.this, event.NewValue);
+ }
+ break;
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ handleVisibleDataEvent();
+ break;
+ default:
+ // Warn about unhandled events
+ if(Build.DEBUG) {
+ System.out.println(this + ": unhandled accessibility event id=" + event.EventId);
+ }
+ }
+ }
+
+ /** Called by OpenOffice process to notify that the UNO component is disposing */
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ }
+ }
+
+ protected javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ accessibleContext = new AccessibleFrame();
+ accessibleContext.setAccessibleName(getTitle());
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleFrame extends java.awt.Frame.AccessibleAWTFrame {
+ protected AccessibleFrame() {
+ super();
+ }
+
+ protected java.awt.event.ComponentListener accessibleComponentHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when shown/hidden..
+ */
+ protected class AccessibleComponentHandler implements java.awt.event.ComponentListener {
+ public void componentHidden(java.awt.event.ComponentEvent e) {
+ AccessibleFrame.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ javax.accessibility.AccessibleState.VISIBLE, null);
+ }
+
+ public void componentShown(java.awt.event.ComponentEvent e) {
+ AccessibleFrame.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, javax.accessibility.AccessibleState.VISIBLE);
+ }
+
+ public void componentMoved(java.awt.event.ComponentEvent e) {
+ }
+
+ public void componentResized(java.awt.event.ComponentEvent e) {
+ }
+ } // inner class AccessibleComponentHandler
+
+ protected java.awt.event.WindowListener accessibleWindowHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when window events happen
+ */
+ protected class AccessibleWindowHandler implements java.awt.event.WindowListener {
+ /** Invoked when the Window is set to be the active Window. */
+ public void windowActivated(java.awt.event.WindowEvent e) {
+ AccessibleFrame.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, javax.accessibility.AccessibleState.ACTIVE);
+ if (Build.DEBUG) {
+ System.err.println("[frame] " + getTitle() + " is now active");
+ }
+ }
+
+ /** Invoked when a window has been closed as the result of calling dispose on the window. */
+ public void windowClosed(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[frame] " + getTitle() + " has been closed");
+ }
+ }
+
+ /** Invoked when the user attempts to close the window from the window's system menu. */
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[frame] " + getTitle() + " is closing");
+ }
+ }
+
+ /** Invoked when a Window is no longer the active Window. */
+ public void windowDeactivated(java.awt.event.WindowEvent e) {
+ AccessibleFrame.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ javax.accessibility.AccessibleState.ACTIVE, null);
+ if (Build.DEBUG) {
+ System.err.println("[frame] " + getTitle() + " is no longer active");
+ }
+ }
+
+ /** Invoked when a window is changed from a minimized to a normal state. */
+ public void windowDeiconified(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[frame] " + getTitle() + " is no longer iconified");
+ }
+ }
+
+ /** Invoked when a window is changed from a normal to a minimized state. */
+ public void windowIconified(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[frame] " + getTitle() + " has been iconified");
+ }
+ }
+
+ /** Invoked the first time a window is made visible. */
+ public void windowOpened(java.awt.event.WindowEvent e) {
+ if (Build.DEBUG) {
+ System.err.println("[frame] " + getTitle() + " has been opened");
+ }
+ }
+
+ } // inner class AccessibleWindowHandler
+
+ protected java.awt.event.ContainerListener accessibleContainerHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when children added/removed.
+ */
+
+ protected class AccessibleContainerHandler implements java.awt.event.ContainerListener {
+ public void componentAdded(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleFrame.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null, ((javax.accessibility.Accessible) c).getAccessibleContext());
+ }
+ }
+ public void componentRemoved(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleFrame.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ ((javax.accessibility.Accessible) c).getAccessibleContext(), null);
+ }
+ }
+ }
+
+ protected int propertyChangeListenerCount = 0;
+
+ /**
+ * Add a PropertyChangeListener to the listener list.
+ *
+ * @param listener The PropertyChangeListener to be added
+ */
+ public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (propertyChangeListenerCount++ == 0) {
+ accessibleWindowHandler = new AccessibleWindowHandler();
+ Frame.this.addWindowListener(accessibleWindowHandler);
+
+ accessibleContainerHandler = new AccessibleContainerHandler();
+ Frame.this.addContainerListener(accessibleContainerHandler);
+
+ accessibleComponentHandler = new AccessibleComponentHandler();
+ Frame.this.addComponentListener(accessibleComponentHandler);
+ }
+ super.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Remove a PropertyChangeListener from the listener list.
+ * This removes a PropertyChangeListener that was registered
+ * for all properties.
+ *
+ * @param listener The PropertyChangeListener to be removed
+ */
+ public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (--propertyChangeListenerCount == 0) {
+ Frame.this.removeComponentListener(accessibleComponentHandler);
+ accessibleComponentHandler = null;
+
+ Frame.this.removeContainerListener(accessibleContainerHandler);
+ accessibleContainerHandler = null;
+
+ Frame.this.removeWindowListener(accessibleWindowHandler);
+ accessibleWindowHandler = null;
+ }
+ super.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Get the state set of this object.
+ *
+ * @return an instance of AccessibleState containing the current state
+ * of the object
+ * @see AccessibleState
+ */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ javax.accessibility.AccessibleStateSet states = super.getAccessibleStateSet();
+ if ((getExtendedState() & java.awt.Frame.ICONIFIED) > 0) {
+ states.add(javax.accessibility.AccessibleState.ICONIFIED);
+ }
+ return states;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getBackground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getForeground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setForeground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Cursor getCursor() {
+ // Not supported by UNO accessibility API
+ return null;
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Font getFont() {
+ // FIXME
+ return null;
+ }
+
+ public void setFont(java.awt.Font f) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ // FIXME
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return Frame.this.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isVisible() {
+ return Frame.this.isVisible();
+ }
+
+ public void setVisible(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isShowing() {
+ return Frame.this.isShowing();
+ }
+
+ public boolean contains(java.awt.Point p) {
+ try {
+ return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y));
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen();
+ return new java.awt.Point(unoPoint.X, unoPoint.Y);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the location of this component in the form of a point specifying the component's top-left corner */
+ public java.awt.Point getLocation() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocation();
+ return new java.awt.Point( unoPoint.X, unoPoint.Y );
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ try {
+ com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds();
+ return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ try {
+ com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize();
+ return new java.awt.Dimension(unoSize.Width, unoSize.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ try {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
+ unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y)));
+
+ return (javax.accessibility.Accessible) c;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public boolean isFocusTraversable() {
+ return Frame.this.isFocusable();
+ }
+
+ public void requestFocus() {
+ unoAccessibleComponent.grabFocus();
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Icon.java b/accessibility/bridge/org/openoffice/java/accessibility/Icon.java
new file mode 100644
index 000000000000..8ccc97def4d8
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Icon.java
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
+
+/**
+ */
+public class Icon extends Component implements javax.accessibility.Accessible {
+ protected Icon(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleIcon();
+ }
+
+ protected class AccessibleIcon extends AccessibleUNOComponent {
+ /**
+ * Though the class is abstract, this should be called by all sub-classes
+ */
+ protected AccessibleIcon() {
+ super();
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
+ try {
+ XAccessibleImage unoAccessibleImage = (XAccessibleImage) UnoRuntime.queryInterface(XAccessibleImage.class,
+ unoAccessibleComponent);
+
+ if (unoAccessibleImage != null) {
+ javax.accessibility.AccessibleIcon[] icons = {
+ new AccessibleIconImpl(unoAccessibleImage)
+ };
+
+ return icons;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+
+ return null;
+ }
+
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Label.java b/accessibility/bridge/org/openoffice/java/accessibility/Label.java
new file mode 100644
index 000000000000..9afaa0a1ae37
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Label.java
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
+
+/**
+ */
+public class Label extends Component implements javax.accessibility.Accessible {
+ protected Label(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleLabel();
+ }
+
+ protected class AccessibleLabel extends AccessibleUNOComponent {
+ /**
+ * Though the class is abstract, this should be called by all sub-classes
+ */
+ protected AccessibleLabel() {
+ super();
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.LABEL;
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class,
+ unoAccessibleContext);
+
+ if (unoAccessibleText != null) {
+ return new AccessibleTextImpl(unoAccessibleText);
+ } else {
+ return null;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the relation set of this object */
+ public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() {
+ try {
+ XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet();
+
+ if (unoAccessibleRelationSet == null) {
+ return null;
+ }
+
+ javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet();
+ int count = unoAccessibleRelationSet.getRelationCount();
+
+ for (int i = 0; i < count; i++) {
+ AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i);
+
+ switch (unoAccessibleRelation.RelationType) {
+ case AccessibleRelationType.LABEL_FOR:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABEL_FOR,
+ getAccessibleComponents(
+ unoAccessibleRelation.TargetSet)));
+
+ break;
+
+ case AccessibleRelationType.MEMBER_OF:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ getAccessibleComponents(
+ unoAccessibleRelation.TargetSet)));
+
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return relationSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/List.java b/accessibility/bridge/org/openoffice/java/accessibility/List.java
new file mode 100644
index 000000000000..c0583bf9b692
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/List.java
@@ -0,0 +1,452 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleState;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.*;
+
+public class List extends DescendantManager implements javax.accessibility.Accessible {
+
+ protected List(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ protected void setActiveDescendant(javax.accessibility.Accessible descendant) {
+ javax.accessibility.Accessible oldAD = activeDescendant;
+ activeDescendant = descendant;
+ firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
+ oldAD, descendant);
+ }
+
+ protected void setActiveDescendant(Object any) {
+ javax.accessibility.Accessible descendant = null;
+ try {
+ if (AnyConverter.isObject(any)) {
+ XAccessible unoAccessible = (XAccessible) AnyConverter.toObject(
+ AccessibleObjectFactory.XAccessibleType, any);
+ if (unoAccessible != null) {
+ // FIXME: have to handle non transient objects here ..
+ descendant = new ListItem(unoAccessible);
+ if (Build.DEBUG) {
+ try {
+ if (Build.DEBUG) {
+ System.err.println("[List] retrieved active descendant event: new descendant is " +
+ unoAccessible.getAccessibleContext().getAccessibleName());
+ }
+ } catch (java.lang.NullPointerException e) {
+ System.err.println("*** ERROR *** new active descendant not accessible");
+ }
+ }
+ }
+ }
+ setActiveDescendant(descendant);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected void add(XAccessible unoAccessible) {
+ if (unoAccessible != null) {
+ ListItem item = new ListItem(unoAccessible);
+ // The AccessBridge for Windows expects an instance of AccessibleContext
+ // as parameters
+ firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null, item.getAccessibleContext());
+ }
+ }
+
+ protected void remove(XAccessible unoAccessible) {
+ if (unoAccessible != null) {
+ ListItem item = new ListItem(unoAccessible);
+ // The AccessBridge for Windows expects an instance of AccessibleContext
+ // as parameters
+ firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ item.getAccessibleContext(), null);
+ }
+ }
+
+ protected void add(Object any) {
+ try {
+ add((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected void remove(Object any) {
+ try {
+ remove((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleListListener extends AccessibleDescendantManagerListener {
+
+ protected AccessibleListListener() {
+ super();
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED:
+ setActiveDescendant(event.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ if (AnyConverter.isObject(event.OldValue)) {
+ remove(event.OldValue);
+ }
+ if (AnyConverter.isObject(event.NewValue)) {
+ add(event.NewValue);
+ }
+ break;
+ case AccessibleEventId.INVALIDATE_ALL_CHILDREN:
+ // Since List items a transient a child events are mostly used
+ // to attach/detach listeners, it is save to ignore it here
+ break;
+ default:
+ super.notifyEvent(event);
+ }
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleListListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleList();
+ }
+
+ protected class AccessibleList extends AccessibleDescendantManager {
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.LIST;
+ }
+
+ /** Returns the specified Accessible child of the object */
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = List.this.activeDescendant;
+ if ((activeDescendant instanceof ListItem) && xAccessible.equals(((ListItem) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new ListItem(xAccessible);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y));
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = List.this.activeDescendant;
+ if ((activeDescendant instanceof ListItem) && xAccessible.equals(((ListItem) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new ListItem(xAccessible);
+ }
+ }
+ return child;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /*
+ * AccessibleSelection
+ */
+
+ /** Returns an Accessible representing the specified selected child of the object */
+ public javax.accessibility.Accessible getAccessibleSelection(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleSelection.getSelectedAccessibleChild(i);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = List.this.activeDescendant;
+ if ((activeDescendant instanceof ListItem) && xAccessible.equals(((ListItem) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new ListItem(xAccessible);
+ }
+ } else if (Build.DEBUG) {
+ System.out.println(i + "th selected child is not accessible");
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ if (Build.DEBUG) {
+ System.err.println("IndexOutOfBoundsException caught for AccessibleList.getAccessibleSelection(" + i + ")");
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+ }
+
+ class ListItem extends java.awt.Component implements javax.accessibility.Accessible {
+
+ protected XAccessible unoAccessible;
+
+ public ListItem(XAccessible xAccessible) {
+ unoAccessible = xAccessible;
+ }
+
+ public Object[] create(Object[] targetSet) {
+ try {
+ java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
+ for (int i=0; i < targetSet.length; i++) {
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, targetSet[i]);
+ if (xAccessible != null) {
+ list.add(new ListItem(xAccessible));
+ }
+ }
+ list.trimToSize();
+ return list.toArray();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ try {
+ XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
+ if (xAccessibleContext != null) {
+ javax.accessibility.AccessibleContext ac = new AccessibleListItem(xAccessibleContext);
+ if (ac != null) {
+ ac.setAccessibleParent(List.this);
+ accessibleContext = ac;
+ }
+ AccessibleStateAdapter.setComponentState(this, xAccessibleContext.getAccessibleStateSet());
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleListItem extends javax.accessibility.AccessibleContext {
+
+ XAccessibleContext unoAccessibleContext;
+
+ public AccessibleListItem(XAccessibleContext xAccessibleContext) {
+ unoAccessibleContext = xAccessibleContext;
+ }
+
+ /** Returns the accessible name of this object */
+ public String getAccessibleName() {
+ try {
+ return unoAccessibleContext.getAccessibleName();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Sets the accessible name of this object */
+ public void setAccessibleName(String name) {
+ // Not supported
+ }
+
+ /** Returns the accessible name of this object */
+ public String getAccessibleDescription() {
+ try {
+ return unoAccessibleContext.getAccessibleDescription();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Sets the accessible name of this object */
+ public void setAccessibleDescription(String name) {
+ // Not supported
+ }
+
+ /** Returns the accessible role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ try {
+ javax.accessibility.AccessibleRole role = AccessibleRoleAdapter.getAccessibleRole(
+ unoAccessibleContext.getAccessibleRole());
+ return (role != null) ? role : javax.accessibility.AccessibleRole.LABEL;
+ } catch(com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the locale of the component */
+ public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException {
+ try {
+ com.sun.star.lang.Locale unoLocale = unoAccessibleContext.getLocale();
+ return new java.util.Locale(unoLocale.Language, unoLocale.Country);
+ } catch (IllegalAccessibleComponentStateException e) {
+ throw new java.awt.IllegalComponentStateException(e.getMessage());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return List.this.getLocale();
+ }
+ }
+
+ /** Gets the 0-based index of this object in its accessible parent */
+ public int getAccessibleIndexInParent() {
+ try {
+ return unoAccessibleContext.getAccessibleIndexInParent();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the number of accessible children of the object. */
+ public int getAccessibleChildrenCount() {
+ try {
+ return unoAccessibleContext.getAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the specified Accessible child of the object. */
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = List.this.activeDescendant;
+ if ((activeDescendant instanceof ListItem) && ((ListItem) activeDescendant).unoAccessible.equals(xAccessible)) {
+ child = activeDescendant;
+ } else if (xAccessible != null) {
+ child = new ListItem(xAccessible);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /** Returns the state set of this object */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ try {
+ return AccessibleStateAdapter.getAccessibleStateSet(ListItem.this,
+ unoAccessibleContext.getAccessibleStateSet());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return AccessibleStateAdapter.getDefunctStateSet();
+ }
+ }
+
+ /** Gets the AccessibleComponent associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleComponent getAccessibleComponent() {
+ try {
+ XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
+ return (unoAccessibleComponent != null) ?
+ new AccessibleComponentImpl(unoAccessibleComponent) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleAction associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ try {
+ XAccessibleAction unoAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
+ return (unoAccessibleAction != null) ?
+ new AccessibleActionImpl(unoAccessibleAction) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleText associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText)
+ UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
+ return (unoAccessibleText != null) ?
+ new AccessibleTextImpl(unoAccessibleText) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleValue associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleValue getAccessibleValue() {
+ try {
+ XAccessibleValue unoAccessibleValue = (XAccessibleValue)
+ UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
+ return (unoAccessibleValue != null) ?
+ new AccessibleValueImpl(unoAccessibleValue) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
+ try {
+ XAccessibleImage unoAccessibleImage = (XAccessibleImage)
+ UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
+ if (unoAccessibleImage != null) {
+ javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) };
+ return icons;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return null;
+ }
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Menu.java b/accessibility/bridge/org/openoffice/java/accessibility/Menu.java
new file mode 100644
index 000000000000..346baca749b3
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Menu.java
@@ -0,0 +1,328 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+
+
+public class Menu extends AbstractButton
+ implements javax.accessibility.Accessible {
+ private java.util.Vector children;
+ protected XAccessibleSelection unoAccessibleSelection = null;
+
+ protected Menu(XAccessible xAccessible,
+ XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+
+ try {
+ // Create a vector with the correct initial capacity
+ int count = unoAccessibleContext.getAccessibleChildCount();
+ children = new java.util.Vector(count);
+
+ // Fill the vector with objects
+ for (int i = 0; i < count; i++) {
+ java.awt.Component c = getComponent(unoAccessibleContext.getAccessibleChild(i));
+
+ if (c != null) {
+ children.add(c);
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ if (Build.DEBUG) {
+ System.err.println(
+ "RuntimeException caught during menu initialization: " +
+ e.getMessage());
+ }
+
+ if (children == null) {
+ children = new java.util.Vector(0);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ }
+ }
+
+ protected synchronized void add(XAccessible unoAccessible) {
+ // The AccessBridge for Windows expects an instance of AccessibleContext
+ // as parameters
+ java.awt.Component c = getComponent(unoAccessible);
+
+ if (c != null) {
+ try {
+ children.add(unoAccessible.getAccessibleContext()
+ .getAccessibleIndexInParent(), c);
+ firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null,
+ ((javax.accessibility.Accessible) c).getAccessibleContext());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ }
+
+ protected synchronized void remove(XAccessible unoAccessible) {
+ // The AccessBridge for Windows expects an instance of AccessibleContext
+ // as parameters
+ java.awt.Component c = getComponent(unoAccessible);
+
+ if (c != null) {
+ try {
+ children.remove(c);
+ firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ ((javax.accessibility.Accessible) c).getAccessibleContext(),
+ null);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ }
+
+ protected void add(Object any) {
+ try {
+ add((XAccessible) AnyConverter.toObject(
+ AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected void remove(Object any) {
+ try {
+ remove((XAccessible) AnyConverter.toObject(
+ AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected synchronized int indexOf(Object child) {
+ return children.indexOf(child);
+ }
+
+ protected java.awt.Component getComponent(XAccessible unoAccessible) {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(unoAccessible);
+
+ if (c == null) {
+ c = AccessibleObjectFactory.createAccessibleComponent(unoAccessible);
+
+ if (c instanceof javax.accessibility.Accessible) {
+ ((javax.accessibility.Accessible) c).getAccessibleContext()
+ .setAccessibleParent(this);
+ }
+ }
+
+ return c;
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleMenuListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleMenu();
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleMenuListener
+ extends AccessibleUNOComponentListener {
+ protected AccessibleMenuListener() {
+ super();
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.CHILD:
+
+ if (AnyConverter.isObject(event.OldValue)) {
+ remove(event.OldValue);
+ }
+
+ if (AnyConverter.isObject(event.NewValue)) {
+ add(event.NewValue);
+ }
+
+ break;
+
+ // #i56539# Java 1.5 does not fire ACCESSIBLE_SELECTION_PROPERTY for menus
+ case AccessibleEventId.SELECTION_CHANGED:
+ break;
+
+ default:
+ super.notifyEvent(event);
+ }
+ }
+ }
+
+ protected class AccessibleMenu extends AccessibleAbstractButton
+ implements javax.accessibility.AccessibleSelection {
+ protected AccessibleMenu() {
+ unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
+ unoAccessibleContext);
+ }
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.MENU;
+ }
+
+ /** Gets the 0-based index of this object in its accessible parent */
+ public int getAccessibleIndexInParent() {
+ if (getAccessibleParent() instanceof Menu) {
+ return ((Menu) getAccessibleParent()).indexOf(Menu.this);
+ } else {
+ return super.getAccessibleIndexInParent();
+ }
+ }
+
+ /** Returns the number of accessible children of the object */
+ public synchronized int getAccessibleChildrenCount() {
+ return children.size();
+ }
+
+ /** Returns the specified Accessible child of the object */
+ public synchronized javax.accessibility.Accessible getAccessibleChild(
+ int i) {
+ try {
+ if (i < children.size()) {
+ return (javax.accessibility.Accessible) children.get(i);
+ } else {
+ return null;
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ return null;
+ }
+ }
+
+ /** Returns the AccessibleSelection interface for this object */
+ public javax.accessibility.AccessibleSelection getAccessibleSelection() {
+ // This method is called to determine the SELECTABLE state of every
+ // child, so don't do the query interface here.
+ return this;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ try {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(unoAccessibleComponent.getAccessibleAtPoint(
+ new com.sun.star.awt.Point(p.x, p.y)));
+
+ return (javax.accessibility.Accessible) c;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /*
+ * AccessibleSelection
+ */
+
+ /** Returns an Accessible representing the specified selected child of the object */
+ public javax.accessibility.Accessible getAccessibleSelection(int i) {
+ try {
+ return (javax.accessibility.Accessible) getComponent(unoAccessibleSelection.getSelectedAccessibleChild(
+ i));
+ } catch (java.lang.Exception e) {
+ /*
+ * Possible exceptions are:
+ * java.lang.NullPointerException
+ * com.sun.star.uno.RuntimeException
+ * com.sun.star.lang.IndexOutOfBoundsException
+ */
+ return null;
+ }
+ }
+
+ /** Adds the specified Accessible child of the object to the object's selection */
+ public void addAccessibleSelection(int i) {
+ try {
+ javax.accessibility.Accessible a = getAccessibleChild(i);
+
+ // selecting menu items invokes the click action in Java 1.5
+ if( a instanceof MenuItem )
+ a.getAccessibleContext().getAccessibleAction().doAccessibleAction(0);
+ else
+ unoAccessibleSelection.selectAccessibleChild(i);
+ } catch (java.lang.Exception e) {
+ /*
+ * Possible exceptions are:
+ * java.lang.NullPointerException
+ * com.sun.star.uno.RuntimeException
+ * com.sun.star.lang.IndexOutOfBoundsException
+ */
+ }
+ }
+
+ /** Clears the selection in the object, so that no children in the object are selected */
+ public void clearAccessibleSelection() {
+ try {
+ unoAccessibleSelection.clearAccessibleSelection();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Returns the number of Accessible children currently selected */
+ public int getAccessibleSelectionCount() {
+ try {
+ return unoAccessibleSelection.getSelectedAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Determines if the current child of this object is selected */
+ public boolean isAccessibleChildSelected(int i) {
+ try {
+ return unoAccessibleSelection.isAccessibleChildSelected(i);
+ } catch (java.lang.Exception e) {
+ /*
+ * Possible exceptions are:
+ * java.lang.NullPointerException
+ * com.sun.star.uno.RuntimeException
+ * com.sun.star.lang.IndexOutOfBoundsException
+ */
+ return false;
+ }
+ }
+
+ /** Removes the specified child of the object from the object's selection */
+ public void removeAccessibleSelection(int i) {
+ if (isAccessibleChildSelected(i)) {
+ clearAccessibleSelection();
+ }
+ }
+
+ /** Causes every child of the object to be selected if the object supports multiple selection */
+ public void selectAllAccessibleSelection() {
+ // not supported
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java b/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java
new file mode 100644
index 000000000000..ccae0ccadd04
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/MenuContainer.java
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleContext;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+/**
+ * Specialized container for MenuBar and Popup-Menu(s)
+ * FIXME: join with Menu ?
+ */
+public class MenuContainer extends Container implements javax.accessibility.Accessible {
+
+ protected XAccessibleSelection unoAccessibleSelection = null;
+
+ protected MenuContainer(javax.accessibility.AccessibleRole role, XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(role, xAccessible, xAccessibleContext);
+ }
+
+ protected class AccessibleMenuContainerListener extends AccessibleContainerListener {
+
+ protected AccessibleMenuContainerListener() {
+ super();
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+
+ // #i56539# Java 1.5 does not fire ACCESSIBLE_SELECTION_PROPERTY for menus
+ case AccessibleEventId.SELECTION_CHANGED:
+ break;
+
+ default:
+ super.notifyEvent(event);
+ }
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleMenuContainerListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleMenuContainer();
+ }
+
+ protected class AccessibleMenuContainer extends AccessibleContainer implements javax.accessibility.AccessibleSelection {
+
+ protected AccessibleMenuContainer() {
+ unoAccessibleSelection = (XAccessibleSelection) UnoRuntime.queryInterface(XAccessibleSelection.class,
+ unoAccessibleContext);
+ }
+
+ /** Returns the AccessibleSelection interface for this object */
+ public javax.accessibility.AccessibleSelection getAccessibleSelection() {
+ return this;
+ }
+
+ /*
+ * AccessibleSelection
+ */
+
+ /** Returns an Accessible representing the specified selected child of the object */
+ public javax.accessibility.Accessible getAccessibleSelection(int i) {
+ try {
+ return (javax.accessibility.Accessible) AccessibleObjectFactory.getAccessibleComponent(
+ unoAccessibleSelection.getSelectedAccessibleChild(i));
+ } catch (com.sun.star.uno.Exception e) {
+ return null;
+ }
+ }
+
+ /** Adds the specified Accessible child of the object to the object's selection */
+ public void addAccessibleSelection(int i) {
+ try {
+ javax.accessibility.Accessible a = getAccessibleChild(i);
+
+ // selecting menu items invokes the click action in Java 1.5
+ if( a instanceof MenuItem )
+ a.getAccessibleContext().getAccessibleAction().doAccessibleAction(0);
+ else
+ unoAccessibleSelection.selectAccessibleChild(i);
+ } catch (java.lang.Exception e) {
+ /*
+ * Possible exceptions are:
+ * java.lang.NullPointerException
+ * com.sun.star.uno.RuntimeException
+ * com.sun.star.lang.IndexOutOfBoundsException
+ */
+ }
+ }
+
+ /** Clears the selection in the object, so that no children in the object are selected */
+ public void clearAccessibleSelection() {
+ try {
+ unoAccessibleSelection.clearAccessibleSelection();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Returns the number of Accessible children currently selected */
+ public int getAccessibleSelectionCount() {
+ try {
+ return unoAccessibleSelection.getSelectedAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Determines if the current child of this object is selected */
+ public boolean isAccessibleChildSelected(int i) {
+ try {
+ return unoAccessibleSelection.isAccessibleChildSelected(i);
+ } catch (java.lang.Exception e) {
+ /*
+ * Possible exceptions are:
+ * java.lang.NullPointerException
+ * com.sun.star.uno.RuntimeException
+ * com.sun.star.lang.IndexOutOfBoundsException
+ */
+ return false;
+ }
+ }
+
+ /** Removes the specified child of the object from the object's selection */
+ public void removeAccessibleSelection(int i) {
+ if (isAccessibleChildSelected(i)) {
+ clearAccessibleSelection();
+ }
+ }
+
+ /** Causes every child of the object to be selected if the object supports multiple selection */
+ public void selectAllAccessibleSelection() {
+ // not supported
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java b/accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java
new file mode 100644
index 000000000000..39aa1b73ce30
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/MenuItem.java
@@ -0,0 +1,99 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEventListener;
+
+
+class MenuItem extends ToggleButton {
+ public MenuItem(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ protected class AccessibleMenuItemListener extends AccessibleUNOComponentListener {
+
+ protected AccessibleMenuItemListener() {
+ }
+
+ protected void setComponentState(short state, boolean enable) {
+
+ // #i56538# menu items in Java 1.5 are ARMED, not SELECTED
+ if( state == com.sun.star.accessibility.AccessibleStateType.SELECTED )
+ fireStatePropertyChange(javax.accessibility.AccessibleState.ARMED, enable);
+ else
+ super.setComponentState(state, enable);
+ }
+ };
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleMenuItemListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleMenuItem();
+ }
+
+ protected class AccessibleMenuItem extends AccessibleToggleButton {
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.MENU_ITEM;
+ }
+
+ /** Gets the 0-based index of this object in its accessible parent */
+ public int getAccessibleIndexInParent() {
+ if (getAccessibleParent() instanceof Menu) {
+ return ((Menu) getAccessibleParent()).indexOf(MenuItem.this);
+ } else {
+ return super.getAccessibleIndexInParent();
+ }
+ }
+
+ /**
+ * Gets the current state set of this object.
+ *
+ * @return an instance of <code>AccessibleStateSet</code>
+ * containing the current state set of the object
+ * @see AccessibleState
+ */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ javax.accessibility.AccessibleStateSet stateSet = super.getAccessibleStateSet();
+
+ // #i56538# menu items in Java do not have SELECTABLE ..
+ stateSet.remove(javax.accessibility.AccessibleState.SELECTABLE);
+
+ // .. and also ARMED insted of SELECTED
+ if( stateSet.remove(javax.accessibility.AccessibleState.SELECTED) )
+ stateSet.add(javax.accessibility.AccessibleState.ARMED);
+
+ return stateSet;
+ }
+
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java b/accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java
new file mode 100644
index 000000000000..bcc4c0dddebc
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/NativeFrame.java
@@ -0,0 +1,35 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+public interface NativeFrame {
+ public java.awt.Component getInitialComponent();
+ public void setInitialComponent(java.awt.Component c);
+// public Integer getHWND();
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java b/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java
new file mode 100644
index 000000000000..6088bf48eabe
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Paragraph.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleText;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+/**
+ */
+public class Paragraph extends Container implements javax.accessibility.Accessible {
+
+ protected Paragraph(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(javax.accessibility.AccessibleRole.TEXT, xAccessible, xAccessibleContext);
+ }
+
+ protected class AccessibleParagraphListener extends AccessibleContainerListener {
+
+ protected AccessibleParagraphListener() {
+ super();
+ }
+
+ protected void setComponentState(short state, boolean enable) {
+ switch (state) {
+ case AccessibleStateType.EDITABLE:
+ fireStatePropertyChange(javax.accessibility.AccessibleState.EDITABLE, enable);
+ break;
+ case AccessibleStateType.MULTI_LINE:
+ fireStatePropertyChange(javax.accessibility.AccessibleState.MULTI_LINE, enable);
+ break;
+ case AccessibleStateType.SINGLE_LINE:
+ break;
+ default:
+ super.setComponentState(state, enable);
+ break;
+ }
+ }
+
+
+ protected void handleVisibleDataChanged() {
+ if (Paragraph.this.isFocusOwner()) {
+ AccessibleContext ac = accessibleContext;
+ if (ac != null) {
+ AccessibleText at = ac.getAccessibleText();
+ if (at != null) {
+ int pos = at.getCaretPosition();
+ // Simulating a caret event here should help at tools
+ // that re not aware of the paragraph approach of OOo.
+ firePropertyChange(ac.ACCESSIBLE_CARET_PROPERTY,
+ new Integer(-1), new Integer(pos));
+ }
+ }
+ }
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.CARET_CHANGED:
+ firePropertyChange(accessibleContext.ACCESSIBLE_CARET_PROPERTY,
+ Component.toNumber(event.OldValue),
+ Component.toNumber(event.NewValue));
+ break;
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ // Whenever a paragraph gets inserted above the currently
+ // focused one, this is the only event that will occur for.
+ handleVisibleDataChanged();
+ default:
+ super.notifyEvent(event);
+ break;
+ }
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleParagraphListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleParagraph();
+ }
+
+ protected class AccessibleParagraph extends AccessibleContainer {
+
+ protected AccessibleParagraph() {
+ // Don't do the queryInterface on XAccessibleText already ..
+ super(false);
+ /* Since getAccessibleText() is heavily used by the java access
+ * bridge for gnome and the gnome at-tools, we do a query interface
+ * here and remember the result.
+ */
+ accessibleText = AccessibleHypertextImpl.get(unoAccessibleContext);
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.TEXT;
+ }
+
+ /** Gets the AccessibleEditableText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleEditableText getAccessibleEditableText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText)
+ UnoRuntime.queryInterface(XAccessibleEditableText.class,
+ unoAccessibleComponent);
+ if (unoAccessibleText != null) {
+ return new AccessibleEditableTextImpl(unoAccessibleText);
+ } else {
+ return null;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleAction associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ try {
+ XAccessibleAction unoAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
+ return (unoAccessibleAction != null) ?
+ new AccessibleActionImpl(unoAccessibleAction) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the relation set of this object */
+ public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() {
+ try {
+ XAccessibleRelationSet unoAccessibleRelationSet =
+ unoAccessible.getAccessibleContext().getAccessibleRelationSet();
+ if (unoAccessibleRelationSet == null) {
+ return super.getAccessibleRelationSet();
+ }
+
+ javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet();
+ int count = unoAccessibleRelationSet.getRelationCount();
+ for (int i = 0; i < count; i++) {
+ AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i);
+ switch (unoAccessibleRelation.RelationType) {
+ case AccessibleRelationType.CONTROLLED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.CONTROLLED_BY,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.CONTROLLER_FOR:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.CONTROLLER_FOR,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.LABELED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABELED_BY,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.MEMBER_OF:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.CONTENT_FLOWS_TO:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ "flowsTo",
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.CONTENT_FLOWS_FROM:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ "flowsFrom",
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ default:
+ break;
+ }
+ }
+ return relationSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return super.getAccessibleRelationSet();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return super.getAccessibleRelationSet();
+ }
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java b/accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java
new file mode 100644
index 000000000000..3daeee6cd8de
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/RadioButton.java
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+
+class RadioButton extends ToggleButton {
+ public RadioButton(XAccessible xAccessible,
+ XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleRadioButton();
+ }
+
+ protected class AccessibleRadioButton extends AccessibleToggleButton {
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.RADIO_BUTTON;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java b/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java
new file mode 100644
index 000000000000..83b17d698201
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/ScrollBar.java
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+import javax.swing.SwingConstants;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+/**
+ */
+public class ScrollBar extends Component implements SwingConstants, javax.accessibility.Accessible {
+
+ public ScrollBar(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleScrollBar();
+ }
+
+ protected class AccessibleScrollBar extends AccessibleUNOComponent implements
+ javax.accessibility.AccessibleAction {
+
+ protected XAccessibleAction unoAccessibleAction;
+ protected int actionCount = 0;
+
+ /**
+ * Though the class is abstract, this should be called by all sub-classes
+ */
+ protected AccessibleScrollBar() {
+ super();
+ unoAccessibleAction = (XAccessibleAction) UnoRuntime.queryInterface(
+ XAccessibleAction.class, unoAccessibleContext);
+ if (unoAccessibleAction != null) {
+ actionCount = unoAccessibleAction.getAccessibleActionCount();
+ }
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.SCROLL_BAR;
+ }
+
+ /** Gets the AccessibleValue associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleValue getAccessibleValue() {
+ try {
+ XAccessibleValue unoAccessibleValue = (XAccessibleValue)
+ UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
+ return (unoAccessibleValue != null) ?
+ new AccessibleValueImpl(unoAccessibleValue) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleAction associated with this object that supports one or more actions */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ return this;
+ }
+
+ /*
+ * AccessibleAction
+ */
+
+ /** Performs the specified Action on the object */
+ public boolean doAccessibleAction(int param) {
+ if (param < actionCount) {
+ try {
+ return unoAccessibleAction.doAccessibleAction(param);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ }
+ }
+ return false;
+ }
+
+ /** Returns a description of the specified action of the object */
+ public java.lang.String getAccessibleActionDescription(int param) {
+ if(param < actionCount) {
+ try {
+ return unoAccessibleAction.getAccessibleActionDescription(param);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ }
+ }
+ return null;
+ }
+
+ /** Returns the number of accessible actions available in this object */
+ public int getAccessibleActionCount() {
+ return actionCount;
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Separator.java b/accessibility/bridge/org/openoffice/java/accessibility/Separator.java
new file mode 100644
index 000000000000..892768e07cbb
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Separator.java
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
+import javax.swing.SwingConstants;
+
+
+/**
+ */
+public class Separator extends Component implements SwingConstants,
+ javax.accessibility.Accessible {
+
+ public Separator(XAccessible xAccessible,
+ XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ setFocusable(false);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleSeparator();
+ }
+
+ protected class AccessibleSeparator extends AccessibleUNOComponent {
+ /**
+ * Though the class is abstract, this should be called by all sub-classes
+ */
+ protected AccessibleSeparator() {
+ super();
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.SEPARATOR;
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Table.java b/accessibility/bridge/org/openoffice/java/accessibility/Table.java
new file mode 100644
index 000000000000..24ea912d4217
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Table.java
@@ -0,0 +1,727 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleState;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.*;
+
+public class Table extends DescendantManager implements javax.accessibility.Accessible {
+
+ protected Table(XAccessible xAccessible, XAccessibleContext xAccessibleContext, boolean multiselectable) {
+ super(xAccessible, xAccessibleContext, multiselectable);
+ }
+
+ protected void setActiveDescendant(javax.accessibility.Accessible descendant) {
+ javax.accessibility.Accessible oldAD = activeDescendant;
+ activeDescendant = descendant;
+ firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
+ oldAD, descendant);
+ }
+
+ protected void setActiveDescendant(Object any) {
+ javax.accessibility.Accessible descendant = null;
+ try {
+ if (AnyConverter.isObject(any)) {
+ XAccessible unoAccessible = (XAccessible) AnyConverter.toObject(
+ AccessibleObjectFactory.XAccessibleType, any);
+ if (unoAccessible != null) {
+ // FIXME: have to handle non transient objects here ..
+ descendant = new TableCell(unoAccessible);
+ }
+ }
+ setActiveDescendant(descendant);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected void add(XAccessible unoAccessible) {
+ if (unoAccessible != null) {
+ TableCell cell = new TableCell(unoAccessible);
+ // The AccessBridge for Windows expects an instance of AccessibleContext
+ // as parameters
+ firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null, cell.getAccessibleContext());
+ }
+ }
+
+ protected void remove(XAccessible unoAccessible) {
+ if (unoAccessible != null) {
+ TableCell cell = new TableCell(unoAccessible);
+ // The AccessBridge for Windows expects an instance of AccessibleContext
+ // as parameters
+ firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ cell.getAccessibleContext(), null);
+ }
+ }
+
+ protected void add(Object any) {
+ try {
+ add((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected void remove(Object any) {
+ try {
+ remove((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleTableListener extends AccessibleDescendantManagerListener {
+
+ protected AccessibleTableListener() {
+ super();
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED:
+ setActiveDescendant(event.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ if (AnyConverter.isObject(event.OldValue)) {
+ remove(event.OldValue);
+ }
+ if (AnyConverter.isObject(event.NewValue)) {
+ add(event.NewValue);
+ }
+ break;
+ default:
+ super.notifyEvent(event);
+ }
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleTableListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleTable();
+ }
+
+ protected class AccessibleTable extends AccessibleDescendantManager implements javax.accessibility.AccessibleExtendedTable {
+
+ protected XAccessibleTable unoAccessibleTable;
+
+ public AccessibleTable() {
+ unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext);
+ }
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.TABLE;
+ }
+
+ /** Returns the AccessibleTable interface of this object */
+ public javax.accessibility.AccessibleTable getAccessibleTable() {
+ return this;
+ }
+
+ /** Returns the specified Accessible child of the object */
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant;
+ if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TableCell(xAccessible);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleComponent.getAccessibleAtPoint(
+ new com.sun.star.awt.Point(p.x, p.y));
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant;
+ if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TableCell(xAccessible);
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /*
+ * AccessibleSelection
+ */
+
+ /** Returns an Accessible representing the specified selected child of the object */
+ public javax.accessibility.Accessible getAccessibleSelection(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleSelection.getSelectedAccessibleChild(i);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant;
+ if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TableCell(xAccessible);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /*
+ * AccessibleTable
+ */
+
+ /** Returns the Accessible at a specified row and column in the table. */
+ public javax.accessibility.Accessible getAccessibleAt(int r, int c) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleTable.getAccessibleCellAt(r,c);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant;
+ if ((activeDescendant instanceof TableCell) && xAccessible.equals(((TableCell) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TableCell(xAccessible);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /** Returns the caption for the table. */
+ public javax.accessibility.Accessible getAccessibleCaption() {
+ // Not yet supported.
+ return null;
+ }
+
+ /** Returns the number of columns in the table. */
+ public int getAccessibleColumnCount() {
+ try {
+ return unoAccessibleTable.getAccessibleColumnCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the description text of the specified column in the table. */
+ public javax.accessibility.Accessible getAccessibleColumnDescription(int c) {
+ try {
+ return new javax.swing.JLabel(
+ unoAccessibleTable.getAccessibleColumnDescription(c));
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the number of columns occupied by the Accessible
+ * at a specified row and column in the table.
+ */
+ public int getAccessibleColumnExtentAt(int r, int c) {
+ try {
+ return unoAccessibleTable.getAccessibleColumnExtentAt(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return 0;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the column headers as an AccessibleTable. */
+ public javax.accessibility.AccessibleTable getAccessibleColumnHeader() {
+ // Not yet supported
+ return null;
+ }
+
+ /** Returns the number of rows in the table. */
+ public int getAccessibleRowCount() {
+ try {
+ return unoAccessibleTable.getAccessibleRowCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the description of the specified row in the table. */
+ public javax.accessibility.Accessible getAccessibleRowDescription(int r) {
+ try {
+ return new javax.swing.JLabel(
+ unoAccessibleTable.getAccessibleRowDescription(r));
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the number of rows occupied by the Accessible
+ * at a specified row and column in the table.
+ */
+ public int getAccessibleRowExtentAt(int r, int c) {
+ try {
+ return unoAccessibleTable.getAccessibleRowExtentAt(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return 0;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the row headers as an AccessibleTable. */
+ public javax.accessibility.AccessibleTable getAccessibleRowHeader() {
+ // Not yet supported
+ return null;
+ }
+
+ /** Returns the summary description of the table. */
+ public javax.accessibility.Accessible getAccessibleSummary() {
+ // Not yet supported.
+ return null;
+ }
+
+ /** Returns the selected columns in a table. */
+ public int[] getSelectedAccessibleColumns() {
+ try {
+ return unoAccessibleTable.getSelectedAccessibleColumns();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the selected rows in a table. */
+ public int[] getSelectedAccessibleRows() {
+ try {
+ return unoAccessibleTable.getSelectedAccessibleRows();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns a boolean value indicating whether the specified column is selected. */
+ public boolean isAccessibleColumnSelected(int c) {
+ try {
+ return unoAccessibleTable.isAccessibleColumnSelected(c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns a boolean value indicating whether the specified row is selected. */
+ public boolean isAccessibleRowSelected(int r) {
+ try {
+ return unoAccessibleTable.isAccessibleRowSelected(r);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Returns a boolean value indicating whether the accessible
+ * at a specified row and column is selected.
+ */
+ public boolean isAccessibleSelected(int r, int c) {
+ try {
+ return unoAccessibleTable.isAccessibleSelected(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Sets the caption for the table. */
+ public void setAccessibleCaption(javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the description text of the specified column in the table. */
+ public void setAccessibleColumnDescription(int param, javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the column headers. */
+ public void setAccessibleColumnHeader(javax.accessibility.AccessibleTable accessibleTable) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the description text of the specified row of the table. */
+ public void setAccessibleRowDescription(int param, javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the row headers. */
+ public void setAccessibleRowHeader(javax.accessibility.AccessibleTable accessibleTable) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the summary description of the table */
+ public void setAccessibleSummary(javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Returns the column number of an index in the table */
+ public int getAccessibleColumn(int index) {
+ try {
+ return unoAccessibleTable.getAccessibleColumn(index);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return -1;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the index of a specified row and column in the table. */
+ public int getAccessibleIndex(int r, int c) {
+ try {
+ return unoAccessibleTable.getAccessibleIndex(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return -1;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the row number of an index in the table */
+ public int getAccessibleRow(int index) {
+ try {
+ return unoAccessibleTable.getAccessibleRow(index);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return -1;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+ }
+
+ class TableCell extends java.awt.Component implements javax.accessibility.Accessible {
+
+ protected XAccessible unoAccessible;
+
+ public TableCell(XAccessible xAccessible) {
+ unoAccessible = xAccessible;
+ }
+
+ public Object[] create(Object[] targetSet) {
+ try {
+ java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
+ for (int i=0; i < targetSet.length; i++) {
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, targetSet[i]);
+ if (xAccessible != null) {
+ list.add(new TableCell(xAccessible));
+ }
+ }
+ list.trimToSize();
+ return list.toArray();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ try {
+ XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
+ if (xAccessibleContext != null) {
+ javax.accessibility.AccessibleContext ac = new AccessibleTableCell(xAccessibleContext);
+ if (ac != null) {
+ ac.setAccessibleParent(Table.this);
+ accessibleContext = ac;
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleTableCell extends javax.accessibility.AccessibleContext {
+
+ XAccessibleContext unoAccessibleContext;
+
+ public AccessibleTableCell(XAccessibleContext xAccessibleContext) {
+ unoAccessibleContext = xAccessibleContext;
+ }
+
+ /** Returns the accessible name of this object */
+ public String getAccessibleName() {
+ try {
+ return unoAccessibleContext.getAccessibleName();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Sets the accessible name of this object */
+ public void setAccessibleName(String name) {
+ // Not supported
+ }
+
+ /** Returns the accessible name of this object */
+ public String getAccessibleDescription() {
+ try {
+ return unoAccessibleContext.getAccessibleDescription();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Sets the accessible name of this object */
+ public void setAccessibleDescription(String name) {
+ // Not supported
+ }
+
+ /** Returns the accessible role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ try {
+ javax.accessibility.AccessibleRole role = AccessibleRoleAdapter.getAccessibleRole(
+ unoAccessibleContext.getAccessibleRole());
+ return (role != null) ? role : javax.accessibility.AccessibleRole.LABEL;
+ } catch(com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the locale of the component */
+ public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException {
+ try {
+ com.sun.star.lang.Locale unoLocale = unoAccessibleContext.getLocale();
+ return new java.util.Locale(unoLocale.Language, unoLocale.Country);
+ } catch (IllegalAccessibleComponentStateException e) {
+ throw new java.awt.IllegalComponentStateException(e.getMessage());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return Table.this.getLocale();
+ }
+ }
+
+ /** Gets the 0-based index of this object in its accessible parent */
+ public int getAccessibleIndexInParent() {
+ try {
+ return unoAccessibleContext.getAccessibleIndexInParent();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the number of accessible children of the object. */
+ public int getAccessibleChildrenCount() {
+ try {
+ return unoAccessibleContext.getAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the specified Accessible child of the object. */
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Table.this.activeDescendant;
+ if ((activeDescendant instanceof TableCell) && ((TableCell) activeDescendant).unoAccessible.equals(xAccessible)) {
+ child = activeDescendant;
+ } else if (xAccessible != null) {
+ child = new TableCell(xAccessible);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /** Returns the state set of this object */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ try {
+ return AccessibleStateAdapter.getAccessibleStateSet(TableCell.this,
+ unoAccessibleContext.getAccessibleStateSet());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return AccessibleStateAdapter.getDefunctStateSet();
+ }
+ }
+
+ /** Returns the relation set of this object */
+ public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() {
+ try {
+ XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet();
+ if (unoAccessibleRelationSet == null) {
+ return null;
+ }
+
+ javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet();
+ int count = unoAccessibleRelationSet.getRelationCount();
+ for (int i = 0; i < count; i++) {
+ AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i);
+ switch (unoAccessibleRelation.RelationType) {
+ case AccessibleRelationType.CONTROLLED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.CONTROLLED_BY,
+ create(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.CONTROLLER_FOR:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.CONTROLLER_FOR,
+ create(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.LABELED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABELED_BY,
+ create(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.LABEL_FOR:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABEL_FOR,
+ create(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.MEMBER_OF:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ create(unoAccessibleRelation.TargetSet)));
+ break;
+ default:
+ break;
+ }
+ }
+ return relationSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleComponent associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleComponent getAccessibleComponent() {
+ try {
+ XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
+ return (unoAccessibleComponent != null) ?
+ new AccessibleComponentImpl(unoAccessibleComponent) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleAction associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ try {
+ XAccessibleAction unoAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
+ return (unoAccessibleAction != null) ?
+ new AccessibleActionImpl(unoAccessibleAction) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleText associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText)
+ UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
+ return (unoAccessibleText != null) ?
+ new AccessibleTextImpl(unoAccessibleText) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleValue associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleValue getAccessibleValue() {
+ try {
+ XAccessibleValue unoAccessibleValue = (XAccessibleValue)
+ UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
+ return (unoAccessibleValue != null) ?
+ new AccessibleValueImpl(unoAccessibleValue) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
+ try {
+ XAccessibleImage unoAccessibleImage = (XAccessibleImage)
+ UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
+ if (unoAccessibleImage != null) {
+ javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) };
+ return icons;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return null;
+ }
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java b/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java
new file mode 100644
index 000000000000..a142297c4c12
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/TextComponent.java
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.*;
+
+/**
+ */
+public class TextComponent extends Component implements javax.accessibility.Accessible {
+
+ protected TextComponent(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ protected class AccessibleTextComponentListener extends AccessibleUNOComponentListener {
+
+ protected AccessibleTextComponentListener() {
+ super();
+ }
+
+ protected void setComponentState(short state, boolean enable) {
+ switch (state) {
+ case AccessibleStateType.EDITABLE:
+ fireStatePropertyChange(javax.accessibility.AccessibleState.EDITABLE, enable);
+ break;
+ case AccessibleStateType.MULTI_LINE:
+ fireStatePropertyChange(javax.accessibility.AccessibleState.MULTI_LINE, enable);
+ break;
+ case AccessibleStateType.SINGLE_LINE:
+ break;
+ default:
+ super.setComponentState(state, enable);
+ break;
+ }
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleTextComponentListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleTextComponent();
+ }
+
+ protected class AccessibleTextComponent extends AccessibleUNOComponent {
+
+ /**
+ * Though the class is abstract, this should be called by all sub-classes
+ */
+ protected AccessibleTextComponent() {
+ super();
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.TEXT;
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText)
+ UnoRuntime.queryInterface(XAccessibleText.class,unoAccessibleComponent);
+ if (unoAccessibleText != null) {
+ return new AccessibleTextImpl(unoAccessibleText);
+ } else {
+ return null;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleEditableText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleEditableText getAccessibleEditableText() {
+ try {
+ XAccessibleEditableText unoAccessibleText = (XAccessibleEditableText)
+ UnoRuntime.queryInterface(XAccessibleEditableText.class,unoAccessibleComponent);
+ if (unoAccessibleText != null) {
+ return new AccessibleEditableTextImpl(unoAccessibleText);
+ } else {
+ return null;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleAction associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ try {
+ XAccessibleAction unoAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleComponent);
+ return (unoAccessibleAction != null) ?
+ new AccessibleActionImpl(unoAccessibleAction) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the relation set of this object */
+ public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() {
+ try {
+ XAccessibleRelationSet unoAccessibleRelationSet =
+ unoAccessible.getAccessibleContext().getAccessibleRelationSet();
+ if (unoAccessibleRelationSet == null) {
+ return super.getAccessibleRelationSet();
+ }
+
+ javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet();
+ int count = unoAccessibleRelationSet.getRelationCount();
+ for (int i = 0; i < count; i++) {
+ AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i);
+ switch (unoAccessibleRelation.RelationType) {
+ case AccessibleRelationType.CONTROLLED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.CONTROLLED_BY,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.CONTROLLER_FOR:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.CONTROLLER_FOR,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.LABELED_BY:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABELED_BY,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.MEMBER_OF:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.CONTENT_FLOWS_TO:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ "flowsTo",
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.CONTENT_FLOWS_FROM:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ "flowsFrom",
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ default:
+ break;
+ }
+ }
+ return relationSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return super.getAccessibleRelationSet();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return super.getAccessibleRelationSet();
+ }
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java b/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java
new file mode 100644
index 000000000000..bac8035a2ece
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/ToggleButton.java
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+
+class ToggleButton extends AbstractButton implements javax.accessibility.Accessible {
+ public ToggleButton(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleToggleButton();
+ }
+
+ protected class AccessibleToggleButton extends AccessibleAbstractButton {
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.TOGGLE_BUTTON;
+ }
+
+ /** Gets the AccessibleValue associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleValue getAccessibleValue() {
+ try {
+ XAccessibleValue unoAccessibleValue = (XAccessibleValue) UnoRuntime.queryInterface(XAccessibleValue.class,
+ unoAccessibleContext);
+
+ return (unoAccessibleValue != null)
+ ? new AccessibleValueImpl(unoAccessibleValue) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java b/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java
new file mode 100644
index 000000000000..071a6a37fd98
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/ToolTip.java
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package org.openoffice.java.accessibility;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
+
+
+/**
+ */
+public class ToolTip extends Component implements javax.accessibility.Accessible {
+ protected ToolTip(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleToolTip();
+ }
+
+ protected class AccessibleToolTip extends AccessibleUNOComponent {
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.TOOL_TIP;
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText) UnoRuntime.queryInterface(XAccessibleText.class,
+ unoAccessibleComponent);
+
+ if (unoAccessibleText != null) {
+ return new AccessibleTextImpl(unoAccessibleText);
+ } else {
+ return null;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the relation set of this object */
+
+ /*
+ public javax.accessibility.AccessibleRelationSet getAccessibleRelationSet() {
+ try {
+ XAccessibleRelationSet unoAccessibleRelationSet = unoAccessibleContext.getAccessibleRelationSet();
+ if (unoAccessibleRelationSet == null) {
+ return null;
+ }
+
+ javax.accessibility.AccessibleRelationSet relationSet = new javax.accessibility.AccessibleRelationSet();
+ int count = unoAccessibleRelationSet.getRelationCount();
+ for (int i = 0; i < count; i++) {
+ AccessibleRelation unoAccessibleRelation = unoAccessibleRelationSet.getRelation(i);
+ switch (unoAccessibleRelation.RelationType) {
+ case AccessibleRelationType.LABEL_FOR:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.LABEL_FOR,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ case AccessibleRelationType.MEMBER_OF:
+ relationSet.add(new javax.accessibility.AccessibleRelation(
+ javax.accessibility.AccessibleRelation.MEMBER_OF,
+ getAccessibleComponents(unoAccessibleRelation.TargetSet)));
+ break;
+ default:
+ break;
+ }
+ }
+ return relationSet;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+ */
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Tree.java b/accessibility/bridge/org/openoffice/java/accessibility/Tree.java
new file mode 100644
index 000000000000..5fdd5a196397
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Tree.java
@@ -0,0 +1,768 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleState;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.*;
+
+public class Tree extends DescendantManager implements javax.accessibility.Accessible {
+
+ protected Tree(XAccessible xAccessible, XAccessibleContext xAccessibleContext) {
+ super(xAccessible, xAccessibleContext);
+ }
+
+ protected void setActiveDescendant(javax.accessibility.Accessible descendant) {
+ javax.accessibility.Accessible oldAD = activeDescendant;
+ activeDescendant = descendant;
+ firePropertyChange(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY,
+ oldAD, descendant);
+ }
+
+ protected void setActiveDescendant(Object any) {
+ javax.accessibility.Accessible descendant = null;
+ try {
+ if (AnyConverter.isObject(any)) {
+ XAccessible unoAccessible = (XAccessible) AnyConverter.toObject(
+ AccessibleObjectFactory.XAccessibleType, any);
+ if (unoAccessible != null) {
+ // FIXME: have to handle non transient objects here ..
+ descendant = new TreeItem(unoAccessible);
+ }
+ }
+ setActiveDescendant(descendant);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected void add(XAccessible unoAccessible) {
+ if (unoAccessible != null) {
+ firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null, new TreeItem(unoAccessible));
+ }
+ }
+
+ protected void remove(XAccessible unoAccessible) {
+ if (unoAccessible != null) {
+ firePropertyChange(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ new TreeItem(unoAccessible), null);
+ }
+ }
+
+ protected void add(Object any) {
+ try {
+ add((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ protected void remove(Object any) {
+ try {
+ remove((XAccessible) AnyConverter.toObject(AccessibleObjectFactory.XAccessibleType, any));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleTreeListener extends AccessibleDescendantManagerListener {
+
+ protected AccessibleTreeListener() {
+ super();
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED:
+ setActiveDescendant(event.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ if (AnyConverter.isObject(event.OldValue)) {
+ remove(event.OldValue);
+ }
+ if (AnyConverter.isObject(event.NewValue)) {
+ add(event.NewValue);
+ }
+ break;
+
+ case AccessibleEventId.LISTBOX_ENTRY_EXPANDED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ AccessibleState.COLLAPSED, AccessibleState.EXPANDED);
+ break;
+
+ case AccessibleEventId.LISTBOX_ENTRY_COLLAPSED:
+ firePropertyChange(AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ AccessibleState.EXPANDED, AccessibleState.COLLAPSED);
+ break;
+
+ default:
+ super.notifyEvent(event);
+ }
+ }
+ }
+
+ protected XAccessibleEventListener createEventListener() {
+ return new AccessibleTreeListener();
+ }
+
+ /** Creates the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext createAccessibleContext() {
+ return new AccessibleTree();
+ }
+
+ protected class AccessibleTree extends AccessibleDescendantManager implements javax.accessibility.AccessibleExtendedTable {
+
+ protected XAccessibleTable unoAccessibleTable;
+
+ public AccessibleTree() {
+ unoAccessibleTable = (XAccessibleTable) UnoRuntime.queryInterface(XAccessibleTable.class, unoAccessibleContext);
+ }
+
+ /*
+ * AccessibleContext
+ */
+
+ /** Gets the role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ return javax.accessibility.AccessibleRole.TREE;
+ }
+
+ /** Returns the AccessibleTable interface of this object */
+ public javax.accessibility.AccessibleTable getAccessibleTable() {
+ return ( unoAccessibleTable != null ) ? this : null;
+ }
+
+ /** Returns the specified Accessible child of the object */
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant;
+ if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TreeItem(xAccessible);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleComponent.getAccessibleAtPoint(
+ new com.sun.star.awt.Point(p.x, p.y));
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant;
+ if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TreeItem(xAccessible);
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /*
+ * AccessibleSelection
+ */
+
+ /** Returns an Accessible representing the specified selected child of the object */
+ public javax.accessibility.Accessible getAccessibleSelection(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant;
+ if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TreeItem(xAccessible);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /*
+ * AccessibleTable
+ */
+
+ /** Returns the Accessible at a specified row and column in the table. */
+ public javax.accessibility.Accessible getAccessibleAt(int r, int c) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleTable.getAccessibleCellAt(r,c);
+ if (xAccessible != null) {
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant;
+ if ((activeDescendant instanceof TreeItem) && xAccessible.equals(((TreeItem) activeDescendant).unoAccessible)) {
+ child = activeDescendant;
+ } else {
+ child = new TreeItem(xAccessible);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /** Returns the caption for the table. */
+ public javax.accessibility.Accessible getAccessibleCaption() {
+ // Not yet supported.
+ return null;
+ }
+
+ /** Returns the number of columns in the table. */
+ public int getAccessibleColumnCount() {
+ try {
+ return unoAccessibleTable.getAccessibleColumnCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the description text of the specified column in the table. */
+ public javax.accessibility.Accessible getAccessibleColumnDescription(int c) {
+ try {
+ return new javax.swing.JLabel(
+ unoAccessibleTable.getAccessibleColumnDescription(c));
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the number of columns occupied by the Accessible
+ * at a specified row and column in the table.
+ */
+ public int getAccessibleColumnExtentAt(int r, int c) {
+ try {
+ return unoAccessibleTable.getAccessibleColumnExtentAt(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return 0;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the column headers as an AccessibleTable. */
+ public javax.accessibility.AccessibleTable getAccessibleColumnHeader() {
+ // Not yet supported
+ return null;
+ }
+
+ /** Returns the number of rows in the table. */
+ public int getAccessibleRowCount() {
+ try {
+ return unoAccessibleTable.getAccessibleRowCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the description of the specified row in the table. */
+ public javax.accessibility.Accessible getAccessibleRowDescription(int r) {
+ try {
+ return new javax.swing.JLabel(
+ unoAccessibleTable.getAccessibleRowDescription(r));
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the number of rows occupied by the Accessible
+ * at a specified row and column in the table.
+ */
+ public int getAccessibleRowExtentAt(int r, int c) {
+ try {
+ return unoAccessibleTable.getAccessibleRowExtentAt(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return 0;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the row headers as an AccessibleTable. */
+ public javax.accessibility.AccessibleTable getAccessibleRowHeader() {
+ // Not yet supported
+ return null;
+ }
+
+ /** Returns the summary description of the table. */
+ public javax.accessibility.Accessible getAccessibleSummary() {
+ // Not yet supported.
+ return null;
+ }
+
+ /** Returns the selected columns in a table. */
+ public int[] getSelectedAccessibleColumns() {
+ try {
+ return unoAccessibleTable.getSelectedAccessibleColumns();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the selected rows in a table. */
+ public int[] getSelectedAccessibleRows() {
+ try {
+ return unoAccessibleTable.getSelectedAccessibleRows();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns a boolean value indicating whether the specified column is selected. */
+ public boolean isAccessibleColumnSelected(int c) {
+ try {
+ return unoAccessibleTable.isAccessibleColumnSelected(c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns a boolean value indicating whether the specified row is selected. */
+ public boolean isAccessibleRowSelected(int r) {
+ try {
+ return unoAccessibleTable.isAccessibleRowSelected(r);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Returns a boolean value indicating whether the accessible
+ * at a specified row and column is selected.
+ */
+ public boolean isAccessibleSelected(int r, int c) {
+ try {
+ return unoAccessibleTable.isAccessibleSelected(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Sets the caption for the table. */
+ public void setAccessibleCaption(javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the description text of the specified column in the table. */
+ public void setAccessibleColumnDescription(int param, javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the column headers. */
+ public void setAccessibleColumnHeader(javax.accessibility.AccessibleTable accessibleTable) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the description text of the specified row of the table. */
+ public void setAccessibleRowDescription(int param, javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the row headers. */
+ public void setAccessibleRowHeader(javax.accessibility.AccessibleTable accessibleTable) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Sets the summary description of the table */
+ public void setAccessibleSummary(javax.accessibility.Accessible accessible) {
+ // Not supported by the UNO Accessibility API
+ }
+
+ /** Returns the column number of an index in the table */
+ public int getAccessibleColumn(int index) {
+ try {
+ return unoAccessibleTable.getAccessibleColumn(index);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return -1;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the index of a specified row and column in the table. */
+ public int getAccessibleIndex(int r, int c) {
+ try {
+ return unoAccessibleTable.getAccessibleIndex(r,c);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return -1;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the row number of an index in the table */
+ public int getAccessibleRow(int index) {
+ try {
+ return unoAccessibleTable.getAccessibleRow(index);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return -1;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+ }
+
+ class TreeItem extends java.awt.Component implements javax.accessibility.Accessible {
+
+ protected XAccessible unoAccessible;
+
+ public TreeItem(XAccessible xAccessible) {
+ unoAccessible = xAccessible;
+ }
+
+ public Object[] create(Object[] targetSet) {
+ try {
+ java.util.ArrayList list = new java.util.ArrayList(targetSet.length);
+ for (int i=0; i < targetSet.length; i++) {
+ XAccessible xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, targetSet[i]);
+ if (xAccessible != null) {
+ list.add(new TreeItem(xAccessible));
+ }
+ }
+ list.trimToSize();
+ return list.toArray();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ try {
+ XAccessibleContext xAccessibleContext = unoAccessible.getAccessibleContext();
+ if (xAccessibleContext != null) {
+ javax.accessibility.AccessibleContext ac = new AccessibleTreeItem(xAccessibleContext);
+ if (ac != null) {
+ ac.setAccessibleParent(Tree.this);
+ accessibleContext = ac;
+ }
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleTreeItem extends javax.accessibility.AccessibleContext
+ implements javax.accessibility.AccessibleSelection {
+
+ XAccessibleContext unoAccessibleContext;
+ XAccessibleSelection unoAccessibleSelection;
+
+ public AccessibleTreeItem(XAccessibleContext xAccessibleContext) {
+ unoAccessibleContext = xAccessibleContext;
+ unoAccessibleSelection = (XAccessibleSelection)
+ UnoRuntime.queryInterface(XAccessibleSelection.class, xAccessibleContext);
+ }
+
+ /** Returns the accessible name of this object */
+ public String getAccessibleName() {
+ try {
+ return unoAccessibleContext.getAccessibleName();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Sets the accessible name of this object */
+ public void setAccessibleName(String name) {
+ // Not supported
+ }
+
+ /** Returns the accessible name of this object */
+ public String getAccessibleDescription() {
+ try {
+ return unoAccessibleContext.getAccessibleDescription();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Sets the accessible name of this object */
+ public void setAccessibleDescription(String name) {
+ // Not supported
+ }
+
+ /** Returns the accessible role of this object */
+ public javax.accessibility.AccessibleRole getAccessibleRole() {
+ try {
+ javax.accessibility.AccessibleRole role = AccessibleRoleAdapter.getAccessibleRole(
+ unoAccessibleContext.getAccessibleRole());
+ return (role != null) ? role : javax.accessibility.AccessibleRole.LABEL;
+ } catch(com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the locale of the component */
+ public java.util.Locale getLocale() throws java.awt.IllegalComponentStateException {
+ try {
+ com.sun.star.lang.Locale unoLocale = unoAccessibleContext.getLocale();
+ return new java.util.Locale(unoLocale.Language, unoLocale.Country);
+ } catch (IllegalAccessibleComponentStateException e) {
+ throw new java.awt.IllegalComponentStateException(e.getMessage());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return Tree.this.getLocale();
+ }
+ }
+
+ /** Gets the 0-based index of this object in its accessible parent */
+ public int getAccessibleIndexInParent() {
+ try {
+ return unoAccessibleContext.getAccessibleIndexInParent();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return -1;
+ }
+ }
+
+ /** Returns the number of accessible children of the object. */
+ public int getAccessibleChildrenCount() {
+ try {
+ return unoAccessibleContext.getAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Returns the specified Accessible child of the object. */
+ public javax.accessibility.Accessible getAccessibleChild(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ // Re-use the active descandant wrapper if possible
+ javax.accessibility.Accessible activeDescendant = Tree.this.activeDescendant;
+ if ((activeDescendant instanceof TreeItem) && ((TreeItem) activeDescendant).unoAccessible.equals(xAccessible)) {
+ child = activeDescendant;
+ } else if (xAccessible != null) {
+ child = new TreeItem(xAccessible);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /** Returns the state set of this object */
+ public javax.accessibility.AccessibleStateSet getAccessibleStateSet() {
+ try {
+ return AccessibleStateAdapter.getAccessibleStateSet(TreeItem.this,
+ unoAccessibleContext.getAccessibleStateSet());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return AccessibleStateAdapter.getDefunctStateSet();
+ }
+ }
+
+ /** Gets the AccessibleComponent associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleComponent getAccessibleComponent() {
+ try {
+ XAccessibleComponent unoAccessibleComponent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class, unoAccessibleContext);
+ return (unoAccessibleComponent != null) ?
+ new AccessibleComponentImpl(unoAccessibleComponent) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Returns the AccessibleSelection interface for this object */
+ public javax.accessibility.AccessibleSelection getAccessibleSelection() {
+ return (unoAccessibleSelection != null) ? this : null;
+ }
+
+ /** Gets the AccessibleAction associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleAction getAccessibleAction() {
+ try {
+ XAccessibleAction unoAccessibleAction = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, unoAccessibleContext);
+ return (unoAccessibleAction != null) ?
+ new AccessibleActionImpl(unoAccessibleAction) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleText associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleText getAccessibleText() {
+
+ if (disposed)
+ return null;
+
+ try {
+ XAccessibleText unoAccessibleText = (XAccessibleText)
+ UnoRuntime.queryInterface(XAccessibleText.class, unoAccessibleContext);
+ return (unoAccessibleText != null) ?
+ new AccessibleTextImpl(unoAccessibleText) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleValue associated with this object that has a graphical representation */
+ public javax.accessibility.AccessibleValue getAccessibleValue() {
+ try {
+ XAccessibleValue unoAccessibleValue = (XAccessibleValue)
+ UnoRuntime.queryInterface(XAccessibleValue.class, unoAccessibleContext);
+ return (unoAccessibleValue != null) ?
+ new AccessibleValueImpl(unoAccessibleValue) : null;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the AccessibleText associated with this object presenting text on the display */
+ public javax.accessibility.AccessibleIcon[] getAccessibleIcon() {
+ try {
+ XAccessibleImage unoAccessibleImage = (XAccessibleImage)
+ UnoRuntime.queryInterface(XAccessibleImage.class, unoAccessibleContext);
+ if (unoAccessibleImage != null) {
+ javax.accessibility.AccessibleIcon[] icons = { new AccessibleIconImpl(unoAccessibleImage) };
+ return icons;
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return null;
+ }
+
+ /*
+ * AccessibleSelection
+ */
+
+ /** Returns an Accessible representing the specified selected child of the object */
+ public javax.accessibility.Accessible getAccessibleSelection(int i) {
+ javax.accessibility.Accessible child = null;
+ try {
+ XAccessible xAccessible = unoAccessibleContext.getAccessibleChild(i);
+ if (xAccessible != null) {
+ child = new TreeItem(xAccessible);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ return child;
+ }
+
+ /** Adds the specified Accessible child of the object to the object's selection */
+ public void addAccessibleSelection(int i) {
+ try {
+ unoAccessibleSelection.selectAccessibleChild(i);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Clears the selection in the object, so that no children in the object are selected */
+ public void clearAccessibleSelection() {
+ try {
+ unoAccessibleSelection.clearAccessibleSelection();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Returns the number of Accessible children currently selected */
+ public int getAccessibleSelectionCount() {
+ try {
+ return unoAccessibleSelection.getSelectedAccessibleChildCount();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return 0;
+ }
+ }
+
+ /** Determines if the current child of this object is selected */
+ public boolean isAccessibleChildSelected(int i) {
+ try {
+ return unoAccessibleSelection.isAccessibleChildSelected(i);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ return false;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Removes the specified child of the object from the object's selection */
+ public void removeAccessibleSelection(int i) {
+ try {
+ unoAccessibleSelection.deselectAccessibleChild(i);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ /** Causes every child of the object to be selected if the object supports multiple selection */
+ public void selectAllAccessibleSelection() {
+ try {
+ unoAccessibleSelection.selectAllAccessibleChildren();
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/Window.java b/accessibility/bridge/org/openoffice/java/accessibility/Window.java
new file mode 100644
index 000000000000..ef44c3380a48
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/Window.java
@@ -0,0 +1,551 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility;
+
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+public class Window extends java.awt.Window implements javax.accessibility.Accessible, NativeFrame {
+ protected XAccessibleComponent unoAccessibleComponent;
+
+ boolean opened = false;
+ boolean visible = false;
+
+ java.awt.EventQueue eventQueue = null;
+
+ public Window(java.awt.Window owner, XAccessibleComponent xAccessibleComponent) {
+ super(owner);
+ initialize(xAccessibleComponent);
+ }
+
+ private void initialize(XAccessibleComponent xAccessibleComponent) {
+ unoAccessibleComponent = xAccessibleComponent;
+ eventQueue = java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue();
+ XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
+ UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class,
+ unoAccessibleComponent);
+ if (broadcaster != null) {
+ broadcaster.addEventListener(new AccessibleWindowListener());
+ }
+ }
+
+ java.awt.Component initialComponent = null;
+
+ public java.awt.Component getInitialComponent() {
+ if (Build.DEBUG) {
+ System.err.println("returning initial component object of class: " + initialComponent.getClass().getName());
+ }
+ return initialComponent;
+ }
+
+ public void setInitialComponent(java.awt.Component c) {
+ initialComponent = c;
+ }
+
+ public Integer getHWND() {
+ return null;
+ }
+
+ /**
+ * Determines whether this <code>Component</code> is showing on screen.
+ * This means that the component must be visible, and it must be in a
+ * <code>container</code> that is visible and showing.
+ * @see #addNotify
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public boolean isShowing() {
+ if (isVisible()) {
+ java.awt.Container parent = getParent();
+ return (parent == null) || parent.isShowing();
+ }
+ return false;
+ }
+
+ /**
+ * Makes this <code>Component</code> displayable by connecting it to a
+ * native screen resource.
+ * This method is called internally by the toolkit and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #removeNotify
+ * @since JDK1.0
+ */
+ public void addNotify() {
+// createHierarchyEvents(0, null, null, 0, false);
+ }
+
+ /**
+ * Makes this <code>Component</code> undisplayable by destroying it native
+ * screen resource.
+ * This method is called by the toolkit internally and should
+ * not be called directly by programs.
+ * @see #isDisplayable
+ * @see #addNotify
+ * @since JDK1.0
+ */
+ public void removeNotify() {
+ }
+
+ /**
+ * Determines if the object is visible. Note: this means that the
+ * object intends to be visible; however, it may not in fact be
+ * showing on the screen because one of the objects that this object
+ * is contained by is not visible. To determine if an object is
+ * showing on the screen, use <code>isShowing</code>.
+ *
+ * @return true if object is visible; otherwise, false
+ */
+ public boolean isVisible(){
+ return visible;
+ }
+
+ /**
+ * Shows or hides this component depending on the value of parameter
+ * <code>b</code>.
+ * @param b if <code>true</code>, shows this component;
+ * otherwise, hides this component
+ * @see #isVisible
+ * @since JDK1.1
+ */
+ public void setVisible(boolean b) {
+ if (visible != b){
+ visible = b;
+ if (b) {
+ // If it is the first show, fire WINDOW_OPENED event
+ if (!opened) {
+ postWindowEvent(java.awt.event.WindowEvent.WINDOW_OPENED);
+ opened = true;
+ }
+ postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_SHOWN);
+ } else {
+ postComponentEvent(java.awt.event.ComponentEvent.COMPONENT_HIDDEN);
+ }
+ }
+ }
+
+ public void dispose() {
+ setVisible(false);
+ postWindowEvent(java.awt.event.WindowEvent.WINDOW_CLOSED);
+
+ // Transfer window focus back to the owner window if it is still the active frame
+ if ((getOwner() instanceof Frame && ((Frame) getOwner()).active) ||
+ (getOwner() instanceof Dialog && ((Dialog) getOwner()).active)) {
+ eventQueue.postEvent(new java.awt.event.WindowEvent(getOwner(),
+ java.awt.event.WindowEvent.WINDOW_GAINED_FOCUS));
+ }
+ }
+
+ protected void postWindowEvent(int i) {
+ eventQueue.postEvent(new java.awt.event.WindowEvent(this, i));
+ }
+
+ protected void postComponentEvent(int i) {
+ eventQueue.postEvent(new java.awt.event.ComponentEvent(this, i));
+ }
+
+ /**
+ * Update the proxy objects appropriatly on property change events
+ */
+ protected class AccessibleWindowListener implements XAccessibleEventListener {
+
+ protected AccessibleWindowListener() {
+ }
+
+ // The only expected state changes are ACTIVE and VISIBLE
+ protected void setComponentState(short state, boolean enable) {
+ switch (state) {
+ case AccessibleStateType.ICONIFIED:
+ postWindowEvent(enable ?
+ java.awt.event.WindowEvent.WINDOW_ICONIFIED :
+ java.awt.event.WindowEvent.WINDOW_DEICONIFIED);
+ break;
+ case AccessibleStateType.SHOWING:
+ case AccessibleStateType.VISIBLE:
+ setVisible(enable);
+ break;
+ default:
+ if (Build.DEBUG) {
+// System.err.println("[frame]: " + getTitle() + "unexpected state change " + state);
+ }
+ break;
+ }
+ }
+
+ /** Updates the accessible name and fires the appropriate PropertyChangedEvent */
+ protected void handleNameChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac!= null) {
+ ac.setAccessibleName(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the accessible description and fires the appropriate PropertyChangedEvent */
+ protected void handleDescriptionChangedEvent(Object any) {
+ try {
+ // This causes the property change event to be fired in the VCL thread
+ // context. If this causes problems, it has to be deligated to the java
+ // dispatch thread ..
+ if (accessibleContext != null) {
+ accessibleContext.setAccessibleDescription(AnyConverter.toString(any));
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Updates the internal states and fires the appropriate PropertyChangedEvent */
+ protected void handleStateChangedEvent(Object any1, Object any2) {
+ try {
+ if (AnyConverter.isShort(any1)) {
+ setComponentState(AnyConverter.toShort(any1), false);
+ }
+
+ if (AnyConverter.isShort(any2)) {
+ setComponentState(AnyConverter.toShort(any2), true);
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ /** Fires a visible data property change event */
+ protected void handleVisibleDataEvent() {
+ javax.accessibility.AccessibleContext ac = accessibleContext;
+ if (ac != null) {
+ ac.firePropertyChange(javax.accessibility.AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY, null, null);
+ }
+ }
+
+ /** Called by OpenOffice process to notify property changes */
+ public void notifyEvent(AccessibleEventObject event) {
+ switch (event.EventId) {
+ case AccessibleEventId.NAME_CHANGED:
+ // Set the accessible name for the corresponding context, which will fire a property
+ // change event itself
+ handleNameChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.DESCRIPTION_CHANGED:
+ // Set the accessible description for the corresponding context, which will fire a property
+ // change event itself - so do not set propertyName !
+ handleDescriptionChangedEvent(event.NewValue);
+ break;
+ case AccessibleEventId.STATE_CHANGED:
+ // Update the internal state set and fire the appropriate PropertyChangedEvent
+ handleStateChangedEvent(event.OldValue, event.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ if (AnyConverter.isObject(event.OldValue)) {
+ AccessibleObjectFactory.removeChild(Window.this, event.OldValue);
+ } else if (AnyConverter.isObject(event.NewValue)) {
+ AccessibleObjectFactory.addChild(Window.this, event.NewValue);
+ }
+ break;
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ handleVisibleDataEvent();
+ break;
+ default:
+ // Warn about unhandled events
+ if(Build.DEBUG) {
+ System.out.println(this + ": unhandled accessibility event id=" + event.EventId);
+ }
+ }
+ }
+
+ /** Called by OpenOffice process to notify that the UNO component is disposing */
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ }
+ }
+
+ protected javax.accessibility.AccessibleContext accessibleContext = null;
+
+ /** Returns the AccessibleContext associated with this object */
+ public javax.accessibility.AccessibleContext getAccessibleContext() {
+ if (accessibleContext == null) {
+ accessibleContext = new AccessibleWindow();
+// accessibleContext.setAccessibleName(getTitle());
+ }
+ return accessibleContext;
+ }
+
+ protected class AccessibleWindow extends java.awt.Window.AccessibleAWTWindow {
+ protected AccessibleWindow() {
+ super();
+ }
+
+ protected java.awt.event.ComponentListener accessibleComponentHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when shown/hidden..
+ */
+ protected class AccessibleComponentHandler implements java.awt.event.ComponentListener {
+ public void componentHidden(java.awt.event.ComponentEvent e) {
+ AccessibleWindow.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ javax.accessibility.AccessibleState.VISIBLE, null);
+ }
+
+ public void componentShown(java.awt.event.ComponentEvent e) {
+ AccessibleWindow.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
+ null, javax.accessibility.AccessibleState.VISIBLE);
+ }
+
+ public void componentMoved(java.awt.event.ComponentEvent e) {
+ }
+
+ public void componentResized(java.awt.event.ComponentEvent e) {
+ }
+ } // inner class AccessibleComponentHandler
+
+ protected java.awt.event.ContainerListener accessibleContainerHandler = null;
+
+ /**
+ * Fire PropertyChange listener, if one is registered,
+ * when children added/removed.
+ */
+
+ protected class AccessibleContainerHandler implements java.awt.event.ContainerListener {
+ public void componentAdded(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleWindow.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ null, ((javax.accessibility.Accessible) c).getAccessibleContext());
+ }
+ }
+ public void componentRemoved(java.awt.event.ContainerEvent e) {
+ java.awt.Component c = e.getChild();
+ if (c != null && c instanceof javax.accessibility.Accessible) {
+ AccessibleWindow.this.firePropertyChange(
+ javax.accessibility.AccessibleContext.ACCESSIBLE_CHILD_PROPERTY,
+ ((javax.accessibility.Accessible) c).getAccessibleContext(), null);
+ }
+ }
+ }
+
+ protected int propertyChangeListenerCount = 0;
+
+ /**
+ * Add a PropertyChangeListener to the listener list.
+ *
+ * @param listener The PropertyChangeListener to be added
+ */
+ public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (propertyChangeListenerCount++ == 0) {
+ accessibleContainerHandler = new AccessibleContainerHandler();
+ Window.this.addContainerListener(accessibleContainerHandler);
+
+ accessibleComponentHandler = new AccessibleComponentHandler();
+ Window.this.addComponentListener(accessibleComponentHandler);
+ }
+ super.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * Remove a PropertyChangeListener from the listener list.
+ * This removes a PropertyChangeListener that was registered
+ * for all properties.
+ *
+ * @param listener The PropertyChangeListener to be removed
+ */
+ public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {
+ if (--propertyChangeListenerCount == 0) {
+ Window.this.removeComponentListener(accessibleComponentHandler);
+ accessibleComponentHandler = null;
+
+ Window.this.removeContainerListener(accessibleContainerHandler);
+ accessibleContainerHandler = null;
+ }
+ super.removePropertyChangeListener(listener);
+ }
+
+ /*
+ * AccessibleComponent
+ */
+
+ /** Returns the background color of the object */
+ public java.awt.Color getBackground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getBackground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setBackground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the foreground color of the object */
+ public java.awt.Color getForeground() {
+ try {
+ return new java.awt.Color(unoAccessibleComponent.getForeground());
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public void setForeground(java.awt.Color c) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Cursor getCursor() {
+ // Not supported by UNO accessibility API
+ return null;
+ }
+
+ public void setCursor(java.awt.Cursor cursor) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.Font getFont() {
+ // FIXME
+ return null;
+ }
+
+ public void setFont(java.awt.Font f) {
+ // Not supported by UNO accessibility API
+ }
+
+ public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
+ // FIXME
+ return null;
+ }
+
+ public boolean isEnabled() {
+ return Window.this.isEnabled();
+ }
+
+ public void setEnabled(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isVisible() {
+ return Window.this.isVisible();
+ }
+
+ public void setVisible(boolean b) {
+ // Not supported by UNO accessibility API
+ }
+
+ public boolean isShowing() {
+ return Window.this.isShowing();
+ }
+
+ public boolean contains(java.awt.Point p) {
+ try {
+ return unoAccessibleComponent.containsPoint(new com.sun.star.awt.Point(p.x, p.y));
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return false;
+ }
+ }
+
+ /** Returns the location of the object on the screen. */
+ public java.awt.Point getLocationOnScreen() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen();
+ return new java.awt.Point(unoPoint.X, unoPoint.Y);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Gets the location of this component in the form of a point specifying the component's top-left corner */
+ public java.awt.Point getLocation() {
+ try {
+ com.sun.star.awt.Point unoPoint = unoAccessibleComponent.getLocationOnScreen();
+ return new java.awt.Point( unoPoint.X, unoPoint.Y );
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves this component to a new location */
+ public void setLocation(java.awt.Point p) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Gets the bounds of this component in the form of a Rectangle object */
+ public java.awt.Rectangle getBounds() {
+ try {
+ com.sun.star.awt.Rectangle unoRect = unoAccessibleComponent.getBounds();
+ return new java.awt.Rectangle(unoRect.X, unoRect.Y, unoRect.Width, unoRect.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Moves and resizes this component to conform to the new bounding rectangle r */
+ public void setBounds(java.awt.Rectangle r) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the size of this component in the form of a Dimension object */
+ public java.awt.Dimension getSize() {
+ try {
+ com.sun.star.awt.Size unoSize = unoAccessibleComponent.getSize();
+ return new java.awt.Dimension(unoSize.Width, unoSize.Height);
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ /** Resizes this component so that it has width d.width and height d.height */
+ public void setSize(java.awt.Dimension d) {
+ // Not supported by UNO accessibility API
+ }
+
+ /** Returns the Accessible child, if one exists, contained at the local coordinate Point */
+ public javax.accessibility.Accessible getAccessibleAt(java.awt.Point p) {
+ try {
+ java.awt.Component c = AccessibleObjectFactory.getAccessibleComponent(
+ unoAccessibleComponent.getAccessibleAtPoint(new com.sun.star.awt.Point(p.x, p.y)));
+
+ return (javax.accessibility.Accessible) c;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ return null;
+ }
+ }
+
+ public boolean isFocusTraversable() {
+ return Window.this.isFocusable();
+ }
+
+ public void requestFocus() {
+ unoAccessibleComponent.grabFocus();
+ }
+ }
+}
+
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java
new file mode 100644
index 000000000000..36bec1cab8fb
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleEventLog.java
@@ -0,0 +1,186 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility.logging;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+/**
+ *
+ */
+public class XAccessibleEventLog implements XAccessibleEventListener {
+
+ private static XAccessibleEventLog theEventListener = null;
+
+ private static java.util.Hashtable proxyList = new java.util.Hashtable();
+
+ /** Creates a new instance of UNOAccessibleEventListener */
+ public XAccessibleEventLog() {
+ }
+
+ private static XAccessibleEventListener get() {
+ if (theEventListener == null) {
+ theEventListener = new XAccessibleEventLog();
+ }
+ return theEventListener;
+ }
+
+ public static void addEventListener(XAccessibleContext xac, java.awt.Component c) {
+ XAccessibleEventBroadcaster broadcaster = (XAccessibleEventBroadcaster)
+ UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, xac);
+ if (broadcaster != null) {
+ broadcaster.addEventListener(XAccessibleEventLog.get());
+
+ // remember the proxy objects
+ synchronized (proxyList) {
+// proxyList.put(UnoRuntime.generateOid(xac), new WeakReference(c));
+ proxyList.put(UnoRuntime.generateOid(xac), c);
+ }
+ }
+ }
+
+ public void disposing(com.sun.star.lang.EventObject eventObject) {
+ }
+
+ public void notifyEvent(com.sun.star.accessibility.AccessibleEventObject accessibleEventObject) {
+ switch (accessibleEventObject.EventId) {
+ case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED:
+ logMessage(accessibleEventObject.Source, "Retrieved active descendant event.");
+ break;
+ case AccessibleEventId.STATE_CHANGED:
+ logStateChange(accessibleEventObject.Source,
+ accessibleEventObject.OldValue,
+ accessibleEventObject.NewValue);
+ break;
+ case AccessibleEventId.CHILD:
+ logMessage(accessibleEventObject.Source, "Retrieved children event.");
+ break;
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ logMessage(accessibleEventObject.Source, "Retrieved boundrect changed event.");
+ break;
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ logMessage(accessibleEventObject.Source, "Retrieved visible data changed event.");
+ break;
+ case AccessibleEventId.INVALIDATE_ALL_CHILDREN:
+ logMessage(accessibleEventObject.Source, "Retrieved invalidate children event.");
+ break;
+ default:
+ break;
+ }
+ }
+
+ public void logStateChange(Object o, Object any1, Object any2) {
+ try {
+ if (AnyConverter.isShort(any1)) {
+ logStateChange(o, AnyConverter.toShort(any1), " is no longer ");
+ }
+
+ if (AnyConverter.isShort(any2)) {
+ logStateChange(o, AnyConverter.toShort(any2), " is now ");
+ }
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ }
+ }
+
+ public void logStateChange(Object o, short n, String s) {
+ switch(n) {
+ case AccessibleStateType.ACTIVE:
+ logMessage(o, s + javax.accessibility.AccessibleState.ACTIVE);
+ break;
+ case AccessibleStateType.ARMED:
+ logMessage(o, s + javax.accessibility.AccessibleState.ARMED);
+ break;
+ case AccessibleStateType.CHECKED:
+ logMessage(o, s + javax.accessibility.AccessibleState.CHECKED);
+ break;
+ case AccessibleStateType.ENABLED:
+ logMessage(o, s + javax.accessibility.AccessibleState.ENABLED);
+ break;
+ case AccessibleStateType.FOCUSED:
+ logMessage(o, s + javax.accessibility.AccessibleState.FOCUSED);
+ break;
+ case AccessibleStateType.PRESSED:
+ logMessage(o, s + javax.accessibility.AccessibleState.PRESSED);
+ break;
+ case AccessibleStateType.SELECTED:
+ logMessage(o, s + javax.accessibility.AccessibleState.SELECTED);
+ break;
+ case AccessibleStateType.SENSITIVE:
+ logMessage(o, s + "sensitive");
+ break;
+ case AccessibleStateType.SHOWING:
+ logMessage(o, s + javax.accessibility.AccessibleState.SHOWING);
+ break;
+ case AccessibleStateType.VISIBLE:
+ logMessage(o, s + javax.accessibility.AccessibleState.VISIBLE);
+ break;
+ default:
+ logMessage(o, s + "??? (FIXME)");
+ break;
+ }
+ }
+
+ protected static void logMessage(Object o, String s) {
+ XAccessibleContext xac = (XAccessibleContext) UnoRuntime.queryInterface(XAccessibleContext.class, o);
+ if( xac != null ) {
+ String oid = UnoRuntime.generateOid(xac);
+ synchronized (proxyList) {
+ logMessage( (javax.accessibility.Accessible) proxyList.get( oid ), s );
+// WeakReference r = (WeakReference) proxyList.get( oid );
+// if(r != null) {
+// System.err.println( "*** Warning *** event is " + r.get() );
+// logMessage( (javax.accessibility.Accessible) r.get(), s );
+// } else {
+// System.err.println( "*** Warning *** event source not found in broadcaster list" );
+// }
+ }
+ } else
+ System.err.println( "*** Warning *** event source does not implement XAccessibleContext" );
+ }
+
+ protected static void logMessage(javax.accessibility.Accessible a, String s) {
+ if (a != null) {
+ logMessage(a.getAccessibleContext(), s);
+ } else {
+ logMessage(s);
+ }
+ }
+
+ protected static void logMessage(javax.accessibility.AccessibleContext ac, String s) {
+ if (ac != null) {
+ logMessage("[" + ac.getAccessibleRole() + "] "
+ + ac.getAccessibleName() + ": " + s);
+ } else {
+ logMessage(s);
+ }
+ }
+
+ protected static void logMessage(String s) {
+ System.err.println(s);
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java
new file mode 100644
index 000000000000..f14da6d8280b
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleHypertextLog.java
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package org.openoffice.java.accessibility.logging;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+/** The AccessibleHypertextImpl mapps all calls to the java AccessibleHypertext
+ * interface to the corresponding methods of the UNO XAccessibleHypertext
+ * interface.
+ */
+public class XAccessibleHypertextLog extends XAccessibleTextLog
+ implements com.sun.star.accessibility.XAccessibleHypertext {
+
+ private com.sun.star.accessibility.XAccessibleHypertext unoObject;
+
+ /** Creates a new instance of XAccessibleTextLog */
+ public XAccessibleHypertextLog(XAccessibleHypertext xAccessibleHypertext) {
+ super(xAccessibleHypertext);
+ unoObject = xAccessibleHypertext;
+ }
+
+ public XAccessibleHyperlink getHyperLink(int param)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.getHyperLink(param);
+ }
+
+ public int getHyperLinkCount() {
+ return unoObject.getHyperLinkCount();
+ }
+
+ public int getHyperLinkIndex(int param)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.getHyperLinkIndex(param);
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java
new file mode 100644
index 000000000000..4b415ee60c74
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/logging/XAccessibleTextLog.java
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 org.openoffice.java.accessibility.logging;
+
+import org.openoffice.java.accessibility.*;
+
+
+/**
+ *
+ */
+public class XAccessibleTextLog
+ implements com.sun.star.accessibility.XAccessibleText {
+ private com.sun.star.accessibility.XAccessibleText unoObject;
+ private String name = "[Unknown] NoName";
+
+ /** Creates a new instance of XAccessibleTextLog */
+ public XAccessibleTextLog(
+ com.sun.star.accessibility.XAccessibleText xAccessibleText) {
+ unoObject = xAccessibleText;
+ setName(xAccessibleText);
+ }
+
+ private void setName(
+ com.sun.star.accessibility.XAccessibleText xAccessibleText) {
+ try {
+ com.sun.star.accessibility.XAccessibleContext unoAccessibleContext = (com.sun.star.accessibility.XAccessibleContext) com.sun.star.uno.UnoRuntime.queryInterface(com.sun.star.accessibility.XAccessibleContext.class,
+ xAccessibleText);
+
+ if (unoAccessibleContext != null) {
+ name = "[" +
+ AccessibleRoleAdapter.getAccessibleRole(unoAccessibleContext.getAccessibleRole()) +
+ "] " + unoAccessibleContext.getAccessibleName() + ": ";
+ }
+ } catch (com.sun.star.uno.RuntimeException e) {
+ }
+ }
+
+ private String getPartString(short s) {
+ String part = "INVALID";
+
+ switch (s) {
+ case com.sun.star.accessibility.AccessibleTextType.CHARACTER:
+ part = "CHARACTER";
+
+ break;
+
+ case com.sun.star.accessibility.AccessibleTextType.WORD:
+ part = "WORD";
+
+ break;
+
+ case com.sun.star.accessibility.AccessibleTextType.SENTENCE:
+ part = "SENTENCE";
+
+ break;
+
+ case com.sun.star.accessibility.AccessibleTextType.LINE:
+ part = "LINE";
+
+ break;
+
+ case com.sun.star.accessibility.AccessibleTextType.ATTRIBUTE_RUN:
+ part = "ATTRIBUTE_RUN";
+
+ break;
+
+ default:
+ break;
+ }
+
+ return part;
+ }
+
+ private String dumpTextSegment(com.sun.star.accessibility.TextSegment ts) {
+ if (ts != null) {
+ return "(" + ts.SegmentStart + "," + ts.SegmentEnd + "," +
+ ts.SegmentText + ")";
+ }
+
+ return "NULL";
+ }
+
+ public boolean copyText(int param, int param1)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.copyText(param, param1);
+ }
+
+ public int getCaretPosition() {
+ int pos = unoObject.getCaretPosition();
+ System.err.println(name + "getCaretPosition() returns " + pos);
+
+ return pos;
+ }
+
+ public char getCharacter(int param)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.getCharacter(param);
+ }
+
+ public com.sun.star.beans.PropertyValue[] getCharacterAttributes(
+ int param, String[] str)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.getCharacterAttributes(param, str);
+ }
+
+ public com.sun.star.awt.Rectangle getCharacterBounds(int param)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ try {
+ com.sun.star.awt.Rectangle r = unoObject.getCharacterBounds(param);
+ System.err.println(name + "getCharacterBounds(" + param +
+ ") returns (" + r.X + "," + r.Y + "," + r.Width + "," +
+ r.Height + ")");
+
+ return r;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.err.println("IndexOutOufBoundsException caught for " + name +
+ "getCharacterBounds(" + param + ")");
+ throw e;
+ }
+ }
+
+ public int getCharacterCount() {
+ return unoObject.getCharacterCount();
+ }
+
+ public int getIndexAtPoint(com.sun.star.awt.Point point) {
+ try {
+ int index = unoObject.getIndexAtPoint(point);
+ System.err.println(name + "getIndexAtPoint(" + point.X + ", " +
+ point.Y + ") returns " + index);
+
+ return index;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ System.err.println(name +
+ "RuntimeException caught for getIndexAtPoint(" + point.X +
+ ", " + point.Y + ")");
+ System.err.println(e.getMessage());
+ throw e;
+ }
+ }
+
+ public String getSelectedText() {
+ return unoObject.getSelectedText();
+ }
+
+ public int getSelectionEnd() {
+ return unoObject.getSelectionEnd();
+ }
+
+ public int getSelectionStart() {
+ return unoObject.getSelectionStart();
+ }
+
+ public String getText() {
+ return unoObject.getText();
+ }
+
+ public com.sun.star.accessibility.TextSegment getTextAtIndex(int param,
+ short param1)
+ throws com.sun.star.lang.IndexOutOfBoundsException,
+ com.sun.star.lang.IllegalArgumentException {
+ try {
+ com.sun.star.accessibility.TextSegment ts = unoObject.getTextAtIndex(param,
+ param1);
+ System.err.println(name + "getTextAtIndex(" +
+ getPartString(param1) + "," + param + ") returns " +
+ dumpTextSegment(ts));
+
+ return ts;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.err.println("IndexOutOufBoundsException caught for " + name +
+ " getTextAtIndex(" + getPartString(param1) + "," + param1 +
+ ")");
+ throw e;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.err.println("IllegalArgumentException caught for " + name +
+ " getTextAtIndex(" + getPartString(param1) + "," + param + ")");
+ throw e;
+ }
+ }
+
+ public com.sun.star.accessibility.TextSegment getTextBeforeIndex(
+ int param, short param1)
+ throws com.sun.star.lang.IndexOutOfBoundsException,
+ com.sun.star.lang.IllegalArgumentException {
+ try {
+ com.sun.star.accessibility.TextSegment ts = unoObject.getTextBeforeIndex(param,
+ param1);
+ System.err.println(name + " getTextBeforeIndex(" +
+ getPartString(param1) + "," + param + ") returns " +
+ dumpTextSegment(ts));
+
+ return ts;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.err.println("IndexOutOufBoundsException caught for " + name +
+ " getTextBeforeIndex(" + getPartString(param1) + "," + param1 +
+ ")");
+ throw e;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.err.println("IllegalArgumentException caught for " + name +
+ " getTextBeforeIndex(" + getPartString(param1) + "," + param +
+ ")");
+ throw e;
+ }
+ }
+
+ public com.sun.star.accessibility.TextSegment getTextBehindIndex(
+ int param, short param1)
+ throws com.sun.star.lang.IndexOutOfBoundsException,
+ com.sun.star.lang.IllegalArgumentException {
+ try {
+ com.sun.star.accessibility.TextSegment ts = unoObject.getTextBehindIndex(param,
+ param1);
+ System.err.println(name + " getTextBehindIndex(" +
+ getPartString(param1) + "," + param + ") returns " +
+ dumpTextSegment(ts));
+
+ return ts;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.err.println("IndexOutOufBoundsException caught for " + name +
+ " getTextBehindIndex(" + getPartString(param1) + "," + param1 +
+ ")");
+ throw e;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ System.err.println("IllegalArgumentException caught for " + name +
+ " getTextBehindIndex(" + getPartString(param1) + "," + param +
+ ")");
+ throw e;
+ }
+ }
+
+ public String getTextRange(int param, int param1)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.getTextRange(param, param1);
+ }
+
+ public boolean setCaretPosition(int param)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.setCaretPosition(param);
+ }
+
+ public boolean setSelection(int param, int param1)
+ throws com.sun.star.lang.IndexOutOfBoundsException {
+ return unoObject.setSelection(param, param1);
+ }
+}
diff --git a/accessibility/bridge/org/openoffice/java/accessibility/makefile.mk b/accessibility/bridge/org/openoffice/java/accessibility/makefile.mk
new file mode 100755
index 000000000000..0d98760a31df
--- /dev/null
+++ b/accessibility/bridge/org/openoffice/java/accessibility/makefile.mk
@@ -0,0 +1,115 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJNAME = accessibility
+PRJ = ..$/..$/..$/..$/..
+TARGET = java_accessibility
+PACKAGE = org$/openoffice$/java$/accessibility
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+JAVADIR = $(OUT)$/misc$/java
+JARFILES = jurt.jar unoil.jar ridl.jar
+JAVAFILES = \
+ logging$/XAccessibleEventLog.java \
+ logging$/XAccessibleHypertextLog.java \
+ logging$/XAccessibleTextLog.java \
+ AbstractButton.java \
+ AccessibleActionImpl.java \
+ AccessibleComponentImpl.java \
+ AccessibleEditableTextImpl.java \
+ AccessibleExtendedState.java \
+ AccessibleHypertextImpl.java \
+ AccessibleIconImpl.java \
+ AccessibleKeyBinding.java \
+ AccessibleObjectFactory.java \
+ AccessibleRoleAdapter.java \
+ AccessibleSelectionImpl.java \
+ AccessibleStateAdapter.java \
+ AccessibleTextImpl.java \
+ AccessibleValueImpl.java \
+ Alert.java \
+ Application.java \
+ Button.java \
+ CheckBox.java \
+ ComboBox.java \
+ Component.java \
+ Container.java \
+ DescendantManager.java \
+ Dialog.java \
+ FocusTraversalPolicy.java \
+ Frame.java \
+ Icon.java \
+ Label.java \
+ List.java \
+ Menu.java \
+ MenuItem.java \
+ MenuContainer.java \
+ NativeFrame.java \
+ Paragraph.java \
+ RadioButton.java \
+ ScrollBar.java \
+ Separator.java \
+ Table.java \
+ TextComponent.java \
+ ToggleButton.java \
+ ToolTip.java \
+ Tree.java \
+ Window.java
+
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:s/.java//).class) $(CLASSDIR)$/$(PACKAGE)$/Build.class
+
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+JARCLASSDIRS = $(PACKAGE)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+# Enable logging in non-product only
+.IF "$(PRODUCT)"!=""
+DEBUGSWITCH = false
+PRODUCTSWITCH = true
+.ELSE
+PRODUCTSWITCH = false
+DEBUGSWITCH = true
+.ENDIF
+
+$(JAVADIR)$/$(PACKAGE)$/%.java: makefile.mk
+ @@-$(MKDIRHIER) $(JAVADIR)$/$(PACKAGE)
+ @-echo package org.openoffice.java.accessibility\; > $@
+ @-echo public class Build { >> $@
+ @-echo public static final boolean DEBUG = $(DEBUGSWITCH)\; >> $@
+ @-echo public static final boolean PRODUCT = $(PRODUCTSWITCH)\; >> $@
+ @-echo } >> $@
+
+$(CLASSDIR)$/$(PACKAGE)$/Build.class : $(JAVADIR)$/$(PACKAGE)$/Build.java
+ -$(JAVAC) -d $(CLASSDIR) $(JAVADIR)$/$(PACKAGE)$/Build.java
+
diff --git a/accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx b/accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx
new file mode 100644
index 000000000000..a281b3aa51a1
--- /dev/null
+++ b/accessibility/bridge/source/java/WindowsAccessBridgeAdapter.cxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+//------------------------------------------------------------------------
+// includes
+//------------------------------------------------------------------------
+
+#include <WindowsAccessBridgeAdapter.h>
+
+#include <tools/prewin.h>
+#include <wtypes.h>
+#include <tools/postwin.h>
+#include <rtl/process.h>
+#include <tools/link.hxx>
+
+#ifndef _SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#include <vcl/window.hxx>
+#include <vcl/sysdata.hxx>
+#include <uno/current_context.hxx>
+#include <uno/environment.h>
+#include <uno/mapping.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+#ifndef _JVMACCESS_UNOVIRTUALMACHINE_HXX_
+#include "jvmaccess/unovirtualmachine.hxx"
+#endif
+
+#ifndef _JVMACCESS_VIRTUALMACHINE_HXX_
+#include "jvmaccess/virtualmachine.hxx"
+#endif
+
+#include <osl/diagnose.h>
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Mapping;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using namespace ::com::sun::star::accessibility;
+
+long VCLEventListenerLinkFunc(void * pInst, void * pData);
+
+//------------------------------------------------------------------------
+// global vatiables
+//------------------------------------------------------------------------
+
+Link g_aEventListenerLink(NULL, VCLEventListenerLinkFunc);
+
+rtl::Reference< jvmaccess::UnoVirtualMachine > g_xUnoVirtualMachine;
+typelib_InterfaceTypeDescription * g_pTypeDescription = NULL;
+Mapping g_unoMapping;
+
+jclass g_jcWindowsAccessBridgeAdapter = NULL;
+jmethodID g_jmRegisterTopWindow = 0;
+jmethodID g_jmRevokeTopWindow = 0;
+
+//------------------------------------------------------------------------
+// functions
+//------------------------------------------------------------------------
+
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *, void *)
+{
+ return JNI_VERSION_1_2;
+}
+
+JNIEXPORT jbyteArray JNICALL
+Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_getProcessID(JNIEnv *pJNIEnv, jclass clazz)
+{
+ // Initialize global class and method references
+ g_jcWindowsAccessBridgeAdapter =
+ static_cast< jclass > (pJNIEnv->NewGlobalRef(clazz));
+ if (NULL == g_jcWindowsAccessBridgeAdapter) {
+ return 0; /* jni error occured */
+ }
+ g_jmRegisterTopWindow =
+ pJNIEnv->GetStaticMethodID(clazz, "registerTopWindow", "(ILcom/sun/star/accessibility/XAccessible;)V");
+ if (0 == g_jmRegisterTopWindow) {
+ return 0; /* jni error occured */
+ }
+ g_jmRevokeTopWindow =
+ pJNIEnv->GetStaticMethodID(clazz, "revokeTopWindow", "(ILcom/sun/star/accessibility/XAccessible;)V");
+ if (0 == g_jmRevokeTopWindow) {
+ return 0; /* jni error occured */
+ }
+
+ // Use the special protocol of XJavaVM.getJavaVM: If the passed in
+ // process ID has an extra 17th byte of value one, the returned any
+ // contains a pointer to a jvmaccess::UnoVirtualMachine, instead of
+ // the underlying JavaVM pointer:
+ jbyte processID[17];
+ rtl_getGlobalProcessId(reinterpret_cast<sal_uInt8 *> (processID));
+ // #i51265# we need a jvmaccess::UnoVirtualMachine pointer for the
+ // uno_getEnvironment() call later.
+ processID[16] = 1;
+
+ // Copy the result into a java byte[] and return.
+ jbyteArray jbaProcessID = pJNIEnv->NewByteArray(17);
+ pJNIEnv->SetByteArrayRegion(jbaProcessID, 0, 17, processID);
+ return jbaProcessID;
+}
+
+JNIEXPORT jboolean JNICALL
+Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_createMapping(JNIEnv *, jclass, jlong pointer)
+{
+ uno_Environment * pJava_environment = NULL;
+ uno_Environment * pUno_environment = NULL;
+
+ try {
+ // We get a non-refcounted pointer to a jvmaccess::VirtualMachine
+ // from the XJavaVM service (the pointer is guaranteed to be valid
+ // as long as our reference to the XJavaVM service lasts), and
+ // convert the non-refcounted pointer into a refcounted one
+ // immediately:
+ g_xUnoVirtualMachine = reinterpret_cast< jvmaccess::UnoVirtualMachine * >(pointer);
+
+ if ( g_xUnoVirtualMachine.is() )
+ {
+ OUString sJava(RTL_CONSTASCII_USTRINGPARAM("java"));
+ uno_getEnvironment(&pJava_environment, sJava.pData, g_xUnoVirtualMachine.get());
+
+ OUString sCppu_current_lb_name(RTL_CONSTASCII_USTRINGPARAM(CPPU_CURRENT_LANGUAGE_BINDING_NAME));
+ uno_getEnvironment(&pUno_environment, sCppu_current_lb_name.pData, NULL);
+
+ if ( pJava_environment && pUno_environment )
+ {
+ g_unoMapping = Mapping(pUno_environment, pJava_environment);
+ getCppuType((::com::sun::star::uno::Reference< XAccessible > *) 0).getDescription((typelib_TypeDescription **) & g_pTypeDescription);
+ }
+
+ if ( pJava_environment )
+ {
+ // release java environment
+ pJava_environment->release(pJava_environment);
+ pJava_environment = NULL;
+ }
+
+ if ( pUno_environment )
+ {
+ // release uno environment
+ pUno_environment->release(pUno_environment);
+ pUno_environment = NULL;
+ }
+ }
+ }
+
+ catch ( RuntimeException e)
+ {
+ OSL_TRACE("RuntimeException caught while initializing the mapping");
+ }
+
+ if ( (0 != g_jmRegisterTopWindow) && (0 != g_jmRevokeTopWindow) )
+ {
+ ::Application::AddEventListener(g_aEventListenerLink);
+ }
+ return JNI_TRUE;
+}
+
+JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *jvm, void *)
+{
+ ::Application::RemoveEventListener(g_aEventListenerLink);
+
+ if ( NULL != g_jcWindowsAccessBridgeAdapter )
+ {
+ JNIEnv * pJNIEnv;
+ if ( ! jvm->GetEnv((void **) &pJNIEnv, JNI_VERSION_1_2) )
+ {
+ pJNIEnv->DeleteGlobalRef(g_jcWindowsAccessBridgeAdapter);
+ g_jcWindowsAccessBridgeAdapter = NULL;
+ }
+ }
+
+ if ( NULL != g_pTypeDescription )
+ {
+ typelib_typedescription_release( reinterpret_cast< typelib_TypeDescription * > (g_pTypeDescription) );
+ g_pTypeDescription = NULL;
+ }
+
+ g_unoMapping.clear();
+ g_xUnoVirtualMachine.clear();
+}
+
+HWND GetHWND(Window * pWindow)
+{
+ const SystemEnvData * pEnvData = pWindow->GetSystemData();
+ if (pEnvData != NULL)
+ {
+ return pEnvData->hWnd;
+ }
+ return (HWND) -1;
+}
+
+void handleWindowEvent(Window * pWindow, bool bShow)
+{
+ if ( pWindow && pWindow->IsTopWindow() )
+ {
+ ::com::sun::star::uno::Reference< XAccessible > xAccessible;
+
+ // Test for combo box - drop down floating windows first
+ Window * pParentWindow = pWindow->GetParent();
+
+ if ( pParentWindow )
+ {
+ try
+ {
+ // The parent window of a combo box floating window should have the role COMBO_BOX
+ ::com::sun::star::uno::Reference< XAccessible > xParentAccessible(pParentWindow->GetAccessible());
+ if ( xParentAccessible.is() )
+ {
+ ::com::sun::star::uno::Reference< XAccessibleContext > xParentAC(xParentAccessible->getAccessibleContext());
+ if ( xParentAC.is() && (AccessibleRole::COMBO_BOX == xParentAC->getAccessibleRole()) )
+ {
+ // O.k. - this is a combo box floating window corresponding to the child of role LIST of the parent.
+ // Let's not rely on a specific child order, just search for the child with the role LIST
+ sal_Int32 nCount = xParentAC->getAccessibleChildCount();
+ for ( sal_Int32 n = 0; (n < nCount) && !xAccessible.is(); n++)
+ {
+ ::com::sun::star::uno::Reference< XAccessible > xChild = xParentAC->getAccessibleChild(n);
+ if ( xChild.is() )
+ {
+ ::com::sun::star::uno::Reference< XAccessibleContext > xChildAC = xChild->getAccessibleContext();
+ if ( xChildAC.is() && (AccessibleRole::LIST == xChildAC->getAccessibleRole()) )
+ {
+ xAccessible = xChild;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (::com::sun::star::uno::RuntimeException e)
+ {
+ // Ignore show events that throw DisposedExceptions in getAccessibleContext(),
+ // but keep revoking these windows in hide(s).
+ if (bShow)
+ return;
+ }
+ }
+
+ // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext
+ // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the
+ // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete.
+ if ( ! xAccessible.is() )
+ xAccessible = pWindow->GetAccessible();
+
+ if ( xAccessible.is() && g_unoMapping.is() )
+ {
+ jobject * joXAccessible = reinterpret_cast < jobject * > (g_unoMapping.mapInterface(
+ xAccessible.get(), g_pTypeDescription));
+
+ if ( NULL != joXAccessible )
+ {
+ jvmaccess::VirtualMachine::AttachGuard aGuard(g_xUnoVirtualMachine->getVirtualMachine());
+ JNIEnv * pJNIEnv = aGuard.getEnvironment();
+
+ if ( NULL != pJNIEnv )
+ {
+ // g_jmRegisterTopWindow and g_jmRevokeTopWindow are ensured to be != 0 - otherwise
+ // the event listener would not have been attached.
+ pJNIEnv->CallStaticVoidMethod(g_jcWindowsAccessBridgeAdapter,
+ (bShow) ? g_jmRegisterTopWindow : g_jmRevokeTopWindow,
+ (jint) GetHWND(pWindow), joXAccessible );
+
+ // Clear any exception that might have been occured.
+ if (pJNIEnv->ExceptionCheck()) {
+ pJNIEnv->ExceptionClear();
+ }
+ }
+ }
+ }
+ }
+}
+
+long VCLEventListenerLinkFunc(void *, void * pData)
+{
+ ::VclSimpleEvent const * pEvent = (::VclSimpleEvent const *) pData;
+
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ handleWindowEvent(((::VclWindowEvent const *) pEvent)->GetWindow(), true);
+ break;
+ case VCLEVENT_WINDOW_HIDE:
+ handleWindowEvent(((::VclWindowEvent const *) pEvent)->GetWindow(), false);
+ break;
+ }
+
+ return 0;
+}
diff --git a/accessibility/bridge/source/java/exports.dxp b/accessibility/bridge/source/java/exports.dxp
new file mode 100644
index 000000000000..c97dba7d0047
--- /dev/null
+++ b/accessibility/bridge/source/java/exports.dxp
@@ -0,0 +1,4 @@
+JNI_OnLoad
+JNI_OnUnload
+Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_getProcessID
+Java_org_openoffice_accessibility_WindowsAccessBridgeAdapter_createMapping
diff --git a/accessibility/bridge/source/java/makefile.mk b/accessibility/bridge/source/java/makefile.mk
new file mode 100644
index 000000000000..6bb380725ac0
--- /dev/null
+++ b/accessibility/bridge/source/java/makefile.mk
@@ -0,0 +1,70 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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=accessibility
+TARGET=accessbridge
+LIBTARGET=NO
+USE_DEFFILE=TRUE
+ENABLE_EXCEPTIONS=TRUE
+VERSIONOBJ=
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(GUI)"=="WNT"
+
+SLOFILES= $(SLO)$/WindowsAccessBridgeAdapter.obj
+
+SHL1TARGET=java_uno_accessbridge
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS=$(VCLLIB) $(TOOLSLIB) $(JVMACCESSLIB) $(CPPULIB) $(SALLIB)
+SHL1OBJS=$(SLOFILES)
+SHL1VERSIONOBJ=
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+SHL1HEADER=$(OUT)$/inc$/WindowsAccessBridgeAdapter.h
+
+.ENDIF # "$(GUI)"=="WNT"
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(GUI)"=="WNT"
+
+$(SLO)$/WindowsAccessBridgeAdapter.obj : $(SHL1HEADER)
+
+$(SHL1HEADER) :
+ javah -classpath $(OUT)$/class -o $(SHL1HEADER) org.openoffice.accessibility.WindowsAccessBridgeAdapter
+
+.ENDIF # "$(GUI)"=="WNT"
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx
new file mode 100644
index 000000000000..fd86653ca5ed
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBox.hxx
@@ -0,0 +1,311 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOX_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOX_HXX
+
+#include <accessibility/extended/AccessibleBrowseBoxBase.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <svtools/accessibletableprovider.hxx>
+
+
+#include <memory>
+
+// ============================================================================
+
+namespace accessibility {
+
+ class AccessibleBrowseBoxImpl;
+ class AccessibleBrowseBoxTable;
+
+// ============================================================================
+
+/** This class represents the complete accessible BrowseBox object. */
+class AccessibleBrowseBox : public AccessibleBrowseBoxBase
+{
+ friend class AccessibleBrowseBoxAccess;
+
+protected:
+ AccessibleBrowseBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator,
+ ::svt::IAccessibleTableProvider& _rBrowseBox
+ );
+
+ virtual ~AccessibleBrowseBox();
+
+ /** sets the XAccessible which created the context
+
+ <p>To be called only once, and only if in the ctor NULL was passed.</p>
+ */
+ void setCreator(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator
+ );
+
+ /** Cleans up members. */
+ using AccessibleBrowseBoxBase::disposing;
+ virtual void SAL_CALL disposing();
+
+protected:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return The count of visible children. */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the specified child. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The role of this object (a table). */
+// virtual sal_Int16 SAL_CALL getAccessibleRole()
+// throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return
+ The accessible child rendered under the given point.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to the BrowseBox. */
+ virtual void SAL_CALL grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The key bindings associated with this object. */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return
+ The name of this class.
+ */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+public:
+ // helper functions
+ /** commitHeaderBarEvent commit the event at all listeners of the column/row header bar
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitHeaderBarEvent(sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue,
+ const ::com::sun::star::uno::Any& rOldValue,sal_Bool _bColumnHeaderBar = sal_True);
+
+ // helper functions
+ /** commitTableEvent commit the event at all listeners of the table
+ @param nEventId
+ the event id
+ @param rNewValue
+ the new value
+ @param rOldValue
+ the old value
+ */
+ void commitTableEvent(sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue,
+ const ::com::sun::star::uno::Any& rOldValue);
+
+ /** returns the accessible object for the row or the column header bar
+ */
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType )
+ {
+ return implGetHeaderBar(_eObjType);
+ }
+
+ /** returns the accessible object for the table representation
+ */
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ getTable( )
+ {
+ return implGetTable();
+ }
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox();
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+ // internal helper methods ------------------------------------------------
+
+ /** This method creates (once) and returns the accessible data table child.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the data table. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > implGetTable();
+
+ /** This method creates (once) and returns the specified header bar.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the header bar. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ implGetHeaderBar( ::svt::AccessibleBrowseBoxObjType eObjType );
+
+ /** This method returns one of the children that are always present:
+ Data table, row and column header bar or corner control.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the specified child. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ implGetFixedChild( sal_Int32 nChildIndex );
+
+ /** This method creates and returns an accessible table.
+ @return An AccessibleBrowseBoxTable. */
+ virtual AccessibleBrowseBoxTable* createAccessibleTable();
+
+private:
+ // members ----------------------------------------------------------------
+ ::std::auto_ptr< AccessibleBrowseBoxImpl > m_pImpl;
+};
+
+// ============================================================================
+/** the XAccessible which creates/returns an AccessibleBrowseBox
+
+ <p>The instance holds it's XAccessibleContext with a hard reference, while
+ the contxt holds this instance weak.</p>
+*/
+typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible
+ > AccessibleBrowseBoxAccess_Base;
+
+class AccessibleBrowseBoxAccess :public AccessibleBrowseBoxAccess_Base
+ ,public ::svt::IAccessibleBrowseBox
+{
+private:
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xParent;
+ ::svt::IAccessibleTableProvider& m_rBrowseBox;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_xContext;
+ AccessibleBrowseBox* m_pContext;
+ // note that this pointer is valid as long as m_xContext is valid!
+
+public:
+ AccessibleBrowseBoxAccess(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ ::svt::IAccessibleTableProvider& _rBrowseBox
+ );
+
+ /// checks whether the accessible context is still alive
+ bool isContextAlive() const;
+
+ /// returns the AccessibleContext belonging to this Accessible
+ inline AccessibleBrowseBox* getContext() { return m_pContext; }
+ inline const AccessibleBrowseBox* getContext() const { return m_pContext; }
+
+protected:
+ virtual ~AccessibleBrowseBoxAccess();
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
+
+ // IAccessibleBrowseBox
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getMyself()
+ {
+ return this;
+ }
+ void dispose();
+ virtual sal_Bool isAlive() const
+ {
+ return isContextAlive();
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
+ AccessibleBrowseBox* pContext( getContext() );
+ if ( pContext )
+ xAccessible = pContext->getHeaderBar( _eObjType );
+ return xAccessible;
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getTable()
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
+ AccessibleBrowseBox* pContext( getContext() );
+ if ( pContext )
+ xAccessible = pContext->getTable();
+ return xAccessible;
+ }
+ virtual void commitHeaderBarEvent( sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue,
+ const ::com::sun::star::uno::Any& rOldValue, sal_Bool _bColumnHeaderBar )
+ {
+ AccessibleBrowseBox* pContext( getContext() );
+ if ( pContext )
+ pContext->commitHeaderBarEvent( nEventId, rNewValue, rOldValue, _bColumnHeaderBar );
+ }
+ virtual void commitTableEvent( sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue )
+ {
+ AccessibleBrowseBox* pContext( getContext() );
+ if ( pContext )
+ pContext->commitTableEvent( nEventId, rNewValue, rOldValue );
+ }
+ virtual void commitEvent( sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue )
+ {
+ AccessibleBrowseBox* pContext( getContext() );
+ if ( pContext )
+ pContext->commitEvent( nEventId, rNewValue, rOldValue );
+ }
+
+private:
+ AccessibleBrowseBoxAccess(); // never implemented
+ AccessibleBrowseBoxAccess( const AccessibleBrowseBoxAccess& ); // never implemented
+ AccessibleBrowseBoxAccess& operator=( const AccessibleBrowseBoxAccess& ); // never implemented
+};
+
+// ============================================================================
+} // namespace accessibility
+
+// ============================================================================
+
+#endif
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx
new file mode 100644
index 000000000000..dc43e500dadd
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxBase.hxx
@@ -0,0 +1,527 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXBASE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXBASE_HXX
+
+#include <svtools/AccessibleBrowseBoxObjType.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <vcl/svapp.hxx>
+#include <cppuhelper/compbase5.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/uno3.hxx>
+
+// ============================================================================
+
+class Window;
+
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+namespace svt {
+ class IAccessibleTableProvider;
+}
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+/** Aquire the solar mutex. */
+class BBSolarGuard : public ::vos::OGuard
+{
+public:
+ inline BBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
+};
+
+// ============================================================================
+
+typedef ::cppu::WeakAggComponentImplHelper5<
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::awt::XFocusListener,
+ ::com::sun::star::lang::XServiceInfo >
+ AccessibleBrowseBoxImplHelper;
+
+/** The BrowseBox accessible objects inherit from this base class. It
+ implements basic functionality for various Accessibility interfaces and
+ the event broadcaster and contains the ::osl::Mutex. */
+class AccessibleBrowseBoxBase :
+ public ::comphelper::OBaseMutex,
+ public AccessibleBrowseBoxImplHelper
+{
+public:
+ /** Constructor sets specified name and description. If the constant of a
+ text is BBTEXT_NONE, the derived class has to set the text via
+ implSetName() and implSetDescription() (in Ctor) or later via
+ setAccessibleName() and setAccessibleDescription() (these methods
+ notify the listeners about the change).
+ @param rxParent XAccessible interface of the parent object.
+ @param rBrowseBox The BrowseBox control.
+ @param eNameText The constant for the name text.
+ @param eDescrText The constant for the description text. */
+ AccessibleBrowseBoxBase(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ ::svt::AccessibleBrowseBoxObjType eObjType );
+
+ /** Constructor sets specified name and description.
+ @param rxParent XAccessible interface of the parent object.
+ @param rBrowseBox The BrowseBox control.
+ @param rName The name of this object.
+ @param rDescription The description text of this object. */
+ AccessibleBrowseBoxBase(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ ::svt::AccessibleBrowseBoxObjType eObjType,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rDescription );
+
+protected:
+ virtual ~AccessibleBrowseBoxBase();
+
+ /** Commits DeFunc event to listeners and cleans up members. */
+ virtual void SAL_CALL disposing();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return A reference to the parent accessible object. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The description of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The name of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The relation set (the BrowseBox does not have one).
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
+ getAccessibleRelationSet()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The set of current states. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
+ getAccessibleStateSet()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The parent's locale. */
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale()
+ throw ( ::com::sun::star::accessibility::IllegalAccessibleComponentStateException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported.
+ */
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getAccessibleChildCount,
+ - getAccessibleChild,
+ - getAccessibleRole.
+ Derived classes may overwrite getAccessibleIndexInParent to increase
+ performance. */
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return
+ <TRUE/>, if the point lies within the bounding box of this object. */
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The bounding box of this object. */
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The upper left corner of the bounding box relative to the parent. */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The upper left corner of the bounding box in screen coordinates. */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The size of the bounding box. */
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the object is showing. */
+ virtual sal_Bool SAL_CALL isShowing()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the object is visible. */
+ virtual sal_Bool SAL_CALL isVisible()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the object can accept the focus. */
+ virtual sal_Bool SAL_CALL isFocusTraversable()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XFocusListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ /* Derived classes have to implement:
+ - getAccessibleAt,
+ - grabFocus,
+ - getAccessibleKeyBinding. */
+
+ /** @return
+ No key bindings supported by default.
+ */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+ /** @return
+ The accessible child rendered under the given point.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleEventBroadcaster --------------------------------------------
+
+ /** Adds a new event listener */
+ using cppu::WeakAggComponentImplHelperBase::addEventListener;
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Removes an event listener. */
+ using cppu::WeakAggComponentImplHelperBase::removeEventListener;
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XTypeProvider ----------------------------------------------------------
+
+ /** @return An unique implementation ID. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return Whether the specified service is supported by this class. */
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return A list of all supported services. */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getImplementationName. */
+
+ // helper methods ---------------------------------------------------------
+
+ /** @return The BrowseBox object type. */
+ inline ::svt::AccessibleBrowseBoxObjType getType() const;
+
+ /** Changes the name of the object and notifies listeners. */
+ void setAccessibleName( const ::rtl::OUString& rName );
+ /** Changes the description of the object and notifies listeners. */
+ void setAccessibleDescription( const ::rtl::OUString& rDescription );
+
+ /** Commits an event to all listeners. */
+ void commitEvent(
+ sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue,
+
+ const ::com::sun::star::uno::Any& rOldValue );
+ /** @return <TRUE/>, if the object is not disposed or disposing. */
+ sal_Bool isAlive() const;
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** Determines whether the BrowseBox control is really showing inside of
+ its parent accessible window. Derived classes may implement different
+ behaviour.
+ @attention This method requires locked mutex's and a living object.
+ @return <TRUE/>, if the object is really showing. */
+ virtual sal_Bool implIsShowing();
+
+ /** Derived classes return the bounding box relative to the parent window.
+ @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox() = 0;
+ /** Derived classes return the bounding box in screen coordinates.
+ @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen() = 0;
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object. This method calls FillStateSet at the BrowseBox which
+ fills it with more states depending on the object type. Derived classes
+ may overwrite this method and add more states.
+ @attention This method requires locked mutex's.
+ @return A filled AccessibleStateSetHelper. */
+ virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+
+ // internal helper methods ------------------------------------------------
+
+ /** @throws <type>DisposedException</type> If the object is not alive. */
+ void ensureIsAlive() const
+ throw ( ::com::sun::star::lang::DisposedException );
+
+ /** @return The ::osl::Mutex member provided by the class OBaseMutex. */
+ inline ::osl::Mutex& getOslMutex();
+ /** @return Pointer to the global ::osl::Mutex. */
+ static inline ::osl::Mutex* getOslGlobalMutex();
+
+ /** Changes the name of the object (flat assignment, no notify).
+ @attention This method requires a locked mutex. */
+ inline void implSetName( const ::rtl::OUString& rName );
+ /** Changes the description of the object (flat assignment, no notify).
+ @attention This method requires a locked mutex. */
+ inline void implSetDescription( const ::rtl::OUString& rDescription );
+
+ /** Locks all mutex's and calculates the bounding box relative to the
+ parent window.
+ @return The bounding box (VCL rect.) relative to the parent object. */
+ Rectangle getBoundingBox()
+ throw ( ::com::sun::star::lang::DisposedException );
+ /** Locks all mutex's and calculates the bounding box in screen
+ coordinates.
+ @return The bounding box (VCL rect.) in screen coordinates. */
+ Rectangle getBoundingBoxOnScreen()
+ throw ( ::com::sun::star::lang::DisposedException );
+
+ /** Creates a new UUID, if rId is empty.
+ @attention This method requires locked global mutex to prevent double
+ creation of an UUID. */
+ static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId );
+
+ ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; }
+ void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; }
+
+public:
+ // public versions of internal helper methods, with access control
+ struct AccessControl { friend class SolarMethodGuard; private: AccessControl() { } };
+
+ inline ::osl::Mutex& getMutex( const AccessControl& ) { return getOslMutex(); }
+ inline void ensureIsAlive( const AccessControl& ) { ensureIsAlive(); }
+
+protected:
+ // members ----------------------------------------------------------------
+
+ /** The parent accessible object. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > mxParent;
+ /** The VCL BrowseBox control. */
+ ::svt::IAccessibleTableProvider* mpBrowseBox;
+
+ /** This is the window which get all the nice focus events
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xFocusWindow;
+
+private:
+ /** Localized name. */
+ ::rtl::OUString maName;
+ /** Localized description text. */
+ ::rtl::OUString maDescription;
+
+ /** The type of this object (for names, descriptions, state sets, ...). */
+ ::svt::AccessibleBrowseBoxObjType meObjType;
+
+ ::comphelper::AccessibleEventNotifier::TClientId m_aClientId;
+};
+
+// ============================================================================
+// a version of AccessibleBrowseBoxBase which implements not only the XAccessibleContext,
+// but also the XAccessible
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible
+ > BrowseBoxAccessibleElement_Base;
+
+class BrowseBoxAccessibleElement
+ :public AccessibleBrowseBoxBase
+ ,public BrowseBoxAccessibleElement_Base
+{
+protected:
+ /** Constructor sets specified name and description. If the constant of a
+ text is BBTEXT_NONE, the derived class has to set the text via
+ implSetName() and implSetDescription() (in Ctor) or later via
+ setAccessibleName() and setAccessibleDescription() (these methods
+ notify the listeners about the change).
+
+ @param rxParent XAccessible interface of the parent object.
+ @param rBrowseBox The BrowseBox control.
+ @param eNameText The constant for the name text.
+ @param eDescrText The constant for the description text.
+ */
+ BrowseBoxAccessibleElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ ::svt::AccessibleBrowseBoxObjType eObjType );
+
+ /** Constructor sets specified name and description.
+
+ @param rxParent XAccessible interface of the parent object.
+ @param rBrowseBox The BrowseBox control.
+ @param rName The name of this object.
+ @param rDescription The description text of this object.
+ */
+ BrowseBoxAccessibleElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ ::svt::AccessibleBrowseBoxObjType eObjType,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rDescription );
+
+public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+protected:
+ virtual ~BrowseBoxAccessibleElement();
+
+protected:
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+private:
+ BrowseBoxAccessibleElement(); // never implemented
+ BrowseBoxAccessibleElement( const BrowseBoxAccessibleElement& ); // never implemented
+ BrowseBoxAccessibleElement& operator=( const BrowseBoxAccessibleElement& ); // never implemented
+};
+
+// ============================================================================
+// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex
+
+typedef ::osl::MutexGuard OslMutexGuard;
+
+class SolarMethodGuard : public BBSolarGuard, public OslMutexGuard
+{
+public:
+ inline SolarMethodGuard( AccessibleBrowseBoxBase& _rOwner, bool _bEnsureAlive = true )
+ :BBSolarGuard( )
+ ,OslMutexGuard( _rOwner.getMutex( AccessibleBrowseBoxBase::AccessControl() ) )
+ {
+ if ( _bEnsureAlive )
+ _rOwner.ensureIsAlive( AccessibleBrowseBoxBase::AccessControl() );
+ }
+};
+
+// inlines --------------------------------------------------------------------
+
+inline ::svt::AccessibleBrowseBoxObjType AccessibleBrowseBoxBase::getType() const
+{
+ return meObjType;
+}
+
+inline ::osl::Mutex& AccessibleBrowseBoxBase::getOslMutex()
+{
+ return m_aMutex;
+}
+
+inline ::osl::Mutex* AccessibleBrowseBoxBase::getOslGlobalMutex()
+{
+ return ::osl::Mutex::getGlobalMutex();
+}
+
+inline void AccessibleBrowseBoxBase::implSetName(
+ const ::rtl::OUString& rName )
+{
+ maName = rName;
+}
+
+inline void AccessibleBrowseBoxBase::implSetDescription(
+ const ::rtl::OUString& rDescription )
+{
+ maDescription = rDescription;
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx
new file mode 100644
index 000000000000..1ade2b6289f5
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX
+
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#ifndef ACCESSIBILITY_EXT_BROWSE_BOX_CELL_HXX
+#include "accessibility/extended/accessiblebrowseboxcell.hxx"
+#endif
+#include <cppuhelper/implbase2.hxx>
+#include <tools/wintypes.hxx>
+// ============================================================================
+namespace accessibility
+{
+// ============================================================================
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleValue
+ > AccessibleCheckBoxCell_BASE;
+
+ class AccessibleCheckBoxCell : public AccessibleBrowseBoxCell
+ ,public AccessibleCheckBoxCell_BASE
+ {
+ private:
+ TriState m_eState;
+ sal_Bool m_bEnabled;
+ sal_Bool m_bIsTriState;
+
+ protected:
+ virtual ~AccessibleCheckBoxCell() {}
+
+ virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+
+ public:
+ AccessibleCheckBoxCell(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ ::svt::IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ const TriState& _eState,
+ sal_Bool _bEnabled,
+ sal_Bool _bIsTriState = sal_True);
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XAccessibleValue
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // internal
+ void SetChecked( sal_Bool _bChecked );
+ };
+}
+#endif // ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXCHECKBOXCELL_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx
new file mode 100644
index 000000000000..ac0b2761eb1f
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERBAR_HXX
+
+#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+typedef ::cppu::ImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleSelection >
+ AccessibleBrowseBoxHeaderBarImplHelper;
+
+/** This class represents the accessible object of a header bar of a BrowseBox
+ control (row or column header bar). This object supports the
+ XAccessibleSelection interface. Selecting a child of this object selects
+ complete rows or columns of the data table. */
+class AccessibleBrowseBoxHeaderBar :
+ public AccessibleBrowseBoxTableBase,
+ public AccessibleBrowseBoxHeaderBarImplHelper
+{
+public:
+ /** @param eObjType One of the two allowed types BBTYPE_ROWHEADERBAR or
+ BBTYPE_COLUMNHEADERBAR. */
+ AccessibleBrowseBoxHeaderBar(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& rBrowseBox,
+ ::svt::AccessibleBrowseBoxObjType eObjType );
+
+protected:
+ virtual ~AccessibleBrowseBoxHeaderBar();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return
+ The XAccessible interface of the specified child.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return The accessible child rendered under the given point. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to (the current cell of) the data table. */
+ virtual void SAL_CALL grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The key bindings associated with this object. */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleTable -------------------------------------------------------
+
+ /** @return The description text of the specified row. */
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The description text of the specified column. */
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the row header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleRowHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the column header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleColumnHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected rows. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleRows()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected columns. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleColumns()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified row is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified column is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the cell object at the specified
+ cell position. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified cell is selected. */
+ virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleSelection ---------------------------------------------------
+
+ /** Selects the specified child (row or column of the table). */
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified child (row/column) is selected. */
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** Clears the complete selection. */
+ virtual void SAL_CALL clearAccessibleSelection()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Selects all children or first, if multiselection is not supported. */
+ virtual void SAL_CALL selectAllAccessibleChildren()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The number of selected rows/columns. */
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The specified selected row/column. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** Removes the specified row/column from the selection. */
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Aquires the object (calls acquire() on base class). */
+ virtual void SAL_CALL acquire() throw ();
+
+ /** Releases the object (calls release() on base class). */
+ virtual void SAL_CALL release() throw ();
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return The name of this class. */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An unique implementation ID. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox();
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of used rows. */
+ virtual sal_Int32 implGetRowCount() const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of used columns. */
+ virtual sal_Int32 implGetColumnCount() const;
+
+ // internal helper methods ------------------------------------------------
+
+ /** @return <TRUE/>, if the objects is a header bar for rows. */
+ inline sal_Bool isRowBar() const;
+ /** @return <TRUE/>, if the objects is a header bar for columns. */
+ inline sal_Bool isColumnBar() const;
+
+ /** Returns the specified row or column. Uses one of the parameters,
+ depending on object type.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the specified column/row. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ implGetChild( sal_Int32 nRow, sal_uInt16 nColumnPos );
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The absolute child index from the index of selected children.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified index is invalid. */
+ sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified row/column index (depending on type) is invalid. */
+ void ensureIsValidHeaderIndex( sal_Int32 nIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+};
+
+// inlines --------------------------------------------------------------------
+
+inline sal_Bool AccessibleBrowseBoxHeaderBar::isRowBar() const
+{
+ return getType() == ::svt::BBTYPE_ROWHEADERBAR;
+}
+
+inline sal_Bool AccessibleBrowseBoxHeaderBar::isColumnBar() const
+{
+ return getType() == ::svt::BBTYPE_COLUMNHEADERBAR;
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx
new file mode 100644
index 000000000000..68d4405ff25b
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX
+
+#include "accessibility/extended/AccessibleBrowseBoxBase.hxx"
+
+namespace accessibility
+{
+ class AccessibleBrowseBoxHeaderCell : public BrowseBoxAccessibleElement
+ {
+ sal_Int32 m_nColumnRowId;
+ public:
+ AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ ::svt::AccessibleBrowseBoxObjType _eObjType);
+ /** @return The count of visible children. */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the specified child. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to the BrowseBox. */
+ virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException );
+
+ inline sal_Bool isRowBarCell() const
+ {
+ return getType() == ::svt::BBTYPE_ROWHEADERCELL;
+ }
+
+ /** @return
+ The name of this class.
+ */
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+ */
+ ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+
+ protected:
+ virtual Rectangle implGetBoundingBox();
+
+ virtual Rectangle implGetBoundingBoxOnScreen();
+ };
+}
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXHEADERCELL_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx
new file mode 100644
index 000000000000..afb345487239
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTable.hxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLE_HXX
+
+#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx"
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+/** This class represents the accessible object of the data table of a
+ BrowseBox control. */
+class AccessibleBrowseBoxTable : public AccessibleBrowseBoxTableBase
+{
+ friend class AccessibleBrowseBox; // to create header bars
+
+public:
+ AccessibleBrowseBoxTable(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& rBrowseBox );
+
+protected:
+ virtual ~AccessibleBrowseBoxTable();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return The XAccessible interface of the specified child. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return The accessible child rendered under the given point. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to (the current cell of) the data table. */
+ virtual void SAL_CALL grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The key bindings associated with this object. */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleTable -------------------------------------------------------
+
+ /** @return The description text of the specified row. */
+ virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The description text of the specified column. */
+ virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the row header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleRowHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the column header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleColumnHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected rows. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleRows()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected columns. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleColumns()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified row is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified column is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the cell object at the specified
+ cell position. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified cell is selected. */
+ virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return The name of this class. */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox();
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+ // internal helper methods ------------------------------------------------
+
+ /** @attention This method requires a locked mutex.
+ @return The XAccessibleTable interface of the specified header bar. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ implGetHeaderBar( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::uno::RuntimeException );
+};
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx
new file mode 100644
index 000000000000..fa6ce94cfc7f
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableBase.hxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEBROWSEBOXTABLEBASE_HXX
+
+#include "accessibility/extended/AccessibleBrowseBoxBase.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+
+// ============================================================================
+
+namespace accessibility {
+
+typedef ::cppu::ImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ AccessibleBrowseBoxTableImplHelper;
+
+/** The BrowseBox accessible table objects inherit from this base class. It
+ implements basic functionality for the XAccessibleTable interface.
+ BrowseBox table objects are: the data table, the column header bar and the
+ row header bar. */
+class AccessibleBrowseBoxTableBase :
+ public BrowseBoxAccessibleElement,
+ public AccessibleBrowseBoxTableImplHelper
+{
+public:
+ /** Constructor sets specified name and description. If the constant of a
+ text is BBTEXT_NONE, the derived class has to set the text via
+ implSetName() and implSetDescription() (in Ctor) or later via
+ setAccessibleName() and setAccessibleDescription() (these methods
+ notify the listeners about the change).
+ @param rxParent XAccessible interface of the parent object.
+ @param rBrowseBox The BrowseBox control.
+ @param eNameText The constant for the name text.
+ @param eDescrText The constant for the description text. */
+ AccessibleBrowseBoxTableBase(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::IAccessibleTableProvider& rBrowseBox,
+ ::svt::AccessibleBrowseBoxObjType eObjType );
+
+protected:
+ virtual ~AccessibleBrowseBoxTableBase();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return The count of visible children. */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The role of this object (a table). */
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getAccessibleChild,
+ - getAccessibleIndexInParent. */
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /* Derived classes have to implement:
+ - getAccessibleAt,
+ - grabFocus,
+ - getAccessibleKeyBinding. */
+
+ // XAccessibleTable -------------------------------------------------------
+
+ /** @return The number of used rows in the table (0 = empty table). */
+ virtual sal_Int32 SAL_CALL getAccessibleRowCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The number of used columns in the table (0 = empty table). */
+ virtual sal_Int32 SAL_CALL getAccessibleColumnCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The row extent of the specified cell (always 1). */
+ virtual sal_Int32 SAL_CALL
+ getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The column extent of the specified cell (always 1). */
+ virtual sal_Int32 SAL_CALL
+ getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The caption cell of the table (not supported). */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCaption()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The summary object of the table (not supported). */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleSummary()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The child index of the specified cell. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The row index of the specified child cell. */
+ virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The column index of the specified child cell. */
+ virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getAccessibleRowDescription,
+ - getAccessibleColumnDescription,
+ - getAccessibleRowHeaders,
+ - getAccessibleColumnHeaders,
+ - getSelectedAccessibleRows,
+ - getSelectedAccessibleColumns,
+ - isAccessibleRowSelected,
+ - isAccessibleColumnSelected,
+ - getAccessibleCellAt,
+ - isAccessibleSelected. */
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Aquires the object (calls acquire() on base class). */
+ virtual void SAL_CALL acquire() throw ();
+
+ /** Releases the object (calls release() on base class). */
+ virtual void SAL_CALL release() throw ();
+
+ // XTypeProvider ----------------------------------------------------------
+
+ /** @return A sequence of possible types (received from base classes). */
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An unique implementation ID. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /* Derived classes have to implement:
+ - getImplementationName */
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of data rows without header bar. */
+ virtual sal_Int32 implGetRowCount() const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of data columns without "handle column". */
+ virtual sal_Int32 implGetColumnCount() const;
+
+ // internal helper methods ------------------------------------------------
+
+ /** @return <TRUE/>, if first BrowseBox column is the "handle column". */
+ sal_Bool implHasHandleColumn() const;
+
+ /** @attention This method requires locked mutex's and a living object.
+ @param nColumn
+ the position of the column in the Accessible world
+ @return
+ the position of the column in VCL the Accessible world
+ */
+ sal_uInt16 implToVCLColumnPos( sal_Int32 nColumn ) const;
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The number of cells of the table. */
+ sal_Int32 implGetChildCount() const;
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The row index of the specified cell index. */
+ sal_Int32 implGetRow( sal_Int32 nChildIndex ) const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The column index of the specified cell index. */
+ sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The child index of the specified cell address. */
+ sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const;
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return <TRUE/>, if the specified row is selected. */
+ sal_Bool implIsRowSelected( sal_Int32 nRow ) const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return <TRUE/>, if the specified column is selected. */
+ sal_Bool implIsColumnSelected( sal_Int32 nColumn ) const;
+
+ /** Selects/deselects a row (tries to expand selection).
+ @attention This method requires locked mutex's and a living object.
+ @param bSelect <TRUE/> = select, <FALSE/> = deselect */
+ void implSelectRow( sal_Int32 nRow, sal_Bool bSelect );
+ /** Selects/deselects a column (tries to expand selection).
+ @attention This method requires locked mutex's and a living object.
+ @param bSelect <TRUE/> = select, <FALSE/> = deselect */
+ void implSelectColumn( sal_Int32 nColumnPos, sal_Bool bSelect );
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of selected rows. */
+ sal_Int32 implGetSelectedRowCount() const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of selected columns. */
+ sal_Int32 implGetSelectedColumnCount() const;
+
+ /** Fills a sequence with sorted indexes of completely selected rows.
+ @attention This method requires locked mutex's and a living object.
+ @param rSeq Out-parameter that takes the sorted row index list. */
+ void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq );
+ /** Fills a sequence with sorted indexes of completely selected columns.
+ @attention This method requires locked mutex's and a living object.
+ @param rSeq Out-parameter that takes the sorted column index list. */
+ void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq );
+
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified row index is invalid. */
+ void ensureIsValidRow( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified column index is invalid. */
+ void ensureIsValidColumn( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified cell address is invalid. */
+ void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified child index is invalid. */
+ void ensureIsValidIndex( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+};
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx
new file mode 100644
index 000000000000..ec12e40dc179
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleBrowseBoxTableCell.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX
+
+#include "accessibility/extended/accessiblebrowseboxcell.hxx"
+#include <comphelper/accessibletexthelper.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+namespace accessibility
+{
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessibleText
+ , ::com::sun::star::accessibility::XAccessible
+ > AccessibleTextHelper_BASE;
+
+ // implementation of a table cell of BrowseBox
+ class AccessibleBrowseBoxTableCell :public AccessibleBrowseBoxCell
+ ,public AccessibleTextHelper_BASE
+ ,public ::comphelper::OCommonAccessibleText
+ {
+ private:
+ sal_Int32 m_nOffset;
+
+ protected:
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+ public:
+ AccessibleBrowseBoxTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ ::svt::IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowId,
+ sal_uInt16 _nColId,
+ sal_Int32 _nOffset );
+
+ void nameChanged( const ::rtl::OUString& rNewName, const ::rtl::OUString& rOldName );
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Aquires the object (calls acquire() on base class). */
+ virtual void SAL_CALL acquire() throw ();
+
+ /** Releases the object (calls release() on base class). */
+ virtual void SAL_CALL release() throw ();
+
+ // XEventListener
+ using AccessibleBrowseBoxBase::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The name of this class.
+ */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The count of visible children.
+ */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The XAccessible interface of the specified child.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+ */
+ ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif // ACCESSIBILITY_EXT_ACCESSIBILEBROWSEBOXTABLECELL_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
new file mode 100755
index 000000000000..cb2c4f6628c8
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControl.hxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROL_HXX
+
+#include <accessibility/extended/AccessibleGridControlBase.hxx>
+#include <accessibility/extended/AccessibleGridControlTable.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <svtools/accessibletable.hxx>
+
+
+#include <memory>
+
+using namespace ::svt::table;
+
+// ============================================================================
+
+namespace accessibility {
+
+ class AccessibleGridControl_Impl;
+
+// ============================================================================
+
+/** This class represents the complete accessible Grid Control object. */
+class AccessibleGridControl : public AccessibleGridControlBase
+{
+ friend class AccessibleGridControlAccess;
+
+protected:
+ AccessibleGridControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator,
+ ::svt::table::IAccessibleTable& _rTable
+ );
+
+ virtual ~AccessibleGridControl();
+
+ /** Cleans up members. */
+ using AccessibleGridControlBase::disposing;
+ virtual void SAL_CALL disposing();
+
+protected:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return The count of visible children. */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the specified child. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The role of this object (a table). */
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return
+ The accessible child rendered under the given point.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to the Grid Control. */
+ virtual void SAL_CALL grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The key bindings associated with this object. */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return
+ The name of this class.
+ */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+public:
+ // helper functions
+ /** returns the accessible object for the row or the column header bar
+ */
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ getHeaderBar( ::svt::table::AccessibleTableControlObjType _eObjType )
+ {
+ return implGetHeaderBar(_eObjType);
+ }
+
+ /** returns the accessible object for the table representation
+ */
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ getTable( )
+ {
+ return implGetTable();
+ }
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox();
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+ // internal helper methods ------------------------------------------------
+
+ /** This method creates (once) and returns the accessible data table child.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the data table. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > implGetTable();
+
+ /** This method creates (once) and returns the specified header bar.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the header bar. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ implGetHeaderBar( ::svt::table::AccessibleTableControlObjType eObjType );
+
+ /** This method returns one of the children that are always present:
+ Data table, row and column header bar or corner control.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the specified child. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ implGetFixedChild( sal_Int32 nChildIndex );
+
+ /** This method creates and returns an accessible table.
+ @return An AccessibleGridControlTable. */
+ virtual AccessibleGridControlTable* createAccessibleTable();
+
+private:
+ // members ----------------------------------------------------------------
+ ::std::auto_ptr< AccessibleGridControl_Impl > m_pImpl;
+};
+
+// ============================================================================
+/** the XAccessible which creates/returns an AccessibleGridControl
+
+ <p>The instance holds it's XAccessibleContext with a hard reference, while
+ the contxt holds this instance weak.</p>
+*/
+typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessible > AccessibleGridControlAccess_Base;
+
+class AccessibleGridControlAccess :public AccessibleGridControlAccess_Base
+ ,public ::svt::table::IAccessibleTableControl
+{
+private:
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xParent;
+ ::svt::table::IAccessibleTable& m_rTable;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_xContext;
+ AccessibleGridControl* m_pContext;
+ // note that this pointer is valid as long as m_xContext is valid!
+
+public:
+ AccessibleGridControlAccess(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ ::svt::table::IAccessibleTable& _rTable
+ );
+
+ /// checks whether the accessible context is still alive
+ bool isContextAlive() const;
+
+ /// returns the AccessibleContext belonging to this Accessible
+ inline AccessibleGridControl* getContext() { return m_pContext; }
+ inline const AccessibleGridControl* getContext() const { return m_pContext; }
+
+protected:
+ virtual ~AccessibleGridControlAccess();
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
+
+ // IAccessibleTable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getMyself()
+ {
+ return this;
+ }
+ void dispose();
+ virtual sal_Bool isAlive() const
+ {
+ return isContextAlive();
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getTableHeader( ::svt::table::AccessibleTableControlObjType _eObjType )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
+ AccessibleGridControl* pContext( getContext() );
+ if ( pContext )
+ xAccessible = pContext->getHeaderBar( _eObjType );
+ return xAccessible;
+ }
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getTable()
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccessible;
+ AccessibleGridControl* pContext( getContext() );
+ if ( pContext )
+ xAccessible = pContext->getTable();
+ return xAccessible;
+ }
+ virtual void commitEvent( sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue, const ::com::sun::star::uno::Any& rOldValue )
+ {
+ AccessibleGridControl* pContext( getContext() );
+ if ( pContext )
+ pContext->commitEvent( nEventId, rNewValue, rOldValue );
+ }
+
+private:
+ AccessibleGridControlAccess(); // never implemented
+ AccessibleGridControlAccess( const AccessibleGridControlAccess& ); // never implemented
+ AccessibleGridControlAccess& operator=( const AccessibleGridControlAccess& ); // never implemented
+};
+
+// ============================================================================
+} // namespace accessibility
+
+// ============================================================================
+
+#endif
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
new file mode 100644
index 000000000000..c6a26d8c4548
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlBase.hxx
@@ -0,0 +1,467 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLBASE_HXX
+
+#include <svtools/accessibletable.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustring.hxx>
+#include <tools/gen.hxx>
+#include <vcl/svapp.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/uno3.hxx>
+
+// ============================================================================
+
+class Window;
+
+namespace utl {
+ class AccessibleStateSetHelper;
+}
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+/** Aquire the solar mutex. */
+class TCSolarGuard : public ::vos::OGuard
+{
+public:
+ inline TCSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
+};
+
+// ============================================================================
+
+typedef ::cppu::WeakAggComponentImplHelper4<
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo >
+ AccessibleGridControlImplHelper;
+
+/** The GridControl accessible objects inherit from this base class. It
+ implements basic functionality for various Accessibility interfaces and
+ the event broadcaster and contains the ::osl::Mutex. */
+class AccessibleGridControlBase :
+ public ::comphelper::OBaseMutex,
+ public AccessibleGridControlImplHelper
+{
+public:
+ /** Constructor sets specified name and description.
+ @param rxParent XAccessible interface of the parent object.
+ @param rTable The Table control.
+ @param eNameText The constant for the name text.
+ @param eDescrText The constant for the description text. */
+ AccessibleGridControlBase(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType eObjType );
+
+protected:
+ virtual ~AccessibleGridControlBase();
+
+ /** Commits DeFunc event to listeners and cleans up members. */
+ virtual void SAL_CALL disposing();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return A reference to the parent accessible object. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The description of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The name of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The relation set (the GridControl does not have one).
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
+ getAccessibleRelationSet()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The set of current states. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
+ getAccessibleStateSet()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The parent's locale. */
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale()
+ throw ( ::com::sun::star::accessibility::IllegalAccessibleComponentStateException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The role of this object. Panel, ROWHEADER, COLUMNHEADER, TABLE, TABLE_CELL are supported.
+ */
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getAccessibleChildCount,
+ - getAccessibleChild,
+ - getAccessibleRole.
+ Derived classes may overwrite getAccessibleIndexInParent to increase
+ performance. */
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return
+ <TRUE/>, if the point lies within the bounding box of this object. */
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The bounding box of this object. */
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The upper left corner of the bounding box relative to the parent. */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The upper left corner of the bounding box in screen coordinates. */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The size of the bounding box. */
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the object is showing. */
+ virtual sal_Bool SAL_CALL isShowing()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the object is visible. */
+ virtual sal_Bool SAL_CALL isVisible()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the object can accept the focus. */
+ virtual sal_Bool SAL_CALL isFocusTraversable()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ /* Derived classes have to implement:
+ - getAccessibleAt,
+ - grabFocus,
+ - getAccessibleKeyBinding. */
+
+ /** @return
+ No key bindings supported by default.
+ */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+ /** @return
+ The accessible child rendered under the given point.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleEventBroadcaster --------------------------------------------
+
+ /** Adds a new event listener */
+ using cppu::WeakAggComponentImplHelperBase::addEventListener;
+ virtual void SAL_CALL addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Removes an event listener. */
+ using cppu::WeakAggComponentImplHelperBase::removeEventListener;
+ virtual void SAL_CALL removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener>& rxListener )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XTypeProvider ----------------------------------------------------------
+
+ /** @return An unique implementation ID. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return Whether the specified service is supported by this class. */
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return A list of all supported services. */
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getImplementationName. */
+
+ // helper methods ---------------------------------------------------------
+
+ /** @return The GridControl object type. */
+ inline ::svt::table::AccessibleTableControlObjType getType() const;
+
+ /** Commits an event to all listeners. */
+ void commitEvent(
+ sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue,
+
+ const ::com::sun::star::uno::Any& rOldValue );
+ /** @return <TRUE/>, if the object is not disposed or disposing. */
+ sal_Bool isAlive() const;
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** Determines whether the Grid control is really showing inside of
+ its parent accessible window. Derived classes may implement different
+ behaviour.
+ @attention This method requires locked mutex's and a living object.
+ @return <TRUE/>, if the object is really showing. */
+ virtual sal_Bool implIsShowing();
+
+ /** Derived classes return the bounding box relative to the parent window.
+ @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox() = 0;
+ ///** Derived classes return the bounding box in screen coordinates.
+ // @attention This method requires locked mutex's and a living object.
+ // @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen() = 0;
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object. This method calls FillStateSet at the GridControl which
+ fills it with more states depending on the object type. Derived classes
+ may overwrite this method and add more states.
+ @attention This method requires locked mutex's.
+ @return A filled AccessibleStateSetHelper. */
+ virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+
+ // internal helper methods ------------------------------------------------
+
+ /** @throws <type>DisposedException</type> If the object is not alive. */
+ void ensureIsAlive() const
+ throw ( ::com::sun::star::lang::DisposedException );
+
+ /** @return The ::osl::Mutex member provided by the class OBaseMutex. */
+ inline ::osl::Mutex& getOslMutex();
+ /** @return Pointer to the global ::osl::Mutex. */
+ static inline ::osl::Mutex* getOslGlobalMutex();
+
+ /** Changes the name of the object (flat assignment, no notify).
+ @attention This method requires a locked mutex. */
+ inline void implSetName( const ::rtl::OUString& rName );
+ /** Changes the description of the object (flat assignment, no notify).
+ @attention This method requires a locked mutex. */
+ inline void implSetDescription( const ::rtl::OUString& rDescription );
+
+ /** Locks all mutex's and calculates the bounding box relative to the
+ parent window.
+ @return The bounding box (VCL rect.) relative to the parent object. */
+ Rectangle getBoundingBox()
+ throw ( ::com::sun::star::lang::DisposedException );
+ ///** Locks all mutex's and calculates the bounding box in screen
+ // coordinates.
+ // @return The bounding box (VCL rect.) in screen coordinates. */
+ Rectangle getBoundingBoxOnScreen()
+ throw ( ::com::sun::star::lang::DisposedException );
+
+ /** Creates a new UUID, if rId is empty.
+ @attention This method requires locked global mutex to prevent double
+ creation of an UUID. */
+ static void implCreateUuid( ::com::sun::star::uno::Sequence< sal_Int8 >& rId );
+
+ ::comphelper::AccessibleEventNotifier::TClientId getClientId() const { return m_aClientId; }
+ void setClientId(::comphelper::AccessibleEventNotifier::TClientId _aNewClientId) { m_aClientId = _aNewClientId; }
+
+public:
+ // public versions of internal helper methods, with access control
+ struct TC_AccessControl { friend class TC_SolarMethodGuard; private: TC_AccessControl() { } };
+
+ inline ::osl::Mutex& getMutex( const TC_AccessControl& ) { return getOslMutex(); }
+ inline void ensureIsAlive( const TC_AccessControl& ) { ensureIsAlive(); }
+
+protected:
+ // members ----------------------------------------------------------------
+
+ /** The parent accessible object. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xParent;
+ /** The SVT Table control. */
+ ::svt::table::IAccessibleTable& m_aTable;
+ /** The type of this object (for names, descriptions, state sets, ...). */
+ ::svt::table::AccessibleTableControlObjType m_eObjType;
+
+private:
+ /** Localized name. */
+ ::rtl::OUString m_aName;
+ /** Localized description text. */
+ ::rtl::OUString m_aDescription;
+ ::comphelper::AccessibleEventNotifier::TClientId m_aClientId;
+};
+
+// ============================================================================
+// a version of AccessibleGridControlBase which implements not only the XAccessibleContext,
+// but also the XAccessible
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible
+ > GridControlAccessibleElement_Base;
+
+class GridControlAccessibleElement
+ :public AccessibleGridControlBase
+ ,public GridControlAccessibleElement_Base
+{
+protected:
+ /** Constructor sets specified name and description.
+
+ @param rxParent XAccessible interface of the parent object.
+ @param rTable The Table control.
+ @param eNameText The constant for the name text.
+ @param eDescrText The constant for the description text.
+ */
+ GridControlAccessibleElement(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType eObjType );
+
+public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+protected:
+ virtual ~GridControlAccessibleElement();
+
+protected:
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+private:
+ GridControlAccessibleElement(); // never implemented
+ GridControlAccessibleElement( const GridControlAccessibleElement& ); // never implemented
+ GridControlAccessibleElement& operator=( const GridControlAccessibleElement& ); // never implemented
+};
+
+// ============================================================================
+// a helper class for protecting methods which need to lock the solar mutex in addition to the own mutex
+
+typedef ::osl::MutexGuard OslMutexGuard;
+
+class TC_SolarMethodGuard : public TCSolarGuard, public OslMutexGuard
+{
+public:
+ inline TC_SolarMethodGuard( AccessibleGridControlBase& _rOwner, bool _bEnsureAlive = true )
+ :TCSolarGuard( )
+ ,OslMutexGuard( _rOwner.getMutex( AccessibleGridControlBase::TC_AccessControl() ) )
+ {
+ if ( _bEnsureAlive )
+ _rOwner.ensureIsAlive( AccessibleGridControlBase::TC_AccessControl() );
+ }
+};
+
+// inlines --------------------------------------------------------------------
+
+inline ::svt::table::AccessibleTableControlObjType AccessibleGridControlBase::getType() const
+{
+ return m_eObjType;
+}
+
+inline ::osl::Mutex& AccessibleGridControlBase::getOslMutex()
+{
+ return m_aMutex;
+}
+
+inline ::osl::Mutex* AccessibleGridControlBase::getOslGlobalMutex()
+{
+ return ::osl::Mutex::getGlobalMutex();
+}
+
+inline void AccessibleGridControlBase::implSetName(
+ const ::rtl::OUString& rName )
+{
+ m_aName = rName;
+}
+
+inline void AccessibleGridControlBase::implSetDescription(
+ const ::rtl::OUString& rDescription )
+{
+ m_aDescription = rDescription;
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLBASE_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx
new file mode 100644
index 000000000000..90306435bd4b
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeader.hxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADER_HXX
+
+
+#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
+#include "accessibility/extended/AccessibleGridControlTableBase.hxx"
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+/** This class represents the accessible object of a header bar of a Grid Control
+ (row or column header bar). This object supports the
+ XAccessibleSelection interface. Selecting a child of this object selects
+ complete rows or columns of the data table. */
+class AccessibleGridControlHeader : public AccessibleGridControlTableBase
+{
+public:
+ /** @param eObjType One of the two allowed types TCTYPE_ROWHEADERBAR or
+ TCTYPE_COLUMNHEADERBAR. */
+ AccessibleGridControlHeader(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType eObjType );
+
+protected:
+ virtual ~AccessibleGridControlHeader();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return
+ The XAccessible interface of the specified child.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return The accessible child rendered under the given point. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to (the current cell of) the data table. */
+ virtual void SAL_CALL grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The key bindings associated with this object. */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleTable -------------------------------------------------------
+
+ /** @return The description text of the specified row. */
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The description text of the specified column. */
+ virtual ::rtl::OUString SAL_CALL
+ getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the row header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleRowHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the column header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleColumnHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected rows. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleRows()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected columns. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleColumns()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified row is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified column is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the cell object at the specified
+ cell position. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified cell is selected. */
+ virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return The name of this class. */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An unique implementation ID. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ // internal virtual methods -----------------------------------------------
+ /** @attention This method requires locked mutex's and a living object.
+ @return The absolute child index from the index of selected children.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified index is invalid. */
+ //sal_Int32 implGetChildIndexFromSelectedIndex( sal_Int32 nSelectedChildIndex )
+ // throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+ /** Returns the specified row or column. Uses one of the parameters,
+ depending on object type.
+ @attention This method requires locked mutex's and a living object.
+ @return The XAccessible interface of the specified column/row. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >
+ implGetChild( sal_Int32 nRow, sal_uInt32 nColumnPos );
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox();
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of used rows. */
+ virtual sal_Int32 implGetRowCount() const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The count of used columns. */
+ virtual sal_Int32 implGetColumnCount() const;
+
+ // internal helper methods ------------------------------------------------
+
+ /** @return <TRUE/>, if the objects is a header bar for rows. */
+ inline sal_Bool isRowBar() const;
+ /** @return <TRUE/>, if the objects is a header bar for columns. */
+ inline sal_Bool isColumnBar() const;
+};
+
+// inlines --------------------------------------------------------------------
+
+inline sal_Bool AccessibleGridControlHeader::isRowBar() const
+{
+ return getType() == ::svt::table::TCTYPE_ROWHEADERBAR;
+}
+
+inline sal_Bool AccessibleGridControlHeader::isColumnBar() const
+{
+ return getType() == ::svt::table::TCTYPE_COLUMNHEADERBAR;
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLHEADER_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx
new file mode 100755
index 000000000000..0672ca28a151
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlHeaderCell.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX
+
+#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
+
+namespace accessibility
+{
+ class AccessibleGridControlHeaderCell : public AccessibleGridControlCell, public ::com::sun::star::accessibility::XAccessible
+ {
+ sal_Int32 m_nColumnRowId;
+ public:
+ AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& _rTable,
+ ::svt::table::AccessibleTableControlObjType _eObjType);
+ /** @return The count of visible children. */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the specified child. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to the GridControl. */
+ virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Aquires the object (calls acquire() on base class). */
+ virtual void SAL_CALL acquire() throw ();
+
+ /** Releases the object (calls release() on base class). */
+ virtual void SAL_CALL release() throw ();
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException );
+ //-------------------------------------------------------------------------
+ inline sal_Bool isRowBarCell() const
+ {
+ return getType() == ::svt::table::TCTYPE_ROWHEADERCELL;
+ }
+
+ /** @return
+ The name of this class.
+ */
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+ */
+ ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+
+ protected:
+ virtual Rectangle implGetBoundingBox();
+
+ virtual Rectangle implGetBoundingBoxOnScreen();
+ private:
+ ::rtl::OUString m_sHeaderName;
+ };
+}
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLHEADERCELL_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx
new file mode 100644
index 000000000000..8058594d2938
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTable.hxx
@@ -0,0 +1,226 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLE_HXX
+
+#include "accessibility/extended/AccessibleGridControlTableBase.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+typedef ::cppu::ImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleSelection >
+ AccessibleGridControlTableImplHelper1;
+/** This class represents the accessible object of the data table of a
+ Grid control. */
+class AccessibleGridControlTable : public AccessibleGridControlTableBase,
+ public AccessibleGridControlTableImplHelper1
+{
+public:
+ AccessibleGridControlTable(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType _eType);
+
+protected:
+ virtual ~AccessibleGridControlTable();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return The XAccessible interface of the specified child. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /** @return The accessible child rendered under the given point. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Grabs the focus to (the current cell of) the data table. */
+ virtual void SAL_CALL grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The key bindings associated with this object. */
+ virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleTable -------------------------------------------------------
+
+ /** @return The description text of the specified row. */
+ virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The description text of the specified column. */
+ virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the row header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleRowHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessibleTable interface of the column header bar. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+ getAccessibleColumnHeaders()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected rows. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleRows()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An index list of completely selected columns. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+ getSelectedAccessibleColumns()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified row is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified column is completely selected. */
+ virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the cell object at the specified
+ cell position. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified cell is selected. */
+ virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleSelection ---------------------------------------------------
+
+ /** Selects the specified child (row or column of the table). */
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return <TRUE/>, if the specified child (row/column) is selected. */
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** Clears the complete selection. */
+ virtual void SAL_CALL clearAccessibleSelection()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Selects all children or first, if multiselection is not supported. */
+ virtual void SAL_CALL selectAllAccessibleChildren()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The number of selected rows/columns. */
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The specified selected row/column. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** Removes the specified row/column from the selection. */
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Aquires the object (calls acquire() on base class). */
+ virtual void SAL_CALL acquire() throw ();
+
+ /** Releases the object (calls release() on base class). */
+ virtual void SAL_CALL release() throw ();
+ // XServiceInfo -----------------------------------------------------------
+
+ /** @return The name of this class. */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ // internal virtual methods -----------------------------------------------
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The bounding box (VCL rect.) relative to the parent window. */
+ virtual Rectangle implGetBoundingBox();
+ ///** @attention This method requires locked mutex's and a living object.
+ // @return The bounding box (VCL rect.) in screen coordinates. */
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+
+ //// internal helper methods ------------------------------------------------
+ ///** @attention This method requires a locked mutex.
+ // @return The XAccessibleTable interface of the specified header bar. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ implGetHeaderBar( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::uno::RuntimeException );
+};
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLE_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx
new file mode 100755
index 000000000000..bee42d85e2a2
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableBase.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLEGRIDCONTROLTABLEBASE_HXX
+
+#include "accessibility/extended/AccessibleGridControlBase.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+
+// ============================================================================
+
+namespace accessibility {
+
+typedef ::cppu::ImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleTable >
+ AccessibleGridControlTableImplHelper;
+
+/** The Grid Control accessible table objects inherit from this base class. It
+ implements basic functionality for the XAccessibleTable interface.
+ Grid COntrol table objects are: the data table, the column header bar and the
+ row header bar. */
+class AccessibleGridControlTableBase :
+ public GridControlAccessibleElement,
+ public AccessibleGridControlTableImplHelper
+{
+public:
+ /** Constructor sets specified name and description.
+ @param rxParent XAccessible interface of the parent object.
+ @param rTable The Table control.
+ @param eNameText The constant for the name text.
+ @param eDescrText The constant for the description text. */
+ AccessibleGridControlTableBase(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType eObjType );
+
+protected:
+ virtual ~AccessibleGridControlTableBase();
+
+public:
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return The count of visible children. */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The role of this object (a table). */
+ virtual sal_Int16 SAL_CALL getAccessibleRole()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getAccessibleChild,
+ - getAccessibleIndexInParent. */
+
+ // XAccessibleComponent ---------------------------------------------------
+
+ /* Derived classes have to implement:
+ - getAccessibleAt,
+ - grabFocus,
+ - getAccessibleKeyBinding. */
+
+ // XAccessibleTable -------------------------------------------------------
+
+ /** @return The number of used rows in the table (0 = empty table). */
+ virtual sal_Int32 SAL_CALL getAccessibleRowCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The number of used columns in the table (0 = empty table). */
+ virtual sal_Int32 SAL_CALL getAccessibleColumnCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The row extent of the specified cell (always 1). */
+ virtual sal_Int32 SAL_CALL
+ getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The column extent of the specified cell (always 1). */
+ virtual sal_Int32 SAL_CALL
+ getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The caption cell of the table (not supported). */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleCaption()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The summary object of the table (not supported). */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleSummary()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The child index of the specified cell. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The row index of the specified child cell. */
+ virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** @return The column index of the specified child cell. */
+ virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /* Derived classes have to implement:
+ - getAccessibleRowDescription,
+ - getAccessibleColumnDescription,
+ - getAccessibleRowHeaders,
+ - getAccessibleColumnHeaders,
+ - getSelectedAccessibleRows,
+ - getSelectedAccessibleColumns,
+ - isAccessibleRowSelected,
+ - isAccessibleColumnSelected,
+ - getAccessibleCellAt,
+ - isAccessibleSelected. */
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Aquires the object (calls acquire() on base class). */
+ virtual void SAL_CALL acquire() throw ();
+
+ /** Releases the object (calls release() on base class). */
+ virtual void SAL_CALL release() throw ();
+
+ // XTypeProvider ----------------------------------------------------------
+
+ /** @return A sequence of possible types (received from base classes). */
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return An unique implementation ID. */
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+protected:
+ // internal helper methods ------------------------------------------------
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The number of cells of the table. */
+ sal_Int32 implGetChildCount() const;
+
+ /** @attention This method requires locked mutex's and a living object.
+ @return The row index of the specified cell index. */
+ sal_Int32 implGetRow( sal_Int32 nChildIndex ) const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The column index of the specified cell index. */
+ sal_Int32 implGetColumn( sal_Int32 nChildIndex ) const;
+ /** @attention This method requires locked mutex's and a living object.
+ @return The child index of the specified cell address. */
+ sal_Int32 implGetChildIndex( sal_Int32 nRow, sal_Int32 nColumn ) const;
+
+ /** Fills a sequence with sorted indexes of completely selected rows.
+ @attention This method requires locked mutex's and a living object.
+ @param rSeq Out-parameter that takes the sorted row index list. */
+ void implGetSelectedRows( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq );
+ /** Fills a sequence with sorted indexes of completely selected columns.
+ @attention This method requires locked mutex's and a living object.
+ @param rSeq Out-parameter that takes the sorted column index list. */
+ //void implGetSelectedColumns( ::com::sun::star::uno::Sequence< sal_Int32 >& rSeq );
+
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified row index is invalid. */
+ void ensureIsValidRow( sal_Int32 nRow )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified column index is invalid. */
+ void ensureIsValidColumn( sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified cell address is invalid. */
+ void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+ /** @attention This method requires locked mutex's and a living object.
+ @throws <type>IndexOutOfBoundsException</type>
+ If the specified child index is invalid. */
+ void ensureIsValidIndex( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+};
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLEBASE_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx
new file mode 100755
index 000000000000..dd44927d7fc1
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX
+
+#include <comphelper/accessibletexthelper.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "accessibility/extended/AccessibleGridControlBase.hxx"
+#include <svtools/accessibletable.hxx>
+
+namespace accessibility
+{
+ class AccessibleGridControlCell : public AccessibleGridControlBase
+ {
+ private:
+ sal_Int32 m_nRowPos; // the row number of the table cell
+ sal_Int32 m_nColPos; // the column id of the table cell
+
+ protected:
+ // attribute access
+ inline sal_Int32 getRowPos( ) const { return m_nRowPos; }
+ inline sal_Int32 getColumnPos( ) const { return m_nColPos; }
+
+ // XAccessibleComponent
+ virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException );
+
+ protected:
+ AccessibleGridControlCell(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ ::svt::table::IAccessibleTable& _rTable,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ ::svt::table::AccessibleTableControlObjType _eType
+ );
+
+ virtual ~AccessibleGridControlCell();
+
+ private:
+ AccessibleGridControlCell(); // never implemented
+ AccessibleGridControlCell( const AccessibleGridControlCell& ); // never implemented
+ AccessibleGridControlCell& operator=( const AccessibleGridControlCell& ); // never implemented
+ };
+
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::accessibility::XAccessibleText
+ , ::com::sun::star::accessibility::XAccessible
+ > AccessibleTextHelper_BASE;
+ // implementation of a table cell of GridControl
+ class AccessibleGridControlTableCell :public AccessibleGridControlCell
+ ,public AccessibleTextHelper_BASE
+ ,public ::comphelper::OCommonAccessibleText
+ {
+ private:
+ sal_Int32 m_nOffset;
+
+ protected:
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+ virtual Rectangle implGetBoundingBox();
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+ public:
+ AccessibleGridControlTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ ::svt::table::IAccessibleTable& _rTable,
+ sal_Int32 _nRowId,
+ sal_uInt16 _nColId,
+ svt::table::AccessibleTableControlObjType eObjType);
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** Aquires the object (calls acquire() on base class). */
+ virtual void SAL_CALL acquire() throw ();
+
+ /** Releases the object (calls release() on base class). */
+ virtual void SAL_CALL release() throw ();
+
+ /** @return The index of this object among the parent's children. */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The name of this class.
+ */
+ virtual ::rtl::OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The count of visible children.
+ */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return
+ The XAccessible interface of the specified child.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+ */
+ ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX
+
diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx
new file mode 100755
index 000000000000..10c6520b6a3d
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeck.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACC_ACCESSIBLETOOLPANELDECK_HXX
+#define ACC_ACCESSIBLETOOLPANELDECK_HXX
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace svt
+{
+ class ToolPanelDeck;
+}
+
+//......................................................................................................................
+namespace accessibility
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeck
+ //==================================================================================================================
+ class AccessibleToolPanelDeck_Impl;
+ typedef VCLXAccessibleComponent AccessibleToolPanelDeck_Base;
+ class AccessibleToolPanelDeck : public AccessibleToolPanelDeck_Base
+ {
+ public:
+ AccessibleToolPanelDeck(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck
+ );
+
+ using AccessibleToolPanelDeck_Base::NotifyAccessibleEvent;
+
+ protected:
+ virtual ~AccessibleToolPanelDeck();
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // VCLXAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent );
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet );
+
+ private:
+ ::boost::scoped_ptr< AccessibleToolPanelDeck_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace accessibility
+//......................................................................................................................
+
+#endif // ACC_ACCESSIBLETOOLPANELDECK_HXX
diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx
new file mode 100644
index 000000000000..cc2d39c5acbf
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBar.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACC_ACCESSIBLETOOLPANELTABBAR_HXX
+#define ACC_ACCESSIBLETOOLPANELTABBAR_HXX
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace svt
+{
+ class IToolPanelDeck;
+ class PanelTabBar;
+}
+
+//......................................................................................................................
+namespace accessibility
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= AccessibleToolPanelTabBar
+ //==================================================================================================================
+ class AccessibleToolPanelTabBar_Impl;
+ typedef VCLXAccessibleComponent AccessibleToolPanelTabBar_Base;
+ class AccessibleToolPanelTabBar : public AccessibleToolPanelTabBar_Base
+ {
+ public:
+ AccessibleToolPanelTabBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar
+ );
+
+ using AccessibleToolPanelTabBar_Base::NotifyAccessibleEvent;
+
+ protected:
+ virtual ~AccessibleToolPanelTabBar();
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // VCLXAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent );
+ virtual void FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet );
+
+ private:
+ ::boost::scoped_ptr< AccessibleToolPanelTabBar_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace accessibility
+//......................................................................................................................
+
+#endif // ACC_ACCESSIBLETOOLPANELTABBAR_HXX
diff --git a/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx
new file mode 100644
index 000000000000..80b2ccaaf104
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx
@@ -0,0 +1,107 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX
+#define ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace svt
+{
+ class IToolPanelDeck;
+ class PanelTabBar;
+}
+
+//......................................................................................................................
+namespace accessibility
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeckTabBarItem
+ //==================================================================================================================
+ class AccessibleToolPanelDeckTabBarItem_Impl;
+ typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleToolPanelDeckTabBarItem_Base;
+ class AccessibleToolPanelDeckTabBarItem : public AccessibleToolPanelDeckTabBarItem_Base
+ {
+ public:
+ AccessibleToolPanelDeckTabBarItem(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar,
+ const size_t i_nItemPos
+ );
+
+ using AccessibleToolPanelDeckTabBarItem_Base::NotifyAccessibleEvent;
+ using AccessibleToolPanelDeckTabBarItem_Base::lateInit;
+
+ protected:
+ virtual ~AccessibleToolPanelDeckTabBarItem();
+
+ public:
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ protected:
+ ::boost::scoped_ptr< AccessibleToolPanelDeckTabBarItem_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace accessibility
+//......................................................................................................................
+
+#endif // ACC_ACCESSIBLETOOLPANELDECKTABBARITEM_HXX
diff --git a/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx b/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx
new file mode 100644
index 000000000000..a7b78c092213
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessiblebrowseboxcell.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX
+#define ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX
+
+#include "accessibility/extended/AccessibleBrowseBoxBase.hxx"
+#include <svtools/AccessibleBrowseBoxObjType.hxx>
+
+// .................................................................................
+namespace accessibility
+{
+// .................................................................................
+
+ // =============================================================================
+ // = AccessibleBrowseBoxCell
+ // =============================================================================
+ /** common accessibility-functionality for browse box elements which occupy a cell
+ */
+ class AccessibleBrowseBoxCell : public AccessibleBrowseBoxBase
+ {
+ private:
+ sal_Int32 m_nRowPos; // the row number of the table cell
+ sal_uInt16 m_nColPos; // the column id of the table cell
+
+ protected:
+ // attribute access
+ inline sal_Int32 getRowPos( ) const { return m_nRowPos; }
+ inline sal_Int32 getColumnPos( ) const { return m_nColPos; }
+
+ protected:
+ // AccessibleBrowseBoxBase overridables
+ virtual Rectangle implGetBoundingBox();
+ virtual Rectangle implGetBoundingBoxOnScreen();
+
+ // XAccessibleComponent
+ virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException );
+
+ protected:
+ AccessibleBrowseBoxCell(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ ::svt::IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ ::svt::AccessibleBrowseBoxObjType _eType = ::svt::BBTYPE_TABLECELL
+ );
+
+ virtual ~AccessibleBrowseBoxCell();
+
+ private:
+ AccessibleBrowseBoxCell(); // never implemented
+ AccessibleBrowseBoxCell( const AccessibleBrowseBoxCell& ); // never implemented
+ AccessibleBrowseBoxCell& operator=( const AccessibleBrowseBoxCell& ); // never implemented
+ };
+
+// .................................................................................
+} // namespace accessibility
+// .................................................................................
+
+
+#endif // ACCESSIBILITY_ACCESSIBLE_BROWSE_BOX_CELL_HXX
diff --git a/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx b/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx
new file mode 100644
index 000000000000..a38877d5aeae
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibleeditbrowseboxcell.hxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX
+
+#ifndef ACCESSIBILITY_EXT_BROWSE_BOX_CELL_HXX
+#include "accessiblebrowseboxcell.hxx"
+#endif
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include <comphelper/accessiblewrapper.hxx>
+
+namespace accessibility
+{
+ // =============================================================================
+ // = EditBrowseBoxTableCell
+ // =============================================================================
+ class EditBrowseBoxTableCell :public AccessibleBrowseBoxCell
+ ,public ::comphelper::OAccessibleContextWrapperHelper
+ {
+ public:
+ EditBrowseBoxTableCell(
+ const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible,
+ const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _xControlChild,
+ ::svt::IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos
+ );
+
+ protected:
+ virtual ~EditBrowseBoxTableCell();
+
+ protected:
+ // XAccessibleComponent
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException) ;
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException) ;
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Int16 SAL_CALL getAccessibleRole() throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ protected:
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XComponent/OComponentProxyAggregationHelper (needs to be disambiguated)
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+
+ // OAccessibleContextWrapperHelper();
+ void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ EditBrowseBoxTableCell(); // never implemented
+ EditBrowseBoxTableCell( const EditBrowseBoxTableCell& ); // never implemented
+ EditBrowseBoxTableCell& operator=( const EditBrowseBoxTableCell& ); // never implemented
+ };
+
+ // =============================================================================
+ // = EditBrowseBoxTableCell
+ // =============================================================================
+ typedef ::cppu::WeakComponentImplHelper1 < ::com::sun::star::accessibility::XAccessible
+ > EditBrowseBoxTableCellAccess_Base;
+ // XAccessible providing an EditBrowseBoxTableCell
+ class EditBrowseBoxTableCellAccess
+ :public ::comphelper::OBaseMutex
+ ,public EditBrowseBoxTableCellAccess_Base
+ {
+ protected:
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_aContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xParent;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xControlAccessible;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >
+ m_xFocusWindow;
+ ::svt::IAccessibleTableProvider* m_pBrowseBox;
+ sal_Int32 m_nRowPos;
+ sal_uInt16 m_nColPos;
+
+ public:
+ EditBrowseBoxTableCellAccess(
+ const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxParent,
+ const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible > _xControlAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ ::svt::IAccessibleTableProvider& _rBrowseBox,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos
+ );
+
+ protected:
+ virtual ~EditBrowseBoxTableCellAccess();
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent/OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ private:
+ EditBrowseBoxTableCellAccess(); // never implemented
+ EditBrowseBoxTableCellAccess( const EditBrowseBoxTableCellAccess& ); // never implemented
+ EditBrowseBoxTableCellAccess& operator=( const EditBrowseBoxTableCellAccess& ); // never implemented
+ };
+}
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBILEEDITBROWSEBOXTABLECELL_HXX
+
diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
new file mode 100644
index 000000000000..05dc41313fdd
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrl.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_
+#define ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_
+
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <vcl/vclevent.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+// class AccessibleListBox -----------------------------------------------
+
+class SvtIconChoiceCtrl;
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ typedef ::cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessible
+ , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleIconChoiceCtrl_BASE;
+
+ /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
+ */
+ class AccessibleIconChoiceCtrl :public AccessibleIconChoiceCtrl_BASE
+ ,public VCLXAccessibleComponent
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
+
+ protected:
+ virtual ~AccessibleIconChoiceCtrl();
+
+ /** this function is called upon disposing the component */
+ virtual void SAL_CALL disposing();
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ SvtIconChoiceCtrl* getCtrl();
+ public:
+ /** OAccessibleBase needs a valid view
+ @param _rIconCtrl
+ is the box for which we implement an accessible object
+ @param _xParent
+ is our parent accessible object
+ */
+ AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static methods
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
+ static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRL_HXX_
+
diff --git a/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx
new file mode 100644
index 000000000000..ccea420a1cff
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibleiconchoicectrlentry.hxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRLENTRY_HXX_
+#define ACCESSIBILITY_EXT_ACCESSIBLEICONCHOICECTRLENTRY_HXX_
+
+#include <deque>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase8.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/accessibletexthelper.hxx>
+#include <tools/gen.hxx>
+
+// forward ---------------------------------------------------------------
+
+class SvxIconChoiceCtrlEntry;
+class SvtIconChoiceCtrl;
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+// class AccessibleIconChoiceCtrlEntry ------------------------------------------
+
+ typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible
+ , ::com::sun::star::accessibility::XAccessibleContext
+ , ::com::sun::star::accessibility::XAccessibleComponent
+ , ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ , ::com::sun::star::accessibility::XAccessibleText
+ , ::com::sun::star::accessibility::XAccessibleAction
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XEventListener > AccessibleIconChoiceCtrlEntry_BASE;
+
+ /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */
+ class AccessibleIconChoiceCtrlEntry : public ::comphelper::OBaseMutex,
+ public AccessibleIconChoiceCtrlEntry_BASE,
+ public ::comphelper::OCommonAccessibleText
+ {
+ private:
+ /** The treelistbox control */
+ SvtIconChoiceCtrl* m_pIconCtrl;
+ sal_Int32 m_nIndex;
+
+ protected:
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 m_nClientId;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
+
+ private:
+ #ifdef ACCESSIBLE_EVENT_NOTIFICATION_ENABLED
+ // (the following method is unused currently. If you need it, simply remove the #ifdef thing here and
+ // in the cxx)
+ /** notifies all listeners that this object has changed
+ @param _nEventId
+ is the event id
+ @param _aOldValue
+ is the old value
+ @param _aNewValue
+ is the new value
+ */
+ void NotifyAccessibleEvent( sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _aOldValue,
+ const ::com::sun::star::uno::Any& _aNewValue );
+ #endif
+
+ Rectangle GetBoundingBox_Impl() const;
+ Rectangle GetBoundingBoxOnScreen_Impl() const;
+ sal_Bool IsAlive_Impl() const;
+ sal_Bool IsShowing_Impl() const;
+
+ Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException );
+ Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException );
+ void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
+
+ protected:
+ virtual ~AccessibleIconChoiceCtrlEntry();
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+ public:
+ /** Ctor()
+ @param _rListBox
+ the view control
+ @param _pEntry
+ the entry
+ @param _xParent
+ is our parent accessible object
+ */
+ AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl,
+ sal_uLong _nPos,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static methods
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
+ static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ using cppu::WeakAggComponentImplHelperBase::addEventListener;
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ using cppu::WeakAggComponentImplHelperBase::removeEventListener;
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
+
diff --git a/accessibility/inc/accessibility/extended/accessiblelistbox.hxx b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
new file mode 100644
index 000000000000..a92ac6356fa2
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
@@ -0,0 +1,125 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
+#define ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
+
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <vcl/vclevent.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+
+// class AccessibleListBox -----------------------------------------------
+
+class SvTreeListBox;
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ typedef ::cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessible
+ , ::com::sun::star::accessibility::XAccessibleSelection> AccessibleListBox_BASE;
+
+ /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
+ */
+ class AccessibleListBox :public AccessibleListBox_BASE
+ ,public VCLXAccessibleComponent
+ {
+ protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
+
+ protected:
+ virtual ~AccessibleListBox();
+
+ // OComponentHelper overridables
+ /** this function is called upon disposing the component */
+ virtual void SAL_CALL disposing();
+
+ // VCLXAccessibleComponent
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ SvTreeListBox* getListBox() const;
+
+ public:
+ /** OAccessibleBase needs a valid view
+ @param _rListBox
+ is the box for which we implement an accessible object
+ @param _xParent
+ is our parent accessible object
+ */
+ AccessibleListBox( SvTreeListBox& _rListBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static methods
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
+ static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOX_HXX_
+
diff --git a/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx b/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx
new file mode 100644
index 000000000000..ce0fa5ad0ac0
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
+#define ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
+
+#include <deque>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase8.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/accessibletexthelper.hxx>
+#include <tools/gen.hxx>
+#include "accessibility/extended/listboxaccessible.hxx"
+
+// forward ---------------------------------------------------------------
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Point;
+ struct Rectangle;
+ struct Size;
+ class XFocusListener;
+} } } }
+
+class SvTreeListBox;
+class SvLBoxEntry;
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+// class AccessibleListBoxEntry ------------------------------------------
+
+ typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible
+ , ::com::sun::star::accessibility::XAccessibleContext
+ , ::com::sun::star::accessibility::XAccessibleComponent
+ , ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ , ::com::sun::star::accessibility::XAccessibleAction
+ , ::com::sun::star::accessibility::XAccessibleSelection
+ , ::com::sun::star::accessibility::XAccessibleText
+ , ::com::sun::star::lang::XServiceInfo > AccessibleListBoxEntry_BASE;
+
+ /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */
+ class AccessibleListBoxEntry:public ::comphelper::OBaseMutex
+ ,public AccessibleListBoxEntry_BASE
+ ,public ::comphelper::OCommonAccessibleText
+ ,public ListBoxAccessibleBase
+ {
+ friend class AccessibleListBox;
+
+ private:
+ /** The treelistbox control */
+ SvTreeListBox* m_pListBox;
+ ::std::deque< sal_Int32 > m_aEntryPath;
+
+ protected:
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 m_nClientId;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible >
+ m_aParent;
+
+ private:
+ Rectangle GetBoundingBox_Impl() const;
+ Rectangle GetBoundingBoxOnScreen_Impl() const;
+ sal_Bool IsAlive_Impl() const;
+ sal_Bool IsShowing_Impl() const;
+
+ Rectangle GetBoundingBox() throw ( ::com::sun::star::lang::DisposedException );
+ Rectangle GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException );
+ void EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
+
+ protected:
+ virtual ~AccessibleListBoxEntry();
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ // ListBoxAccessible/XComponent
+ virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException );
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+ public:
+ /** Ctor()
+ @param _rListBox
+ the view control
+ @param _pEntry
+ the entry
+ @param _xParent
+ is our parent accessible object
+ */
+ AccessibleListBoxEntry( SvTreeListBox& _rListBox, SvLBoxEntry* _pEntry,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& _xParent );
+
+ protected:
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo - static methods
+ static com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw(com::sun::star::uno::RuntimeException);
+ static ::rtl::OUString getImplementationName_Static(void) throw(com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ using cppu::WeakAggComponentImplHelperBase::addEventListener;
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ using cppu::WeakAggComponentImplHelperBase::removeEventListener;
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > implGetParentAccessible( ) const;
+ };
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLELISTBOXENTRY_HXX_
+
diff --git a/accessibility/inc/accessibility/extended/accessibletabbar.hxx b/accessibility/inc/accessibility/extended/accessibletabbar.hxx
new file mode 100644
index 000000000000..df30cc1dc647
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibletabbar.hxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_
+#define ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include "accessibility/extended/accessibletabbarbase.hxx"
+
+#include <vector>
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+ // ----------------------------------------------------
+ // class AccessibleTabBar
+ // ----------------------------------------------------
+
+ typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::lang::XServiceInfo > AccessibleTabBar_BASE;
+
+ class AccessibleTabBar : public AccessibleTabBarBase,
+ public AccessibleTabBar_BASE
+ {
+ private:
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren;
+
+ AccessibleChildren m_aAccessibleChildren;
+
+ protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+ public:
+ AccessibleTabBar( TabBar* pTabBar );
+ ~AccessibleTabBar();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBAR_HXX_
+
diff --git a/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
new file mode 100644
index 000000000000..eac79b152b75
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibletabbarbase.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARBASE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLETABBARBASE_HXX
+
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <tools/link.hxx>
+
+class TabBar;
+class VCLExternalSolarLock;
+class VclSimpleEvent;
+class VclWindowEvent;
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+// ============================================================================
+
+typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE;
+
+class AccessibleTabBarBase : public AccessibleExtendedComponentHelper_BASE
+{
+public:
+ explicit AccessibleTabBarBase( TabBar* pTabBar );
+ virtual ~AccessibleTabBarBase();
+
+protected:
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+private:
+ void SetTabBarPointer( TabBar* pTabBar );
+ void ClearTabBarPointer();
+
+protected:
+ VCLExternalSolarLock* m_pExternalLock;
+ TabBar* m_pTabBar;
+};
+
+// ============================================================================
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
+
+#endif
+
diff --git a/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx b/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx
new file mode 100644
index 000000000000..9ddf20b6cc65
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibletabbarpage.hxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_
+#define ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include "accessibility/extended/accessibletabbarbase.hxx"
+
+#include <vector>
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+ // ----------------------------------------------------
+ // class AccessibleTabBarPage
+ // ----------------------------------------------------
+
+ typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::lang::XServiceInfo > AccessibleTabBarPage_BASE;
+
+ class AccessibleTabBarPage : public AccessibleTabBarBase,
+ public AccessibleTabBarPage_BASE
+ {
+ friend class AccessibleTabBarPageList;
+
+ private:
+ sal_uInt16 m_nPageId;
+ sal_Bool m_bEnabled;
+ sal_Bool m_bShowing;
+ sal_Bool m_bSelected;
+ ::rtl::OUString m_sPageText;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
+
+ protected:
+ sal_Bool IsEnabled();
+ sal_Bool IsShowing();
+ sal_Bool IsSelected();
+
+ void SetEnabled( sal_Bool bEnabled );
+ void SetShowing( sal_Bool bShowing );
+ void SetSelected( sal_Bool bSelected );
+ void SetPageText( const ::rtl::OUString& sPageText );
+
+ sal_uInt16 GetPageId() const { return m_nPageId; }
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+ public:
+ AccessibleTabBarPage( TabBar* pTabBar, sal_uInt16 nPageId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent );
+ virtual ~AccessibleTabBarPage();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGE_HXX_
+
diff --git a/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx b/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx
new file mode 100644
index 000000000000..d834e3ef86c7
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibletabbarpagelist.hxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_
+#define ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include "accessibility/extended/accessibletabbarbase.hxx"
+
+#include <vector>
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+ // ----------------------------------------------------
+ // class AccessibleTabBarPageList
+ // ----------------------------------------------------
+
+ typedef ::cppu::ImplHelper3<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::lang::XServiceInfo > AccessibleTabBarPageList_BASE;
+
+ class AccessibleTabBarPageList : public AccessibleTabBarBase,
+ public AccessibleTabBarPageList_BASE
+ {
+ private:
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren;
+
+ AccessibleChildren m_aAccessibleChildren;
+ sal_Int32 m_nIndexInParent;
+
+ protected:
+ void UpdateEnabled( sal_Int32 i, sal_Bool bEnabled );
+ void UpdateShowing( sal_Bool bShowing );
+ void UpdateSelected( sal_Int32 i, sal_Bool bSelected );
+ void UpdatePageText( sal_Int32 i );
+
+ void InsertChild( sal_Int32 i );
+ void RemoveChild( sal_Int32 i );
+ void MoveChild( sal_Int32 i, sal_Int32 j );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+ public:
+ AccessibleTabBarPageList( TabBar* pTabBar, sal_Int32 nIndexInParent );
+ virtual ~AccessibleTabBarPageList();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST_HXX_
+
diff --git a/accessibility/inc/accessibility/extended/accessibletablistbox.hxx b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx
new file mode 100644
index 000000000000..b488e9c6068b
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibletablistbox.hxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX
+
+#include "AccessibleBrowseBox.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <svtools/accessibletableprovider.hxx>
+
+class SvHeaderTabListBox;
+
+// ============================================================================
+
+namespace accessibility {
+
+class AccessibleBrowseBoxTable;
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible
+ > AccessibleTabListBox_Base;
+
+/** !!! */
+class AccessibleTabListBox
+ :public AccessibleBrowseBox
+ ,public AccessibleTabListBox_Base
+ ,public ::svt::IAccessibleTabListBox
+{
+private:
+ SvHeaderTabListBox* m_pTabListBox;
+
+public:
+ /** ctor()
+ @param rxParent XAccessible interface of the parent object.
+ @param rBox The HeaderTabListBox control. */
+ AccessibleTabListBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ SvHeaderTabListBox& rBox );
+
+public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext -----------------------------------------------------
+
+ /** @return The count of visible children. */
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** @return The XAccessible interface of the specified child. */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XAccessibleContext
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
+
+ // IAccessibleTabListBox
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getMyself()
+ {
+ return this;
+ }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getHeaderBar( ::svt::AccessibleBrowseBoxObjType _eObjType )
+ {
+ return AccessibleBrowseBox::getHeaderBar( _eObjType );
+ }
+
+protected:
+ /** dtor() */
+ virtual ~AccessibleTabListBox();
+
+ /** This method creates and returns an accessible table.
+ @return An AccessibleBrowseBoxTable. */
+ virtual AccessibleBrowseBoxTable* createAccessibleTable();
+};
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX
+
diff --git a/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
new file mode 100644
index 000000000000..7365a17e6138
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX
+#define ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX
+
+#include "AccessibleBrowseBoxTable.hxx"
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+class SvHeaderTabListBox;
+
+// ============================================================================
+
+namespace accessibility {
+
+typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection >
+ AccessibleTabListBoxTableImplHelper;
+
+class AccessibleTabListBoxTable : public AccessibleBrowseBoxTable, public AccessibleTabListBoxTableImplHelper
+{
+private:
+ SvHeaderTabListBox* m_pTabListBox;
+
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+ // helpers ----------------------------------------------------------------
+
+ /** Throws an exception, if nIndex is not a valid child index. */
+ void ensureValidIndex( sal_Int32 _nIndex ) const
+ SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) );
+
+ /** Returns true, if the specified row is selected. */
+ sal_Bool implIsRowSelected( sal_Int32 _nRow ) const;
+ /** Selects the specified row. */
+ void implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect );
+
+ /** Returns the count of rows in the table. */
+ sal_Int32 implGetRowCount() const;
+ /** Returns the total column count in the table. */
+ sal_Int32 implGetColumnCount() const;
+ /** Returns the count of selected rows in the table. */
+ sal_Int32 implGetSelRowCount() const;
+ /** Returns the total cell count in the table (including header). */
+ inline sal_Int32 implGetCellCount() const { return implGetRowCount() * implGetColumnCount(); }
+
+ /** Returns the row index from cell index. */
+ inline sal_Int32 implGetRow( sal_Int32 _nIndex ) const { return _nIndex / implGetColumnCount(); }
+ /** Returns the column index from cell index. */
+ inline sal_Int32 implGetColumn( sal_Int32 _nIndex ) const { return _nIndex % implGetColumnCount(); }
+ /** Returns the absolute row index of the nSelRow-th selected row. */
+ sal_Int32 implGetSelRow( sal_Int32 _nSelRow ) const;
+ /** Returns the child index from cell position. */
+ inline sal_Int32 implGetIndex( sal_Int32 _nRow, sal_Int32 _nColumn ) const { return _nRow * implGetColumnCount() + _nColumn; }
+
+public:
+ /** ctor()
+ @param rxParent XAccessible interface of the parent object.
+ @param rBox The HeaderTabListBox control. */
+ AccessibleTabListBoxTable(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ SvHeaderTabListBox& rBox );
+
+protected:
+ /** dtor() */
+ virtual ~AccessibleTabListBoxTable();
+
+public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
+#endif // ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX
+
diff --git a/accessibility/inc/accessibility/extended/listboxaccessible.hxx b/accessibility/inc/accessibility/extended/listboxaccessible.hxx
new file mode 100644
index 000000000000..f05926f3abda
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/listboxaccessible.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE
+#define ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE
+
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <tools/link.hxx>
+
+class SvTreeListBox;
+class VclSimpleEvent;
+class VclWindowEvent;
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ //====================================================================
+ //= ListBoxAccessibleBase
+ //====================================================================
+ /** helper class which couples it's life time to the life time of an
+ SvTreeListBox
+ */
+ class ListBoxAccessibleBase
+ {
+ private:
+ SvTreeListBox* m_pWindow;
+
+ protected:
+ inline SvTreeListBox* getListBox() const
+ {
+ return const_cast< ListBoxAccessibleBase* >( this )->m_pWindow;
+ }
+
+ inline bool isAlive() const { return NULL != m_pWindow; }
+
+ public:
+ ListBoxAccessibleBase( SvTreeListBox& _rWindow );
+
+ protected:
+ virtual ~ListBoxAccessibleBase( );
+
+ // own overridables
+ /// will be called for any VclWindowEvent events broadcasted by our VCL window
+ virtual void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+ /** will be called when our window broadcasts the VCLEVENT_OBJECT_DYING event
+
+ <p>Usually, you derive your class from both ListBoxAccessibleBase and XComponent,
+ and call XComponent::dispose here.</p>
+ */
+ virtual void SAL_CALL dispose() throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ /// to be called in the dispose method of your derived class
+ void disposing();
+
+ private:
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+ private:
+ ListBoxAccessibleBase( ); // never implemented
+ ListBoxAccessibleBase( const ListBoxAccessibleBase& ); // never implemented
+ ListBoxAccessibleBase& operator=( const ListBoxAccessibleBase& ); // never implemented
+ };
+
+//........................................................................
+} // namespace accessibility
+//........................................................................
+
+#endif // ACCESSIBILITY_EXT_LISTBOX_ACCESSIBLE
diff --git a/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
new file mode 100644
index 000000000000..be6cffc22e8b
--- /dev/null
+++ b/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
@@ -0,0 +1,711 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX
+#define INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <svl/lstner.hxx>
+#include <svtools/textdata.hxx>
+#include <svtools/texteng.hxx>
+#include <svtools/textview.hxx>
+#include <svtools/txtattr.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/Color.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleTextType.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <cppuhelper/compbase7.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
+#include <comphelper/accessibletexthelper.hxx>
+#include <rtl/ref.hxx>
+
+#include <memory>
+#include <queue>
+#include <hash_map>
+
+class TextEngine;
+class TextView;
+
+namespace css = ::com::sun::star;
+
+namespace accessibility
+{
+
+class Paragraph;
+class Document;
+
+class SfxListenerGuard
+{
+public:
+ inline SfxListenerGuard(::SfxListener & rListener):
+ m_rListener(rListener), m_pNotifier(0) {}
+
+ inline ~SfxListenerGuard() { endListening(); }
+
+ // Not thread safe:
+ void startListening(::SfxBroadcaster & rNotifier);
+
+ // Not thread safe:
+ void endListening();
+
+private:
+ ::SfxListener & m_rListener;
+ ::SfxBroadcaster * m_pNotifier;
+};
+
+class WindowListenerGuard
+{
+public:
+ inline WindowListenerGuard(::Link const & rListener):
+ m_aListener(rListener), m_pNotifier(0) {}
+
+ inline ~WindowListenerGuard() { endListening(); }
+
+ // Not thread safe:
+ void startListening(::Window & rNotifier);
+
+ // Not thread safe:
+ void endListening();
+
+private:
+ ::Link m_aListener;
+ ::Window * m_pNotifier;
+};
+
+class ParagraphInfo
+{
+public:
+ inline ParagraphInfo(::sal_Int32 nHeight): m_nHeight(nHeight) {}
+
+ inline
+ ::css::uno::WeakReference< ::css::accessibility::XAccessible > const &
+ getParagraph() const { return m_xParagraph; }
+
+ inline ::sal_Int32 getHeight() const { return m_nHeight; }
+
+ inline void setParagraph(
+ ::css::uno::Reference< ::css::accessibility::XAccessible > const &
+ rParagraph) { m_xParagraph = rParagraph; }
+
+ inline void changeHeight(::sal_Int32 nHeight) { m_nHeight = nHeight; }
+
+private:
+ ::css::uno::WeakReference< ::css::accessibility::XAccessible >
+ m_xParagraph;
+ ::sal_Int32 m_nHeight;
+};
+
+typedef ::std::vector< ParagraphInfo > Paragraphs;
+
+typedef ::cppu::WeakAggComponentImplHelper7<
+ ::css::accessibility::XAccessible,
+ ::css::accessibility::XAccessibleContext,
+ ::css::accessibility::XAccessibleComponent,
+ ::css::accessibility::XAccessibleEditableText,
+ ::css::accessibility::XAccessibleMultiLineText,
+ ::css::accessibility::XAccessibleTextAttributes,
+ ::css::accessibility::XAccessibleEventBroadcaster > ParagraphBase;
+
+// The Paragraph's number is the absolute position within the text engine (from
+// 0 to N - 1), whereas the Paragraph's index is the position within the text
+// view/accessible parent (from 0 to M - 1). Paragraphs outside the currently
+// visible range have an index of -1.
+class ParagraphImpl:
+ public ParagraphBase, private ::comphelper::OCommonAccessibleText
+{
+public:
+ ParagraphImpl(::rtl::Reference< Document > const & rDocument,
+ Paragraphs::size_type nNumber, ::osl::Mutex & rMutex);
+
+ // Not thread-safe.
+ inline Paragraphs::size_type getNumber() const { return m_nNumber; }
+
+ // Not thread-safe.
+ void numberChanged(bool bIncremented);
+
+ // Not thread-safe.
+ void textChanged();
+
+ // Thread-safe.
+ void notifyEvent(::sal_Int16 nEventId, ::css::uno::Any const & rOldValue,
+ ::css::uno::Any const & rNewValue);
+
+protected:
+ // OCommonAccessibleText
+ virtual void implGetParagraphBoundary( ::css::i18n::Boundary& rBoundary,
+ ::sal_Int32 nIndex );
+ virtual void implGetLineBoundary( ::css::i18n::Boundary& rBoundary,
+ ::sal_Int32 nIndex );
+
+private:
+ virtual ::css::uno::Reference< ::css::accessibility::XAccessibleContext >
+ SAL_CALL getAccessibleContext() throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+ getAccessibleChild(::sal_Int32 i)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent() throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Int16 SAL_CALL getAccessibleRole()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getAccessibleName()
+ throw (::css::uno::RuntimeException);
+
+ virtual
+ ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet >
+ SAL_CALL getAccessibleRelationSet() throw (::css::uno::RuntimeException);
+
+ virtual
+ ::css::uno::Reference< ::css::accessibility::XAccessibleStateSet > SAL_CALL
+ getAccessibleStateSet() throw (::css::uno::RuntimeException);
+
+ virtual ::css::lang::Locale SAL_CALL getLocale()
+ throw (::css::accessibility::IllegalAccessibleComponentStateException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL containsPoint(::css::awt::Point const & rPoint)
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint(::css::awt::Point const & rPoint)
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::awt::Rectangle SAL_CALL getBounds()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::awt::Point SAL_CALL getLocation()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::awt::Point SAL_CALL getLocationOnScreen()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::awt::Size SAL_CALL getSize()
+ throw (::css::uno::RuntimeException);
+
+ virtual void SAL_CALL grabFocus() throw (::css::uno::RuntimeException);
+
+ virtual ::css::uno::Any SAL_CALL getAccessibleKeyBinding()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::util::Color SAL_CALL getForeground()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::util::Color SAL_CALL getBackground()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getCaretPosition()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL setCaretPosition(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Unicode SAL_CALL getCharacter(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
+ getCharacterAttributes(::sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes )
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::css::awt::Rectangle SAL_CALL
+ getCharacterBounds(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getCharacterCount()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL
+ getIndexAtPoint(::css::awt::Point const & rPoint)
+ throw (::css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getSelectedText()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getSelectionStart()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getSelectionEnd()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL setSelection(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getText()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::rtl::OUString SAL_CALL getTextRange(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL copyText(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL cutText(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL pasteText(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL deleteText(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL insertText(::rtl::OUString const & rText,
+ ::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL replaceText(
+ ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex,
+ ::rtl::OUString const & rReplacement)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL setAttributes(
+ ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex,
+ ::css::uno::Sequence< ::css::beans::PropertyValue > const &
+ rAttributeSet)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Bool SAL_CALL setText(::rtl::OUString const & rText)
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
+ getDefaultAttributes(const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
+ getRunAttributes(::sal_Int32 Index, const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ using cppu::WeakAggComponentImplHelperBase::addEventListener;
+ virtual void SAL_CALL addEventListener(
+ ::css::uno::Reference<
+ ::css::accessibility::XAccessibleEventListener > const & rListener)
+ throw (::css::uno::RuntimeException);
+
+ using cppu::WeakAggComponentImplHelperBase::removeEventListener;
+ virtual void SAL_CALL removeEventListener(
+ ::css::uno::Reference<
+ ::css::accessibility::XAccessibleEventListener > const & rListener)
+ throw (::css::uno::RuntimeException);
+
+ virtual void SAL_CALL disposing();
+
+ virtual ::rtl::OUString implGetText();
+
+ virtual ::css::lang::Locale implGetLocale();
+
+ virtual void implGetSelection(::sal_Int32 & rStartIndex,
+ ::sal_Int32 & rEndIndex);
+
+ // Throws ::css::lang::DisposedException:
+ void checkDisposed();
+
+ ::rtl::Reference< Document > m_xDocument;
+ Paragraphs::size_type m_nNumber;
+
+// ::cppu::OInterfaceContainerHelper m_aListeners;
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 m_nClientId;
+
+ ::rtl::OUString m_aParagraphText;
+};
+
+
+typedef ::std::hash_map< ::rtl::OUString,
+ ::css::beans::PropertyValue,
+ ::rtl::OUStringHash,
+ ::std::equal_to< ::rtl::OUString > > tPropValMap;
+
+class Document: public ::VCLXAccessibleComponent, public ::SfxListener
+{
+public:
+ Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
+ ::TextView & rView, bool bCompoundControlChild);
+
+ inline ::css::uno::Reference< ::css::accessibility::XAccessible >
+ getAccessible() { return m_xAccessible; }
+
+ // Must be called only after init has been called.
+ ::css::lang::Locale retrieveLocale();
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const *" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ ::sal_Int32 retrieveParagraphIndex(ParagraphImpl const * pParagraph);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const *" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ ::sal_Int64 retrieveParagraphState(ParagraphImpl const * pParagraph);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ ::css::awt::Rectangle
+ retrieveParagraphBounds(ParagraphImpl const * pParagraph, bool bAbsolute);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ ::rtl::OUString retrieveParagraphText(ParagraphImpl const * pParagraph);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ void retrieveParagraphSelection(ParagraphImpl const * pParagraph,
+ ::sal_Int32 * pBegin, ::sal_Int32 * pEnd);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const *" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ ::sal_Int32 retrieveParagraphCaretPosition(ParagraphImpl const * pParagraph);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ // Throws ::css::lang::IndexOutOfBoundsException.
+ ::css::awt::Rectangle
+ retrieveCharacterBounds(ParagraphImpl const * pParagraph,
+ ::sal_Int32 nIndex);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ ::sal_Int32 retrieveCharacterIndex(ParagraphImpl const * pParagraph,
+ ::css::awt::Point const & rPoint);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ // Throws ::css::lang::IndexOutOfBoundsException.
+ ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveCharacterAttributes(
+ ParagraphImpl const * pParagraph, ::sal_Int32 nIndex,
+ const ::css::uno::Sequence< ::rtl::OUString >& aRequestedAttributes);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveDefaultAttributes(
+ ParagraphImpl const * pParagraph,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ // Throws ::css::lang::IndexOutOfBoundsException.
+ ::css::uno::Sequence< ::css::beans::PropertyValue > retrieveRunAttributes(
+ ParagraphImpl const * pParagraph, ::sal_Int32 Index,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ void changeParagraphText(ParagraphImpl * pParagraph,
+ ::rtl::OUString const & rText);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ // Throws ::css::lang::IndexOutOfBoundsException.
+ void changeParagraphText(ParagraphImpl * pParagraph, ::sal_Int32 nBegin,
+ ::sal_Int32 nEnd, bool bCut, bool bPaste,
+ ::rtl::OUString const & rText);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ // Throws ::css::lang::IndexOutOfBoundsException.
+ void copyParagraphText(ParagraphImpl const * pParagraph,
+ ::sal_Int32 nBegin, ::sal_Int32 nEnd);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ // Throws ::css::lang::IndexOutOfBoundsException.
+ void changeParagraphAttributes(
+ ParagraphImpl * pParagraph, ::sal_Int32 nBegin, ::sal_Int32 nEnd,
+ ::css::uno::Sequence< ::css::beans::PropertyValue > const &
+ rAttributeSet);
+
+ // Must be called only after init has been called.
+ // To make it possible for this method to be (indirectly) called from
+ // within Paragraph's constructor (i.e., when the Paragraph's ref count is
+ // still zero), pass a "ParagraphImpl const &" instead of a
+ // "::rtl::Reference< ParagraphImpl > const &".
+ // Throws ::css::lang::IndexOutOfBoundsException.
+ void changeParagraphSelection(ParagraphImpl * pParagraph,
+ ::sal_Int32 nBegin, ::sal_Int32 nEnd);
+
+ ::css::i18n::Boundary
+ retrieveParagraphLineBoundary( ParagraphImpl const * pParagraph,
+ ::sal_Int32 nIndex, ::sal_Int32 *pLineNo = NULL);
+
+ ::css::i18n::Boundary
+ retrieveParagraphBoundaryOfLine( ParagraphImpl const * pParagraph,
+ ::sal_Int32 nIndex );
+
+ sal_Int32 retrieveParagraphLineWithCursor( ParagraphImpl const * pParagraph );
+
+ ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet >
+ retrieveParagraphRelationSet( ParagraphImpl const * pParagraph );
+
+protected:
+ // window event listener from base class
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+private:
+ virtual ::sal_Int32 SAL_CALL getAccessibleChildCount()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::uno::Reference< ::css::accessibility::XAccessible >
+ SAL_CALL getAccessibleChild(::sal_Int32 i)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException);
+
+ virtual ::sal_Int16 SAL_CALL getAccessibleRole()
+ throw (::css::uno::RuntimeException);
+
+ virtual ::css::uno::Reference< ::css::accessibility::XAccessible >
+ SAL_CALL getAccessibleAtPoint(::css::awt::Point const & rPoint)
+ throw (::css::uno::RuntimeException);
+
+ // ??? Will be called with both the external (Solar) and internal mutex
+ // locked:
+ virtual void SAL_CALL disposing();
+
+ // ??? Will be called with the external (Solar) mutex locked.
+ // init will already have been called.
+ virtual void Notify(::SfxBroadcaster & rBC, ::SfxHint const & rHint);
+
+ // Assuming that this will only be called with the external (Solar) mutex
+ // locked.
+ // init will already have been called.
+ DECL_LINK(WindowEventHandler, VclSimpleEvent *);
+
+ // Must be called with both the external (Solar) and internal mutex
+ // locked.
+ void init();
+
+ // Must be called with both the external (Solar) and internal mutex
+ // locked, and after init has been called:
+ ::rtl::Reference< ParagraphImpl >
+ getParagraph(Paragraphs::iterator const & rIt);
+
+ // Must be called with both the external (Solar) and internal mutex
+ // locked, and after init has been called.
+ // Throws ::css::uno::RuntimeException.
+ ::css::uno::Reference< ::css::accessibility::XAccessible >
+ getAccessibleChild(Paragraphs::iterator const & rIt);
+
+ // Must be called with both the external (Solar) and internal mutex
+ // locked, and after init has been called:
+ void determineVisibleRange();
+
+ // Must be called with both the external (Solar) and internal mutex
+ // locked, and after init has been called:
+ void notifyVisibleRangeChanges(
+ Paragraphs::iterator const & rOldVisibleBegin,
+ Paragraphs::iterator const & rOldVisibleEnd,
+ Paragraphs::iterator const & rInserted);
+
+ // Must be called with both the external (Solar) and internal mutex
+ // locked, and after init has been called:
+ void changeParagraphText(::sal_uLong nNumber, ::sal_uInt16 nBegin, ::sal_uInt16 nEnd,
+ bool bCut, bool bPaste,
+ ::rtl::OUString const & rText);
+
+ void
+ handleParagraphNotifications();
+
+ void handleSelectionChangeNotification();
+
+ void notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast );
+
+ void justifySelection( TextPaM& rTextStart, TextPaM& rTextEnd );
+
+ void disposeParagraphs();
+
+ static ::css::uno::Any mapFontColor(::Color const & rColor);
+
+ static ::Color mapFontColor(::css::uno::Any const & rColor);
+
+ static ::css::uno::Any mapFontWeight(::FontWeight nWeight);
+
+ static ::FontWeight mapFontWeight(::css::uno::Any const & rWeight);
+
+ void retrieveDefaultAttributesImpl(
+ ParagraphImpl const * pParagraph,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes,
+ tPropValMap& rDefAttrSeq);
+
+ void retrieveRunAttributesImpl(
+ ParagraphImpl const * pParagraph, ::sal_Int32 Index,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes,
+ tPropValMap& rRunAttrSeq);
+
+ static ::css::uno::Sequence< ::css::beans::PropertyValue >
+ convertHashMapToSequence(tPropValMap& rAttrSeq);
+
+ ::css::uno::Reference< ::css::accessibility::XAccessible > m_xAccessible;
+ ::TextEngine & m_rEngine;
+ ::TextView & m_rView;
+
+ SfxListenerGuard m_aEngineListener;
+ WindowListenerGuard m_aViewListener;
+
+ // All the following members have valid values only after calling init:
+
+ ::std::auto_ptr< Paragraphs > m_xParagraphs;
+
+ // m_nViewOffset is from the start of the document (0) to the start of the
+ // current view, and m_nViewHeight is the height of the view:
+ ::sal_Int32 m_nViewOffset;
+ ::sal_Int32 m_nViewHeight;
+
+ // m_aVisibleBegin points to the first Paragraph that is (partially)
+ // contained in the view, and m_aVisibleEnd points past the last Paragraph
+ // that is (partially) contained. If no Paragraphs are (partially) in the
+ // view, both m_aVisibleBegin and m_aVisibleEnd are set to
+ // m_xParagraphs->end(). These values are only changed by
+ // determineVisibleRange.
+ Paragraphs::iterator m_aVisibleBegin;
+ Paragraphs::iterator m_aVisibleEnd;
+
+ // m_nVisibleBeginOffset is from m_nViewOffset back to the start of the
+ // Paragraph pointed to by m_aVisibleBegin (and always has a non-negative
+ // value). If m_aVisibleBegin == m_xParagraphs->end(),
+ // m_nVisibleBeginOffset is set to 0. These values are only changed by
+ // determineVisibleRange.
+ ::sal_Int32 m_nVisibleBeginOffset;
+
+ // If no selection has yet been set, all the following four variables are
+ // set to -1. m_nSelectionLastPara/Pos is also the cursor position.
+ ::sal_Int32 m_nSelectionFirstPara;
+ ::sal_Int32 m_nSelectionFirstPos;
+ ::sal_Int32 m_nSelectionLastPara;
+ ::sal_Int32 m_nSelectionLastPos;
+
+ Paragraphs::iterator m_aFocused;
+
+ ::std::queue< ::TextHint > m_aParagraphNotifications;
+ bool m_bSelectionChangedNotification;
+ bool m_bCompoundControlChild;
+};
+
+}
+
+#endif // INCLUDED_ACCESSIBILITY_TEXTWINDOWACCESSIBILITY_HXX
diff --git a/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx
new file mode 100644
index 000000000000..0df5bd0fd1b4
--- /dev/null
+++ b/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX
+#define ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX
+
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+#include <tools/wintypes.hxx>
+
+namespace com { namespace sun { namespace star { namespace datatransfer { namespace clipboard {
+ class XClipboard;
+} } } } }
+
+class Window;
+namespace accessibility
+{
+ class SAL_NO_VTABLE IComboListBoxHelper
+ {
+ public:
+ virtual String GetEntry( sal_uInt16 nPos ) const = 0;
+ virtual Rectangle GetDropDownPosSizePixel( ) const = 0;
+ virtual Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const = 0;
+ virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow ) = 0;
+ virtual sal_Bool IsActive() const = 0;
+ virtual sal_Bool IsEntryVisible( sal_uInt16 nPos ) const = 0;
+ virtual sal_uInt16 GetDisplayLineCount() const = 0;
+ virtual void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const = 0;
+ virtual WinBits GetStyle() const = 0;
+ virtual sal_Bool IsMultiSelectionEnabled() const = 0;
+ virtual sal_uInt16 GetTopEntry() const = 0;
+ virtual sal_Bool IsEntryPosSelected( sal_uInt16 nPos ) const = 0;
+ virtual sal_uInt16 GetEntryCount() const = 0;
+ virtual void Select() = 0;
+ virtual void SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect = sal_True ) = 0;
+ virtual sal_uInt16 GetSelectEntryCount() const = 0;
+ virtual void SetNoSelection() = 0;
+ virtual sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const = 0;
+ virtual sal_Bool IsInDropDown() const = 0;
+ virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const = 0;
+ virtual long GetIndexForPoint( const Point& rPoint, sal_uInt16& nPos ) const = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >
+ GetClipboard() = 0;
+ };
+}
+#endif // ACCESSIBILITY_HELPER_COMBOLISTBOXHELPER_HXX
diff --git a/accessibility/inc/accessibility/helper/acc_factory.hxx b/accessibility/inc/accessibility/helper/acc_factory.hxx
new file mode 100644
index 000000000000..21c5ce47e5c7
--- /dev/null
+++ b/accessibility/inc/accessibility/helper/acc_factory.hxx
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_HELPER_FACTORY_HXX
+#define ACCESSIBILITY_HELPER_FACTORY_HXX
+
+#include <toolkit/helper/accessiblefactory.hxx>
+#include <svtools/accessiblefactory.hxx>
+
+/** this is the entry point to retrieve a factory for the toolkit-level Accessible/Contexts supplied
+ by this library
+
+ This function implements the factory function needed in toolkit
+ (of type GetStandardAccComponentFactory).
+*/
+extern "C" void* SAL_CALL getStandardAccessibleFactory();
+
+/** this is the entry point to retrieve a factory for the svtools-level Accessible/Contexts supplied
+ by this library
+
+ This function implements the factory function needed in svtools
+ (of type GetSvtAccessibilityComponentFactory).
+*/
+extern "C" void* SAL_CALL getSvtAccessibilityComponentFactory();
+
+#endif // ACCESSIBILITY_HELPER_FACTORY_HXX
diff --git a/accessibility/inc/accessibility/helper/accessiblestrings.hrc b/accessibility/inc/accessibility/helper/accessiblestrings.hrc
new file mode 100644
index 000000000000..1f936e678b98
--- /dev/null
+++ b/accessibility/inc/accessibility/helper/accessiblestrings.hrc
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_
+#define ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_
+
+
+//------------------------------------------------------------------------------
+
+#define RID_TK_ACC_START 1000
+
+
+// Accessible Action Id's ------------------------------------------------------
+
+#define RID_STR_ACC_ACTION_CLICK ( RID_TK_ACC_START + 0 )
+#define RID_STR_ACC_ACTION_TOGGLEPOPUP ( RID_TK_ACC_START + 1 )
+#define RID_STR_ACC_ACTION_SELECT ( RID_TK_ACC_START + 2 )
+#define RID_STR_ACC_ACTION_INCLINE ( RID_TK_ACC_START + 3 )
+#define RID_STR_ACC_ACTION_DECLINE ( RID_TK_ACC_START + 4 )
+#define RID_STR_ACC_ACTION_INCBLOCK ( RID_TK_ACC_START + 5 )
+#define RID_STR_ACC_ACTION_DECBLOCK ( RID_TK_ACC_START + 6 )
+
+
+#define RID_STR_ACC_NAME_BROWSEBUTTON ( RID_TK_ACC_START + 100 )
+#define RID_STR_ACC_DESC_PANELDECL_TABBAR ( RID_TK_ACC_START + 101 )
+
+// -----------------------------------------------------------------------------
+
+#endif // ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_
diff --git a/accessibility/inc/accessibility/helper/accresmgr.hxx b/accessibility/inc/accessibility/helper/accresmgr.hxx
new file mode 100644
index 000000000000..add0aaced7e3
--- /dev/null
+++ b/accessibility/inc/accessibility/helper/accresmgr.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_HELPER_TKARESMGR_HXX
+#define ACCESSIBILITY_HELPER_TKARESMGR_HXX
+
+#ifndef _RTL_USTRING_HXX
+#include <rtl/ustring.hxx>
+#endif
+
+class SimpleResMgr;
+
+#define TK_RES_STRING(id) TkResMgr::loadString(id)
+
+// -----------------------------------------------------------------------------
+// TkResMgr
+// -----------------------------------------------------------------------------
+
+class TkResMgr
+{
+ static SimpleResMgr* m_pImpl;
+
+private:
+ // no instantiation allowed
+ TkResMgr() { }
+ ~TkResMgr() { }
+
+ // we'll instantiate one static member of the following class,
+ // which in it's dtor ensures that m_pImpl will be deleted
+ class EnsureDelete
+ {
+ public:
+ EnsureDelete() { }
+ ~EnsureDelete();
+ };
+ friend class EnsureDelete;
+
+protected:
+ static void ensureImplExists();
+
+public:
+ // loads the string with the specified resource id
+ static ::rtl::OUString loadString( sal_uInt16 nResId );
+};
+
+
+#endif // ACCESSIBILITY_HELPER_TKARESMGR_HXX
+
diff --git a/accessibility/inc/accessibility/helper/characterattributeshelper.hxx b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx
new file mode 100644
index 000000000000..25fb3ac121b3
--- /dev/null
+++ b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX
+#define ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <vcl/font.hxx>
+
+#include <map>
+
+// -----------------------------------------------------------------------------
+// class CharacterAttributesHelper
+// -----------------------------------------------------------------------------
+
+class CharacterAttributesHelper
+{
+private:
+
+ typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any, ::std::less< ::rtl::OUString > > AttributeMap;
+
+ AttributeMap m_aAttributeMap;
+
+public:
+
+ CharacterAttributesHelper( const Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor );
+ ~CharacterAttributesHelper();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > GetCharacterAttributes( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes );
+};
+
+#endif // ACCESSIBILITY_HELPER_CHARACTERATTRIBUTESHELPER_HXX
diff --git a/accessibility/inc/accessibility/helper/listboxhelper.hxx b/accessibility/inc/accessibility/helper/listboxhelper.hxx
new file mode 100644
index 000000000000..b1edb36893f0
--- /dev/null
+++ b/accessibility/inc/accessibility/helper/listboxhelper.hxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX
+#define ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX
+
+#include <accessibility/helper/IComboListBoxHelper.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+
+// -----------------------------------------------------------------------------
+// globals
+// -----------------------------------------------------------------------------
+
+const sal_Int32 DEFAULT_INDEX_IN_PARENT = -1;
+
+// -----------------------------------------------------------------------------
+// class VCLListBoxHelper
+// -----------------------------------------------------------------------------
+
+template< class T > class VCLListBoxHelper : public ::accessibility::IComboListBoxHelper
+{
+private:
+ T& m_aComboListBox;
+
+public:
+ inline
+ VCLListBoxHelper( T& _pListBox ) :
+ m_aComboListBox( _pListBox ){}
+
+ // -----------------------------------------------------------------------------
+ virtual String GetEntry( sal_uInt16 nPos ) const
+ {
+ return m_aComboListBox.GetEntry( nPos );
+ }
+ // -----------------------------------------------------------------------------
+ virtual Rectangle GetDropDownPosSizePixel() const
+ {
+ Rectangle aTemp = m_aComboListBox.GetWindowExtentsRelative(NULL);
+ Rectangle aRet = m_aComboListBox.GetDropDownPosSizePixel();
+ aRet.Move(aTemp.TopLeft().X(),aTemp.TopLeft().Y());
+ return aRet;
+ }
+ // -----------------------------------------------------------------------------
+ virtual Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const
+ {
+ Rectangle aRect;
+ if ( m_aComboListBox.IsInDropDown() && IsEntryVisible( nItem ) )
+ {
+ Rectangle aTemp = m_aComboListBox.GetDropDownPosSizePixel();
+ Size aSize = aTemp.GetSize();
+ aSize.Height() /= m_aComboListBox.GetDisplayLineCount();
+ Point aTopLeft = aTemp.TopLeft();
+ aTopLeft.Y() += aSize.Height() * ( nItem - m_aComboListBox.GetTopEntry() );
+ aRect = Rectangle( aTopLeft, aSize );
+ }
+ else
+ aRect = m_aComboListBox.GetBoundingRectangle( nItem );
+ return aRect;
+ }
+ // -----------------------------------------------------------------------------
+ virtual Rectangle GetWindowExtentsRelative( Window* pRelativeWindow )
+ {
+ return m_aComboListBox.GetWindowExtentsRelative( pRelativeWindow );
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_Bool IsActive() const
+ {
+ return m_aComboListBox.IsActive();
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_Bool IsEntryVisible( sal_uInt16 nPos ) const
+ {
+ sal_uInt16 nTopEntry = m_aComboListBox.GetTopEntry();
+ sal_uInt16 nLines = m_aComboListBox.GetDisplayLineCount();
+ return ( nPos >= nTopEntry && nPos < ( nTopEntry + nLines ) );
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_uInt16 GetDisplayLineCount() const
+ {
+ return m_aComboListBox.GetDisplayLineCount();
+ }
+ // -----------------------------------------------------------------------------
+ virtual void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const
+ {
+ m_aComboListBox.GetMaxVisColumnsAndLines(rnCols,rnLines);
+ }
+ // -----------------------------------------------------------------------------
+ virtual WinBits GetStyle() const
+ {
+ return m_aComboListBox.GetStyle();
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_Bool IsMultiSelectionEnabled() const
+ {
+ return m_aComboListBox.IsMultiSelectionEnabled();
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_uInt16 GetTopEntry() const
+ {
+ return m_aComboListBox.GetTopEntry();
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_Bool IsEntryPosSelected( sal_uInt16 nPos ) const
+ {
+ return m_aComboListBox.IsEntryPosSelected(nPos);
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_uInt16 GetEntryCount() const
+ {
+ return m_aComboListBox.GetEntryCount();
+ }
+ // -----------------------------------------------------------------------------
+ virtual void Select()
+ {
+ m_aComboListBox.Select();
+ }
+ // -----------------------------------------------------------------------------
+ virtual void SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect = sal_True )
+ {
+ m_aComboListBox.SelectEntryPos(nPos,bSelect);
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_uInt16 GetSelectEntryCount() const
+ {
+ return m_aComboListBox.GetSelectEntryCount();
+ }
+ // -----------------------------------------------------------------------------
+ virtual void SetNoSelection()
+ {
+ m_aComboListBox.SetNoSelection();
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex = 0 ) const
+ {
+ return m_aComboListBox.GetSelectEntryPos(nSelIndex);
+ }
+ // -----------------------------------------------------------------------------
+ virtual sal_Bool IsInDropDown() const
+ {
+ return m_aComboListBox.IsInDropDown();
+ }
+ // -----------------------------------------------------------------------------
+ virtual Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const
+ {
+ Rectangle aRect;
+
+ Pair aEntryCharacterRange = m_aComboListBox.GetLineStartEnd( _nEntryPos );
+ if ( aEntryCharacterRange.A() + _nCharacterIndex <= aEntryCharacterRange.B() )
+ {
+ long nIndex = aEntryCharacterRange.A() + _nCharacterIndex;
+ aRect = m_aComboListBox.GetCharacterBounds( nIndex );
+ }
+ return aRect;
+ }
+ // -----------------------------------------------------------------------------
+ long GetIndexForPoint( const Point& rPoint, sal_uInt16& nPos ) const
+ {
+ return m_aComboListBox.GetIndexForPoint( rPoint, nPos );
+ }
+ // -----------------------------------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >
+ GetClipboard()
+ {
+ return m_aComboListBox.GetClipboard();
+ }
+ // -----------------------------------------------------------------------------
+};
+
+#endif // ACCESSIBILITY_HELPER_LISTBOXHELPER_HXX
+
diff --git a/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx
new file mode 100644
index 000000000000..4555c91ebf75
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX
+#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+#include <tools/link.hxx>
+
+#include <vector>
+
+class Menu;
+class VclSimpleEvent;
+class VclMenuEvent;
+class VCLExternalSolarLock;
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+// ----------------------------------------------------
+// class OAccessibleMenuBaseComponent
+// ----------------------------------------------------
+
+typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE;
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::lang::XServiceInfo > OAccessibleMenuBaseComponent_BASE;
+
+class OAccessibleMenuBaseComponent : public AccessibleExtendedComponentHelper_BASE,
+ public OAccessibleMenuBaseComponent_BASE
+{
+ friend class OAccessibleMenuItemComponent;
+ friend class VCLXAccessibleMenuItem;
+ friend class VCLXAccessibleMenu;
+
+private:
+ VCLExternalSolarLock* m_pExternalLock;
+
+protected:
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren;
+
+ AccessibleChildren m_aAccessibleChildren;
+ Menu* m_pMenu;
+
+ sal_Bool m_bEnabled;
+ sal_Bool m_bFocused;
+ sal_Bool m_bVisible;
+ sal_Bool m_bSelected;
+ sal_Bool m_bChecked;
+
+ Menu* GetMenu() { return m_pMenu; }
+
+ virtual sal_Bool IsEnabled();
+ virtual sal_Bool IsFocused();
+ virtual sal_Bool IsVisible();
+ virtual sal_Bool IsSelected();
+ virtual sal_Bool IsChecked();
+
+ void SetEnabled( sal_Bool bEnabled );
+ void SetFocused( sal_Bool bFocused );
+ void SetVisible( sal_Bool bVisible );
+ void SetSelected( sal_Bool bSelected );
+ void SetChecked( sal_Bool bChecked );
+
+ void UpdateEnabled( sal_Int32 i, sal_Bool bEnabled );
+ void UpdateFocused( sal_Int32 i, sal_Bool bFocused );
+ void UpdateVisible();
+ void UpdateSelected( sal_Int32 i, sal_Bool bSelected );
+ void UpdateChecked( sal_Int32 i, sal_Bool bChecked );
+ void UpdateAccessibleName( sal_Int32 i );
+ void UpdateItemText( sal_Int32 i );
+
+ sal_Int32 GetChildCount();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChild( sal_Int32 i );
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAt( const ::com::sun::star::awt::Point& rPoint );
+
+ void InsertChild( sal_Int32 i );
+ void RemoveChild( sal_Int32 i );
+
+ virtual sal_Bool IsHighlighted();
+ sal_Bool IsChildHighlighted();
+
+ void SelectChild( sal_Int32 i );
+ void DeSelectAll();
+ sal_Bool IsChildSelected( sal_Int32 i );
+
+ virtual void Select();
+ virtual void DeSelect();
+ virtual void Click();
+ virtual sal_Bool IsPopupMenuOpen();
+
+ DECL_LINK( MenuEventListener, VclSimpleEvent* );
+
+ virtual void ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent );
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) = 0;
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ OAccessibleMenuBaseComponent( Menu* pMenu );
+ virtual ~OAccessibleMenuBaseComponent();
+
+ void SetStates();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUBASECOMPONENT_HXX
+
diff --git a/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx
new file mode 100644
index 000000000000..8450be8f3a49
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/accessiblemenucomponent.hxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX
+#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX
+
+#include <accessibility/standard/accessiblemenubasecomponent.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class OAccessibleMenuComponent
+// ----------------------------------------------------
+
+typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE;
+
+typedef ::cppu::ImplHelper1<
+ ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleMenuComponent_BASE;
+
+class OAccessibleMenuComponent : public OAccessibleMenuBaseComponent,
+ public OAccessibleMenuComponent_BASE
+{
+protected:
+ virtual sal_Bool IsEnabled();
+ virtual sal_Bool IsVisible();
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+public:
+ OAccessibleMenuComponent( Menu* pMenu );
+ virtual ~OAccessibleMenuComponent();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUCOMPONENT_HXX
+
diff --git a/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx b/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx
new file mode 100644
index 000000000000..d5e513e555ea
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX
+#define ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX
+
+#include <accessibility/standard/accessiblemenubasecomponent.hxx>
+
+
+// ----------------------------------------------------
+// class OAccessibleMenuItemComponent
+// ----------------------------------------------------
+
+class OAccessibleMenuItemComponent : public OAccessibleMenuBaseComponent
+{
+ friend class OAccessibleMenuBaseComponent;
+
+protected:
+ Menu* m_pParent;
+ sal_uInt16 m_nItemPos;
+ ::rtl::OUString m_sAccessibleName;
+ ::rtl::OUString m_sItemText;
+
+ virtual sal_Bool IsEnabled();
+ virtual sal_Bool IsVisible();
+ virtual void Select();
+ virtual void DeSelect();
+ virtual void Click();
+
+ void SetItemPos( sal_uInt16 nItemPos );
+ void SetAccessibleName( const ::rtl::OUString& sAccessibleName );
+ ::rtl::OUString GetAccessibleName();
+ void SetItemText( const ::rtl::OUString& sItemText );
+ ::rtl::OUString GetItemText();
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu );
+ virtual ~OAccessibleMenuItemComponent();
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_ACCESSIBLEMENUITEMCOMPONENT_HXX
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx
new file mode 100644
index 000000000000..123016f070bd
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx
@@ -0,0 +1,184 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBOX_HXX
+
+#include <map>
+#include <accessibility/standard/vclxaccessibleedit.hxx>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_STANDARD_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleAction
+ > VCLXAccessibleBox_BASE;
+
+
+/** Base class for list- and combo boxes. This class manages the box'
+ children. The classed derived from this one have only to implement the
+ <member>IsValid</member> method and return the corrent implementation name.
+*/
+class VCLXAccessibleBox
+ : public VCLXAccessibleComponent,
+ public VCLXAccessibleBox_BASE
+{
+public:
+ enum BoxType {COMBOBOX, LISTBOX};
+
+ /** The constructor is initialized with the box type whitch may be
+ either <const>COMBOBOX</const> or <const>LISTBOX</const> and a flag
+ indicating whether the box is a drop down box.
+ */
+ VCLXAccessibleBox (VCLXWindow* pVCLXindow, BoxType aType, bool bIsDropDownBox);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+
+
+ // XAccessible
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+
+ /** Each object has one or two children: an optional text field and the
+ actual list. The text field is not provided for non drop down list
+ boxes.
+ */
+ sal_Int32 SAL_CALL getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ /** For drop down list boxes the text field is a not editable
+ <type>VCLXAccessibleTextField</type>, for combo boxes it is an
+ editable <type>VLCAccessibleEdit</type>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 i)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ /** The role is always <const
+ scope="com::sun::star::accessibility">AccessibleRole::COMBO_BOX</const>.
+ */
+ sal_Int16 SAL_CALL getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ sal_Int32 SAL_CALL getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+
+ /** There is one action for drop down boxes and none for others.
+ */
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ /** The action for drop down boxes lets the user toggle the visibility of the
+ popup menu.
+ */
+ virtual sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ /** The returned string is assoicated with resource
+ <const>RID_STR_ACC_ACTION_TOGGLEPOPUP</const>.
+ */
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ /** No keybinding returned so far.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
+ getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+
+ /** This method is called from the implementation helper during an
+ XComponent::dispose() call.
+ */
+ virtual void SAL_CALL disposing (void);
+
+
+protected:
+ /** Specifies whether the box is a combo box or a list box. List boxes
+ have multi selection.
+ */
+ BoxType m_aBoxType;
+
+ /// Specifies whether the box is a drop down box and thus has an action.
+ bool m_bIsDropDownBox;
+
+ /// The child that represents the text field if there is one.
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>
+ m_xText;
+
+ /// The child that contains the items of this box.
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>
+ m_xList;
+
+ /** This flag specifies whether an object has a text field as child
+ regardless of whether that child being currently instantiated or
+ not.
+ */
+ bool m_bHasTextChild;
+
+ /** This flag specifies whether an object has a list as child regardless
+ of whether that child being currently instantiated or not. This
+ flag is always true in the current implementation because the list
+ child is just another wrapper arround this object and thus has the
+ same life time.
+ */
+ bool m_bHasListChild;
+
+ virtual ~VCLXAccessibleBox (void);
+
+ /** Returns </true> when the object is valid.
+ */
+ virtual bool IsValid (void) const = 0;
+
+ virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent);
+ virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+
+
+private:
+ /// Index in parent. This is settable from the outside.
+ sal_Int32 m_nIndexInParent;
+};
+
+#endif
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx
new file mode 100644
index 000000000000..76e8b3da9343
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblebutton.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX
+
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleButton
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessibleAction,
+ ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleButton_BASE;
+
+class VCLXAccessibleButton : public VCLXAccessibleTextComponent,
+ public VCLXAccessibleButton_BASE
+{
+protected:
+ virtual ~VCLXAccessibleButton();
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+public:
+ VCLXAccessibleButton( VCLXWindow* pVCLXindow );
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleValue
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEBUTTON_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx
new file mode 100644
index 000000000000..a876a236455c
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblecheckbox.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX
+
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleCheckBox
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessibleAction,
+ ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleCheckBox_BASE;
+
+class VCLXAccessibleCheckBox : public VCLXAccessibleTextComponent,
+ public VCLXAccessibleCheckBox_BASE
+{
+private:
+ bool m_bChecked;
+ bool m_bIndeterminate;
+
+protected:
+ virtual ~VCLXAccessibleCheckBox();
+
+ bool IsChecked();
+ bool IsIndeterminate();
+
+ void SetChecked( bool bChecked );
+ void SetIndeterminate( bool bIndeterminate );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+public:
+ VCLXAccessibleCheckBox( VCLXWindow* pVCLXindow );
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleValue
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx
new file mode 100644
index 000000000000..ce62ea845b5c
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblecombobox.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLECOMBOBOX_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLECOMBOBOX_HXX
+
+#include <map>
+#include <accessibility/standard/vclxaccessiblebox.hxx>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_STANDARD_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+
+/** The accessible combobox has two children. The first is the text field
+ represented by an object of the <type>VCLXAccessibleEdit</type> class.
+ The second is the list containing all items and is represented by an
+ object of the <type>VCLXAccessibleList</type> class which does not
+ support selection at the moment.
+*/
+class VCLXAccessibleComboBox
+ : public VCLXAccessibleBox
+{
+public:
+ VCLXAccessibleComboBox (VCLXWindow* pVCLXindow);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // Return combo box specific services.
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ~VCLXAccessibleComboBox (void);
+
+ virtual bool IsValid (void) const;
+ virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLECHECKBOX_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx
new file mode 100644
index 000000000000..6f54ede32d21
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibledropdowncombobox.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX
+
+#include <accessibility/standard/vclxaccessiblebox.hxx>
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTEDIT_HXX
+#include <accessibility/standard/vclxaccessibleedit.hxx>
+#endif
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAKREF_HXX
+#include <cppuhelper/weakref.hxx>
+#endif
+
+
+/** The accessible drop down combobox has two children. The first is the
+ text field represented by an object of the
+ <type>VCLXAccessibleEdit</type> class. The second is the list
+ containing all items and is represented by an object of the
+ <type>VCLXAccessibleList</type> class which does not support selection
+ at the moment.
+*/
+class VCLXAccessibleDropDownComboBox : public VCLXAccessibleBox
+{
+public:
+ VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLXindow);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // Return drop down combo box specific services.
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ~VCLXAccessibleDropDownComboBox (void);
+
+ virtual bool IsValid (void) const;
+ virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNCOMBOBOX_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx
new file mode 100644
index 000000000000..72289f210aa2
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibledropdownlistbox.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX
+
+#include <accessibility/standard/vclxaccessiblebox.hxx>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+#ifndef _CPPUHELPER_WEAKREF_HXX
+#include <cppuhelper/weakref.hxx>
+#endif
+
+
+/** The accessible drop down combobox has two children. The first is the
+ text field represented by an object of the
+ <type>VCLXAccessibleTextField</type> class which can not be edited. The
+ second is the list containing all items and is represented by an object
+ of the <type>VCLXAccessibleListBoxList</type> class which does support
+ selection.
+*/
+class VCLXAccessibleDropDownListBox : public VCLXAccessibleBox
+{
+public:
+ VCLXAccessibleDropDownListBox (VCLXWindow* pVCLXindow);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // Return drop down list box specific services.
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ~VCLXAccessibleDropDownListBox (void);
+
+ virtual bool IsValid (void) const;
+ virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEDROPDOWNLISTBOX_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx
new file mode 100644
index 000000000000..1e5bb36ec03d
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibleedit.hxx
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX
+
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleEdit
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessibleAction,
+ ::com::sun::star::accessibility::XAccessibleEditableText > VCLXAccessibleEdit_BASE;
+
+class VCLXAccessibleEdit : public VCLXAccessibleTextComponent,
+ public VCLXAccessibleEdit_BASE
+{
+ friend class VCLXAccessibleBox;
+
+private:
+ sal_Int32 m_nSelectionStart;
+ sal_Int32 m_nCaretPosition;
+
+protected:
+ virtual ~VCLXAccessibleEdit();
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+public:
+ VCLXAccessibleEdit( VCLXWindow* pVCLXindow );
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEditableText
+ virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setText( const ::rtl::OUString& sText ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEEDIT_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx
new file mode 100644
index 000000000000..250d5f7551f5
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblefixedhyperlink.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX
+
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+
+// ----------------------------------------------------
+// class VCLXAccessibleFixedHyperlink
+// ----------------------------------------------------
+
+class VCLXAccessibleFixedHyperlink : public VCLXAccessibleTextComponent
+{
+protected:
+ virtual ~VCLXAccessibleFixedHyperlink();
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+ virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+
+public:
+ VCLXAccessibleFixedHyperlink( VCLXWindow* pVCLXindow );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDHYPERLINK_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx
new file mode 100644
index 000000000000..e013fdc8d475
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblefixedtext.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX
+
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+
+// ----------------------------------------------------
+// class VCLXAccessibleFixedText
+// ----------------------------------------------------
+
+class VCLXAccessibleFixedText : public VCLXAccessibleTextComponent
+{
+protected:
+ virtual ~VCLXAccessibleFixedText();
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+ virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+
+public:
+ VCLXAccessibleFixedText( VCLXWindow* pVCLXindow );
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEFIXEDTEXT_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx
new file mode 100644
index 000000000000..f90cb286b4c4
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELIST_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELIST_HXX
+
+#include <vector>
+#include <functional>
+#include "accessibility/standard/vclxaccessiblelistitem.hxx"
+#include <accessibility/standard/vclxaccessibleedit.hxx>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_STANDARD_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleSelection
+ > VCLXAccessibleList_BASE;
+
+typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > >
+ ListItems;
+
+namespace accessibility
+{
+ class IComboListBoxHelper;
+}
+
+
+/** Base class for the list contained in list- and combo boxes. This class
+ does not support selection because lists of combo boxes give no direct
+ access to their underlying list implementation. Look into derived
+ classes for selection.
+*/
+class VCLXAccessibleList
+ : public VCLXAccessibleComponent,
+ public VCLXAccessibleList_BASE
+{
+public:
+ enum BoxType {COMBOBOX, LISTBOX};
+
+ VCLXAccessibleList (VCLXWindow* pVCLXindow, BoxType aBoxType,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& _xParent);
+
+ /** The index that is passed to this method is returned on following
+ calls to <member>getAccessibleIndexInParent</member>.
+ */
+ void SetIndexInParent (sal_Int32 nIndex);
+
+ /** Process some of the events and delegate the rest to the base classes.
+ */
+ virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+
+ /** Called on reception of selection events this method checks all known
+ list items for a possible change in their selection state and
+ updates that accordingly. No accessibility events are send because
+ the XAccessibleSelection interface is not supported and the items
+ are transient.
+ @param sTextOfSelectedItem
+ This string contains the text of the the currently selected
+ item. It is used to retrieve the index of that item.
+ */
+ void UpdateSelection (::rtl::OUString sTextOfSelectedItem);
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 i)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The index returned as index in parent is always the one set with the
+ <member>SetIndexInParent()</member> method.
+ */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL contains (const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleAt (const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // Return list specific services.
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ BoxType m_aBoxType;
+ ::accessibility::IComboListBoxHelper* m_pListBoxHelper;
+ ListItems m_aAccessibleChildren;
+ sal_Int32 m_nVisibleLineCount;
+ /// Index in parent. This is settable from the outside.
+ sal_Int32 m_nIndexInParent;
+ sal_Int32 m_nLastTopEntry;
+ sal_uInt16 m_nLastSelectedPos;
+ bool m_bDisableProcessEvent;
+ bool m_bVisible;
+
+
+
+ /// The currently selected item.
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible>
+ m_xSelectedItem;
+
+ virtual ~VCLXAccessibleList (void);
+
+ /** This function is called from the implementation helper during a
+ XComponent::dispose call. Free the list of items and the items themselves.
+ */
+ virtual void SAL_CALL disposing (void);
+
+ /** This method adds the states
+ <const>AccessibleStateType::FOCUSABLE</const> and possibly
+ <const>AccessibleStateType::MULTI_SELECTABLE</const> to the state set
+ of the base classes.
+ */
+ virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet);
+
+ /** Create the specified child and insert it into the list of children.
+ Sets the child's states.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreateChild (sal_Int32 i);
+
+ /** Call this method when the item list has been changed, i.e. items
+ have been deleted or inserted.
+ @param bItemInserted
+ Indicate whether items have been inserted (<TRUE/>) or removed
+ (<FALSE/>).
+ @param nIndex
+ Index of the new or removed item. A value of -1 indicates that
+ the whole list has been cleared.
+ */
+ virtual void HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex);
+
+ // VCLXAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ /** We need to save the accessible parent to return it in <type>getAccessibleParent()</type>,
+ because this method of the base class returns the wrong parent.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xParent;
+
+
+ /** dispose all items aand clears the container
+ */
+ void clearItems();
+
+ void adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t<bool,VCLXAccessibleListItem>& _rMemFun);
+ void UpdateEntryRange_Impl (void);
+protected:
+ void UpdateSelection_Impl (sal_uInt16 nPos = 0);
+ sal_Bool checkEntrySelected(sal_uInt16 _nPos,
+ ::com::sun::star::uno::Any& _rNewValue,
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewAcc);
+private:
+ void notifyVisibleStates(sal_Bool _bSetNew );
+ void UpdateVisibleLineCount();
+};
+
+#endif
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx
new file mode 100644
index 000000000000..c814cb83d84a
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblelistbox.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX
+
+#include <accessibility/standard/vclxaccessiblebox.hxx>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+
+/** The accessible drop down combobox has one children. It is the list
+ containing all items and is represented by an object of the
+ <type>VCLXAccessibleListBoxList</type> class which does support
+ selection.
+*/
+class VCLXAccessibleListBox : public VCLXAccessibleBox
+{
+public:
+ VCLXAccessibleListBox (VCLXWindow* pVCLXindow);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // Return list box specific services.
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ~VCLXAccessibleListBox (void);
+
+ virtual bool IsValid (void) const;
+ virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTBOX_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx
new file mode 100644
index 000000000000..ec07745bb0d4
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#ifndef _CPPUHELPER_COMPBASE6_HXX
+#include <cppuhelper/compbase6.hxx>
+#endif
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX
+#include <comphelper/broadcasthelper.hxx>
+#endif
+#include <comphelper/accessibletexthelper.hxx>
+
+// forward ---------------------------------------------------------------
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Point;
+ struct Rectangle;
+ struct Size;
+ class XFocusListener;
+} } } }
+
+namespace accessibility
+{
+ class IComboListBoxHelper;
+}
+
+// class VCLXAccessibleListItem ------------------------------------------
+
+typedef ::cppu::WeakAggComponentImplHelper6< ::com::sun::star::accessibility::XAccessible
+ , ::com::sun::star::accessibility::XAccessibleContext
+ , ::com::sun::star::accessibility::XAccessibleComponent
+ , ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ , ::com::sun::star::accessibility::XAccessibleText
+ , ::com::sun::star::lang::XServiceInfo > VCLXAccessibleListItem_BASE;
+
+/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
+*/
+class VCLXAccessibleListItem : public ::comphelper::OBaseMutex,
+ public ::comphelper::OCommonAccessibleText,
+ public VCLXAccessibleListItem_BASE
+{
+private:
+ ::rtl::OUString m_sEntryText;
+ sal_Int32 m_nIndexInParent;
+ sal_Bool m_bSelected;
+ sal_Bool m_bVisible;
+
+protected:
+ /// client id in the AccessibleEventNotifier queue
+ sal_uInt32 m_nClientId;
+ ::accessibility::IComboListBoxHelper* m_pListBoxHelper;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > m_xParentContext;
+
+private:
+ /** notifies all listeners that this object has changed
+ @param _nEventId
+ is the event id
+ @param _aOldValue
+ is the old value
+ @param _aNewValue
+ is the new value
+ */
+ void NotifyAccessibleEvent( sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _aOldValue,
+ const ::com::sun::star::uno::Any& _aNewValue );
+
+protected:
+ virtual ~VCLXAccessibleListItem();
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+public:
+ /** OAccessibleBase needs a valid view
+ @param _pListBoxHelper
+ is the list- or combobox for which we implement an accessible object
+ @param _nIndexInParent
+ is the position of the entry inside the listbox
+ @param _xParent
+ is our parent accessible object
+ */
+ VCLXAccessibleListItem( ::accessibility::IComboListBoxHelper* _pListBoxHelper,
+ sal_Int32 _nIndexInParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
+
+
+ inline sal_Bool IsSelected() const { return m_bSelected; }
+ void SetSelected( sal_Bool _bSelected );
+ void SetVisible( sal_Bool _bVisible );
+ inline bool DecrementIndexInParent() { OSL_ENSURE(m_nIndexInParent != 0,"Invalid call!");--m_nIndexInParent; return true;}
+ inline bool IncrementIndexInParent() { ++m_nIndexInParent; return true;}
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw();
+ virtual void SAL_CALL release( ) throw();
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ using cppu::WeakAggComponentImplHelperBase::addEventListener;
+ using cppu::WeakAggComponentImplHelperBase::removeEventListener;
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_ACCESSIBLELISTBOXENTRY_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx
new file mode 100644
index 000000000000..35851788853b
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx
@@ -0,0 +1,86 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX
+
+#include <accessibility/standard/vclxaccessiblemenuitem.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleMenu
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper1 <
+ ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleMenu_BASE;
+
+class VCLXAccessibleMenu : public VCLXAccessibleMenuItem,
+ public VCLXAccessibleMenu_BASE
+{
+protected:
+ virtual sal_Bool IsFocused();
+ virtual sal_Bool IsPopupMenuOpen();
+
+public:
+ VCLXAccessibleMenu( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu );
+ virtual ~VCLXAccessibleMenu();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
new file mode 100644
index 000000000000..d9899b52dc2f
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenubar.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX
+
+#include <accessibility/standard/accessiblemenucomponent.hxx>
+
+class VclSimpleEvent;
+class VclWindowEvent;
+class Window;
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleMenuBar
+// ----------------------------------------------------
+
+class VCLXAccessibleMenuBar : public OAccessibleMenuComponent
+{
+protected:
+ Window* m_pWindow;
+
+ virtual sal_Bool IsFocused();
+
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleMenuBar( Menu* pMenu );
+ virtual ~VCLXAccessibleMenuBar();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUBAR_HXX
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx
new file mode 100644
index 000000000000..e2e430d9300b
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenuitem.hxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX
+
+#include <accessibility/standard/accessiblemenuitemcomponent.hxx>
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE3_HXX
+#include <cppuhelper/implbase3.hxx>
+#endif
+#include <comphelper/accessibletexthelper.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleMenuItem
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper3<
+ ::com::sun::star::accessibility::XAccessibleText,
+ ::com::sun::star::accessibility::XAccessibleAction,
+ ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleMenuItem_BASE;
+
+class VCLXAccessibleMenuItem : public OAccessibleMenuItemComponent,
+ public ::comphelper::OCommonAccessibleText,
+ public VCLXAccessibleMenuItem_BASE
+{
+protected:
+ virtual sal_Bool IsFocused();
+ virtual sal_Bool IsSelected();
+ virtual sal_Bool IsChecked();
+
+ virtual sal_Bool IsHighlighted();
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+public:
+ VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu = 0 );
+ virtual ~VCLXAccessibleMenuItem();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleValue
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUITEM_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx
new file mode 100644
index 000000000000..30ae2e764cdb
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblemenuseparator.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX
+
+#include <accessibility/standard/accessiblemenuitemcomponent.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleMenuSeparator
+// ----------------------------------------------------
+
+class VCLXAccessibleMenuSeparator : public OAccessibleMenuItemComponent
+{
+public:
+ VCLXAccessibleMenuSeparator( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu = 0 );
+ virtual ~VCLXAccessibleMenuSeparator();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENUSEPARATOR_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx
new file mode 100644
index 000000000000..d4ccd5f09ff5
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblepopupmenu.hxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX
+
+#include <accessibility/standard/accessiblemenucomponent.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXAccessiblePopupMenu
+// ----------------------------------------------------
+
+class VCLXAccessiblePopupMenu : public OAccessibleMenuComponent
+{
+protected:
+ virtual sal_Bool IsFocused();
+
+public:
+ VCLXAccessiblePopupMenu( Menu* pMenu );
+ virtual ~VCLXAccessiblePopupMenu();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEPOPUPMENU_HXX
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx b/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx
new file mode 100644
index 000000000000..615ed08ca2da
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX
+
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleRadioButton
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessibleAction,
+ ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleRadioButton_BASE;
+
+class VCLXAccessibleRadioButton : public VCLXAccessibleTextComponent,
+ public VCLXAccessibleRadioButton_BASE
+{
+protected:
+ virtual ~VCLXAccessibleRadioButton();
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+public:
+ VCLXAccessibleRadioButton( VCLXWindow* pVCLXindow );
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleValue
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLERADIOBUTTON_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx
new file mode 100644
index 000000000000..063204214a19
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleScrollBar
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessibleAction,
+ ::com::sun::star::accessibility::XAccessibleValue > VCLXAccessibleScrollBar_BASE;
+
+class VCLXAccessibleScrollBar : public VCLXAccessibleComponent,
+ public VCLXAccessibleScrollBar_BASE
+{
+protected:
+ virtual ~VCLXAccessibleScrollBar();
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+public:
+ VCLXAccessibleScrollBar( VCLXWindow* pVCLXindow );
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleValue
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx
new file mode 100644
index 000000000000..5243229b4902
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbar.hxx
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+#include <vector>
+
+class StatusBar;
+
+// ----------------------------------------------------
+// class VCLXAccessibleStatusBar
+// ----------------------------------------------------
+
+class VCLXAccessibleStatusBar : public VCLXAccessibleComponent
+{
+private:
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren;
+
+ AccessibleChildren m_aAccessibleChildren;
+ StatusBar* m_pStatusBar;
+
+protected:
+ void UpdateShowing( sal_Int32 i, sal_Bool bShowing );
+ void UpdateItemName( sal_Int32 i );
+ void UpdateItemText( sal_Int32 i );
+
+ void InsertChild( sal_Int32 i );
+ void RemoveChild( sal_Int32 i );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow );
+ ~VCLXAccessibleStatusBar();
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBAR_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx
new file mode 100644
index 000000000000..442645c6d88f
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessiblestatusbaritem.hxx
@@ -0,0 +1,144 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/accessibletexthelper.hxx>
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+class StatusBar;
+class VCLExternalSolarLock;
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleStatusBarItem
+// ----------------------------------------------------
+
+typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE;
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::lang::XServiceInfo > VCLXAccessibleStatusBarItem_BASE;
+
+class VCLXAccessibleStatusBarItem : public AccessibleTextHelper_BASE,
+ public VCLXAccessibleStatusBarItem_BASE
+{
+ friend class VCLXAccessibleStatusBar;
+
+private:
+ VCLExternalSolarLock* m_pExternalLock;
+ StatusBar* m_pStatusBar;
+ sal_uInt16 m_nItemId;
+ ::rtl::OUString m_sItemName;
+ ::rtl::OUString m_sItemText;
+ sal_Bool m_bShowing;
+
+protected:
+ sal_Bool IsShowing();
+ void SetShowing( sal_Bool bShowing );
+ void SetItemName( const ::rtl::OUString& sItemName );
+ ::rtl::OUString GetItemName();
+ void SetItemText( const ::rtl::OUString& sItemText );
+ ::rtl::OUString GetItemText();
+ sal_uInt16 GetItemId() const { return m_nItemId; }
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId );
+ virtual ~VCLXAccessibleStatusBarItem();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESTATUSBARITEM_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx
new file mode 100644
index 000000000000..f663ca3475fc
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletabcontrol.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+#include <vector>
+
+class TabControl;
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleTabControl
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper1 <
+ ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleTabControl_BASE;
+
+class VCLXAccessibleTabControl : public VCLXAccessibleComponent,
+ public VCLXAccessibleTabControl_BASE
+{
+private:
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > AccessibleChildren;
+
+ AccessibleChildren m_aAccessibleChildren;
+ TabControl* m_pTabControl;
+
+protected:
+ void UpdateFocused();
+ void UpdateSelected( sal_Int32 i, bool bSelected );
+ void UpdatePageText( sal_Int32 i );
+ void UpdateTabPage( sal_Int32 i, bool bNew );
+
+ void InsertChild( sal_Int32 i );
+ void RemoveChild( sal_Int32 i );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow );
+ ~VCLXAccessibleTabControl();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABCONTROL_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx
new file mode 100644
index 000000000000..ed47ce9f0e94
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpage.hxx
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <comphelper/accessibletexthelper.hxx>
+#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+
+class TabControl;
+class VCLExternalSolarLock;
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleTabPage
+// ----------------------------------------------------
+
+typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE;
+
+typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::lang::XServiceInfo > VCLXAccessibleTabPage_BASE;
+
+class VCLXAccessibleTabPage : public AccessibleTextHelper_BASE,
+ public VCLXAccessibleTabPage_BASE
+{
+ friend class VCLXAccessibleTabControl;
+
+private:
+ VCLExternalSolarLock* m_pExternalLock;
+ TabControl* m_pTabControl;
+ sal_uInt16 m_nPageId;
+ bool m_bFocused;
+ bool m_bSelected;
+ ::rtl::OUString m_sPageText;
+
+protected:
+ bool IsFocused();
+ bool IsSelected();
+
+ void SetFocused( bool bFocused );
+ void SetSelected( bool bSelected );
+ void SetPageText( const ::rtl::OUString& sPageText );
+ ::rtl::OUString GetPageText();
+
+ void Update( bool bNew );
+
+ sal_uInt16 GetPageId() const { return m_nPageId; }
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleTabPage( TabControl* pTabControl, sal_uInt16 nPageId );
+ virtual ~VCLXAccessibleTabPage();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGE_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx
new file mode 100644
index 000000000000..5ba980cc8c4f
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletabpagewindow.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+
+
+class TabControl;
+class TabPage;
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleTabPageWindow
+// ----------------------------------------------------
+
+class VCLXAccessibleTabPageWindow : public VCLXAccessibleComponent
+{
+private:
+ TabControl* m_pTabControl;
+ TabPage* m_pTabPage;
+ sal_uInt16 m_nPageId;
+
+protected:
+ // OCommonAccessibleComponent
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow );
+ ~VCLXAccessibleTabPageWindow();
+
+ // XAccessibleContext
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETABPAGEWINDOW_HXX
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx
new file mode 100644
index 000000000000..47e7189cd95a
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletextcomponent.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <comphelper/accessibletexthelper.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleTextComponent
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper1 <
+ ::com::sun::star::accessibility::XAccessibleText > VCLXAccessibleTextComponent_BASE;
+
+class VCLXAccessibleTextComponent : public VCLXAccessibleComponent,
+ public ::comphelper::OCommonAccessibleText,
+ public VCLXAccessibleTextComponent_BASE
+{
+protected:
+ ::rtl::OUString m_sText;
+
+ void SetText( const ::rtl::OUString& sText );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow );
+ ~VCLXAccessibleTextComponent();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+};
+
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTCOMPONENT_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx
new file mode 100644
index 000000000000..70d35acb305a
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletextfield.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETEXTFIELD_HXX
+
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+
+#ifndef _CPPUHELPER_IMPLBASE1_HXX
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+typedef ::cppu::ImplHelper1<
+ ::com::sun::star::accessibility::XAccessible
+ > VCLXAccessible_BASE;
+
+
+/** This class represents non editable text fields. The object passed to
+ the constructor is expected to be a list (a <type>ListBox</type> to be
+ more specific). From this allways the selected item is token to be made
+ accessible by this class. When the selected item changes then also the
+ exported text changes.
+*/
+class VCLXAccessibleTextField :
+ public VCLXAccessibleTextComponent,
+ public VCLXAccessible_BASE
+{
+public:
+ VCLXAccessibleTextField (VCLXWindow* pVCLXindow,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible >& _xParent);
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XAccessible
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ sal_Int32 SAL_CALL getAccessibleChildCount (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 i)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleParent( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ // Return text field specific services.
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ~VCLXAccessibleTextField (void);
+
+ /** With this method the text of the currently selected item is made
+ available to the <type>VCLXAccessibleTextComponent</type> base class.
+ */
+ ::rtl::OUString implGetText (void);
+
+private:
+ /** We need to save the accessible parent to return it in <type>getAccessibleParent()</type>,
+ because this method of the base class returns the wrong parent.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xParent;
+};
+
+#endif
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx
new file mode 100644
index 000000000000..7283cec6a95c
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolbox.hxx
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX
+
+#include <map>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+// ----------------------------------------------------
+// class VCLXAccessibleToolBox
+// ----------------------------------------------------
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleSelection > VCLXAccessibleToolBox_BASE;
+
+typedef std::map< sal_Int32, com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > ToolBoxItemsMap;
+
+class VCLXAccessibleToolBoxItem;
+class ToolBox;
+
+class VCLXAccessibleToolBox : public VCLXAccessibleComponent, public VCLXAccessibleToolBox_BASE
+{
+private:
+ ToolBoxItemsMap m_aAccessibleChildren;
+
+ VCLXAccessibleToolBoxItem* GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus );
+
+ void UpdateFocus_Impl();
+ void ReleaseFocus_Impl( sal_Int32 _nPos );
+ void UpdateChecked_Impl( sal_Int32 _nPos );
+ void UpdateIndeterminate_Impl( sal_Int32 _nPos );
+ void UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded );
+ void UpdateAllItems_Impl();
+ void UpdateItemName_Impl( sal_Int32 _nPos );
+ void UpdateItemEnabled_Impl( sal_Int32 _nPos );
+ void UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen );
+ void HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow );
+ void ReleaseSubToolBox( ToolBox* _pSubToolBox );
+
+protected:
+ virtual ~VCLXAccessibleToolBox();
+
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent );
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent );
+
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+public:
+ VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow );
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleSelection
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void implReleaseToolboxItem(
+ ToolBoxItemsMap::iterator& _rMapPos,
+ bool _bNotifyRemoval,
+ bool _bDispose
+ );
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOX_HXX
+
diff --git a/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
new file mode 100644
index 000000000000..2869e240227d
--- /dev/null
+++ b/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX
+#define ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#ifndef _CPPUHELPER_IMPLBASE4_HXX
+#include <cppuhelper/implbase4.hxx>
+#endif
+#include <comphelper/accessibletexthelper.hxx>
+#include <tools/solar.h>
+
+// class VCLXAccessibleToolBoxItem ---------------------------------------------
+
+class ToolBox;
+
+typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE;
+typedef ::cppu::ImplHelper4 < ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleAction,
+ ::com::sun::star::accessibility::XAccessibleValue,
+ ::com::sun::star::lang::XServiceInfo > VCLXAccessibleToolBoxItem_BASE;
+
+class VCLExternalSolarLock;
+
+class VCLXAccessibleToolBoxItem : public AccessibleTextHelper_BASE,
+ public VCLXAccessibleToolBoxItem_BASE
+{
+private:
+ ::rtl::OUString m_sOldName;
+ ToolBox* m_pToolBox;
+ VCLExternalSolarLock* m_pExternalLock;
+ sal_Int32 m_nIndexInParent;
+ sal_Int16 m_nRole;
+ sal_uInt16 m_nItemId;
+ sal_Bool m_bHasFocus;
+ sal_Bool m_bIsChecked;
+ bool m_bIndeterminate;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xChild;
+
+public:
+ inline sal_Int32 getIndexInParent() const { return m_nIndexInParent; }
+ inline void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; }
+
+protected:
+ virtual ~VCLXAccessibleToolBoxItem();
+
+ virtual void SAL_CALL disposing();
+
+ /// implements the calculation of the bounding rectangle
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OCommonAccessibleText
+ virtual ::rtl::OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+
+ ::rtl::OUString GetText( bool _bAsName );
+
+public:
+ VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos );
+
+ void SetFocus( sal_Bool _bFocus );
+ inline sal_Bool HasFocus() const { return m_bHasFocus; }
+ void SetChecked( sal_Bool _bCheck );
+ inline sal_Bool IsChecked() const { return m_bIsChecked; }
+ void SetIndeterminate( bool _bIndeterminate );
+ inline bool IsIndeterminate() const { return m_bIndeterminate; }
+ inline void ReleaseToolBox() { m_pToolBox = NULL; }
+ void NameChanged();
+ void SetChild( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xChild );
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ GetChild() const { return m_xChild; }
+ void NotifyChildEvent( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xChild, bool _bShow );
+
+ void ToggleEnableState();
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleExtendedComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getFontMetrics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& xFont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitledBorderText( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getToolTipText( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleAction
+ virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleValue
+ virtual ::com::sun::star::uno::Any SAL_CALL getCurrentValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCurrentValue( const ::com::sun::star::uno::Any& aNumber ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMaximumValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue( ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLETOOLBOXITEM_HXX
+
diff --git a/accessibility/inc/makefile.mk b/accessibility/inc/makefile.mk
new file mode 100644
index 000000000000..3afcad166928
--- /dev/null
+++ b/accessibility/inc/makefile.mk
@@ -0,0 +1,47 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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=accessibility
+TARGET=inc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(ENABLE_PCH)"!=""
+ALLTAR : \
+ $(SLO)$/precompiled.pch \
+ $(SLO)$/precompiled_ex.pch
+
+.ENDIF # "$(ENABLE_PCH)"!=""
+
diff --git a/accessibility/inc/pch/precompiled_accessibility.cxx b/accessibility/inc/pch/precompiled_accessibility.cxx
new file mode 100644
index 000000000000..de6282ce69cb
--- /dev/null
+++ b/accessibility/inc/pch/precompiled_accessibility.cxx
@@ -0,0 +1,29 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_accessibility.hxx"
+
diff --git a/accessibility/inc/pch/precompiled_accessibility.hxx b/accessibility/inc/pch/precompiled_accessibility.hxx
new file mode 100644
index 000000000000..4d3020b4e289
--- /dev/null
+++ b/accessibility/inc/pch/precompiled_accessibility.hxx
@@ -0,0 +1,37 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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): Generated on 2006-09-01 17:49:28.952369
+
+#ifdef PRECOMPILED_HEADERS
+
+//---MARKER---
+
+#include "com/sun/star/accessibility/AccessibleRelationType.hpp"
+#include "unotools/accessiblerelationsethelper.hxx"
+#include "vcl/window.hxx"
+#endif
diff --git a/accessibility/prj/build.lst b/accessibility/prj/build.lst
new file mode 100755
index 000000000000..c9a8c345e056
--- /dev/null
+++ b/accessibility/prj/build.lst
@@ -0,0 +1,18 @@
+ac accessibility : L10N:l10n tools jurt offuh unoil vcl javaunohelper jvmaccess cppu sal toolkit svtools LIBXSLT:libxslt NULL
+ac accessibility usr1 - all ac_mkout NULL
+ac accessibility\inc nmake - all ac_inc NULL
+ac accessibility\bridge\org\openoffice\java\accessibility nmake - w ac_ooja ac_inc NULL
+ac accessibility\bridge\org\openoffice\accessibility nmake - w ac_ooa ac_ooja.w ac_inc NULL
+ac accessibility\bridge\source\java nmake - w ac_ooan ac_ooa.w ac_inc NULL
+ac accessibility\inc get - all ac_inc NULL
+ac accessibility\source\helper nmake - all ac_helper ac_inc NULL
+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
+# dependency on ac_awb_misc to avoid concurrent creation of java_ver.mk
+ac accessibility\workben\org\openoffice\accessibility\awb\view\text nmake - all ac_awb_view_text ac_awb_misc NULL
diff --git a/accessibility/prj/d.lst b/accessibility/prj/d.lst
new file mode 100644
index 000000000000..662373c7c487
--- /dev/null
+++ b/accessibility/prj/d.lst
@@ -0,0 +1,8 @@
+..\%__SRC%\class\java_uno_accessbridge.jar %_DEST%\bin%_EXT%\java_uno_accessbridge.jar
+..\%__SRC%\class\java_accessibility.jar %_DEST%\bin%_EXT%\java_accessibility.jar
+
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\misc\java_uno_accessbridge.component %_DEST%\xml\java_uno_accessbridge.component
diff --git a/accessibility/prj/l10n b/accessibility/prj/l10n
new file mode 100644
index 000000000000..69f0d9e5e24e
--- /dev/null
+++ b/accessibility/prj/l10n
@@ -0,0 +1 @@
+#i49922# In this module en-US and de are used as source language
diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx
new file mode 100644
index 000000000000..677c15513d7a
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBox.cxx
@@ -0,0 +1,401 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include "accessibility/extended/AccessibleBrowseBox.hxx"
+#include "accessibility/extended/AccessibleBrowseBoxTable.hxx"
+#include "accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx"
+#include <svtools/accessibletableprovider.hxx>
+#include <comphelper/types.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+// ============================================================================
+
+namespace accessibility
+{
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+
+// ============================================================================
+class AccessibleBrowseBoxImpl
+{
+public:
+ /// the XAccessible which created the AccessibleBrowseBox
+ WeakReference< XAccessible > m_aCreator;
+
+ /** The data table child. */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > mxTable;
+ AccessibleBrowseBoxTable* m_pTable;
+
+ /** The header bar for rows ("handle column"). */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > mxRowHeaderBar;
+ AccessibleBrowseBoxHeaderBar* m_pRowHeaderBar;
+
+ /** The header bar for columns (first row of the table). */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > mxColumnHeaderBar;
+ AccessibleBrowseBoxHeaderBar* m_pColumnHeaderBar;
+};
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleBrowseBox )
+
+AccessibleBrowseBox::AccessibleBrowseBox(
+ const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxCreator,
+ IAccessibleTableProvider& _rBrowseBox )
+ : AccessibleBrowseBoxBase( _rxParent, _rBrowseBox,NULL, BBTYPE_BROWSEBOX )
+{
+ DBG_CTOR( AccessibleBrowseBox, NULL );
+ m_pImpl.reset( new AccessibleBrowseBoxImpl() );
+ m_pImpl->m_aCreator = _rxCreator;
+
+ m_xFocusWindow = VCLUnoHelper::GetInterface(mpBrowseBox->GetWindowInstance());
+}
+// -----------------------------------------------------------------------------
+void AccessibleBrowseBox::setCreator( const Reference< XAccessible >& _rxCreator )
+{
+#if OSL_DEBUG_LEVEL > 0
+ Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator;
+ DBG_ASSERT( !xCreator.is(), "accessibility/extended/AccessibleBrowseBox::setCreator: creator already set!" );
+#endif
+ m_pImpl->m_aCreator = _rxCreator;
+}
+
+// -----------------------------------------------------------------------------
+AccessibleBrowseBox::~AccessibleBrowseBox()
+{
+ DBG_DTOR( AccessibleBrowseBox, NULL );
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleBrowseBox::disposing()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ m_pImpl->m_pTable = NULL;
+ m_pImpl->m_pColumnHeaderBar = NULL;
+ m_pImpl->m_pRowHeaderBar = NULL;
+ m_pImpl->m_aCreator = Reference< XAccessible >();
+
+ Reference< XAccessible > xTable = m_pImpl->mxTable;
+
+ Reference< XComponent > xComp( m_pImpl->mxTable, UNO_QUERY );
+ if ( xComp.is() )
+ {
+ xComp->dispose();
+
+ }
+//! ::comphelper::disposeComponent(m_pImpl->mxTable);
+ ::comphelper::disposeComponent(m_pImpl->mxRowHeaderBar);
+ ::comphelper::disposeComponent(m_pImpl->mxColumnHeaderBar);
+
+ AccessibleBrowseBoxBase::disposing();
+}
+// -----------------------------------------------------------------------------
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleBrowseBox::getAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return BBINDEX_FIRSTCONTROL + mpBrowseBox->GetAccessibleControlCount();
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleBrowseBox::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Reference< XAccessible > xRet;
+ if( nChildIndex >= 0 )
+ {
+ if( nChildIndex < BBINDEX_FIRSTCONTROL )
+ xRet = implGetFixedChild( nChildIndex );
+ else
+ {
+ // additional controls
+ nChildIndex -= BBINDEX_FIRSTCONTROL;
+ if( nChildIndex < mpBrowseBox->GetAccessibleControlCount() )
+ xRet = mpBrowseBox->CreateAccessibleControl( nChildIndex );
+ }
+ }
+
+ if( !xRet.is() )
+ throw lang::IndexOutOfBoundsException();
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+
+//sal_Int16 SAL_CALL AccessibleBrowseBox::getAccessibleRole()
+// throw ( uno::RuntimeException )
+//{
+// ensureIsAlive();
+// return AccessibleRole::PANEL;
+//}
+// -----------------------------------------------------------------------------
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleBrowseBox::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 nIndex = 0;
+ if( mpBrowseBox->ConvertPointToControlIndex( nIndex, VCLPoint( rPoint ) ) )
+ xChild = mpBrowseBox->CreateAccessibleControl( nIndex );
+ else
+ {
+ // try whether point is in one of the fixed children
+ // (table, header bars, corner control)
+ Point aPoint( VCLPoint( rPoint ) );
+ for( nIndex = 0; (nIndex < BBINDEX_FIRSTCONTROL) && !xChild.is(); ++nIndex )
+ {
+ Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) );
+ Reference< XAccessibleComponent >
+ xCurrChildComp( xCurrChild, uno::UNO_QUERY );
+
+ if( xCurrChildComp.is() &&
+ VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) )
+ xChild = xCurrChild;
+ }
+ }
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleBrowseBox::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ mpBrowseBox->GrabFocus();
+}
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL AccessibleBrowseBox::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any();
+}
+// -----------------------------------------------------------------------------
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleBrowseBox::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBox" ) );
+}
+// -----------------------------------------------------------------------------
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleBrowseBox::implGetBoundingBox()
+{
+ Window* pParent = mpBrowseBox->GetAccessibleParentWindow();
+ DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
+ return mpBrowseBox->GetWindowExtentsRelative( pParent );
+}
+// -----------------------------------------------------------------------------
+
+Rectangle AccessibleBrowseBox::implGetBoundingBoxOnScreen()
+{
+ return mpBrowseBox->GetWindowExtentsRelative( NULL );
+}
+// -----------------------------------------------------------------------------
+
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessible > AccessibleBrowseBox::implGetTable()
+{
+ if( !m_pImpl->mxTable.is() )
+ {
+ m_pImpl->m_pTable = createAccessibleTable();
+ m_pImpl->mxTable = m_pImpl->m_pTable;
+
+ }
+ return m_pImpl->mxTable;
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible >
+AccessibleBrowseBox::implGetHeaderBar( AccessibleBrowseBoxObjType eObjType )
+{
+ Reference< XAccessible > xRet;
+ Reference< XAccessible >* pxMember = NULL;
+
+ if( eObjType == BBTYPE_ROWHEADERBAR )
+ pxMember = &m_pImpl->mxRowHeaderBar;
+ else if( eObjType == BBTYPE_COLUMNHEADERBAR )
+ pxMember = &m_pImpl->mxColumnHeaderBar;
+
+ if( pxMember )
+ {
+ if( !pxMember->is() )
+ {
+ AccessibleBrowseBoxHeaderBar* pHeaderBar = new AccessibleBrowseBoxHeaderBar(
+ (Reference< XAccessible >)m_pImpl->m_aCreator, *mpBrowseBox, eObjType );
+
+ if ( BBTYPE_COLUMNHEADERBAR == eObjType)
+ m_pImpl->m_pColumnHeaderBar = pHeaderBar;
+ else
+ m_pImpl->m_pRowHeaderBar = pHeaderBar;
+
+ *pxMember = pHeaderBar;
+ }
+ xRet = *pxMember;
+ }
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible >
+AccessibleBrowseBox::implGetFixedChild( sal_Int32 nChildIndex )
+{
+ Reference< XAccessible > xRet;
+ switch( nChildIndex )
+ {
+ case BBINDEX_COLUMNHEADERBAR:
+ xRet = implGetHeaderBar( BBTYPE_COLUMNHEADERBAR );
+ break;
+ case BBINDEX_ROWHEADERBAR:
+ xRet = implGetHeaderBar( BBTYPE_ROWHEADERBAR );
+ break;
+ case BBINDEX_TABLE:
+ xRet = implGetTable();
+ break;
+ }
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+AccessibleBrowseBoxTable* AccessibleBrowseBox::createAccessibleTable()
+{
+ Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator;
+ DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleBrowseBox::createAccessibleTable: my creator died - how this?" );
+ return new AccessibleBrowseBoxTable( xCreator, *mpBrowseBox );
+}
+// -----------------------------------------------------------------------------
+void AccessibleBrowseBox::commitTableEvent(sal_Int16 _nEventId,const Any& _rNewValue,const Any& _rOldValue)
+{
+ if ( m_pImpl->mxTable.is() )
+ {
+ m_pImpl->m_pTable->commitEvent(_nEventId,_rNewValue,_rOldValue);
+ }
+}
+// -----------------------------------------------------------------------------
+void AccessibleBrowseBox::commitHeaderBarEvent( sal_Int16 _nEventId,
+ const Any& _rNewValue,
+ const Any& _rOldValue,sal_Bool _bColumnHeaderBar)
+{
+ Reference< XAccessible > xHeaderBar = _bColumnHeaderBar ? m_pImpl->mxColumnHeaderBar : m_pImpl->mxRowHeaderBar;
+ AccessibleBrowseBoxHeaderBar* pHeaderBar = _bColumnHeaderBar ? m_pImpl->m_pColumnHeaderBar : m_pImpl->m_pRowHeaderBar;
+ if ( xHeaderBar.is() )
+ pHeaderBar->commitEvent(_nEventId,_rNewValue,_rOldValue);
+}
+
+// ============================================================================
+// = AccessibleBrowseBoxAccess
+// ============================================================================
+DBG_NAME( AccessibleBrowseBoxAccess )
+// -----------------------------------------------------------------------------
+AccessibleBrowseBoxAccess::AccessibleBrowseBoxAccess( const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox )
+ :m_xParent( _rxParent )
+ ,m_rBrowseBox( _rBrowseBox )
+ ,m_pContext( NULL )
+{
+ DBG_CTOR( AccessibleBrowseBoxAccess, NULL );
+}
+
+// -----------------------------------------------------------------------------
+AccessibleBrowseBoxAccess::~AccessibleBrowseBoxAccess()
+{
+ DBG_DTOR( AccessibleBrowseBoxAccess, NULL );
+}
+
+// -----------------------------------------------------------------------------
+void AccessibleBrowseBoxAccess::dispose()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_pContext = NULL;
+ ::comphelper::disposeComponent( m_xContext );
+}
+
+// -----------------------------------------------------------------------------
+Reference< XAccessibleContext > SAL_CALL AccessibleBrowseBoxAccess::getAccessibleContext() throw ( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ DBG_ASSERT( ( m_pContext && m_xContext.is() ) || ( !m_pContext && !m_xContext.is() ),
+ "accessibility/extended/AccessibleBrowseBoxAccess::getAccessibleContext: inconsistency!" );
+
+ // if the context died meanwhile (we're no listener, so it won't tell us explicitily when this happens),
+ // then reset an re-create.
+ if ( m_pContext && !m_pContext->isAlive() )
+ m_xContext = m_pContext = NULL;
+
+ if ( !m_xContext.is() )
+ m_xContext = m_pContext = new AccessibleBrowseBox( m_xParent, this, m_rBrowseBox );
+
+ return m_xContext;
+}
+
+// -----------------------------------------------------------------------------
+bool AccessibleBrowseBoxAccess::isContextAlive() const
+{
+ return ( NULL != m_pContext ) && m_pContext->isAlive();
+}
+
+// ============================================================================
+
+} // namespace accessibility
diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
new file mode 100644
index 000000000000..f8b43ecdced2
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
@@ -0,0 +1,658 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include "accessibility/extended/AccessibleBrowseBoxBase.hxx"
+#include <svtools/accessibletableprovider.hxx>
+#include <rtl/uuid.h>
+//
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblerelationsethelper.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+using namespace ::svt;
+
+
+// ============================================================================
+
+namespace accessibility {
+
+using namespace com::sun::star::accessibility::AccessibleStateType;
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleBrowseBoxBase )
+
+AccessibleBrowseBoxBase::AccessibleBrowseBoxBase(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTableProvider& rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ AccessibleBrowseBoxObjType eObjType ) :
+ AccessibleBrowseBoxImplHelper( m_aMutex ),
+ mxParent( rxParent ),
+ mpBrowseBox( &rBrowseBox ),
+ m_xFocusWindow(_xFocusWindow),
+ maName( rBrowseBox.GetAccessibleObjectName( eObjType ) ),
+ maDescription( rBrowseBox.GetAccessibleObjectDescription( eObjType ) ),
+ meObjType( eObjType ),
+ m_aClientId(0)
+{
+ DBG_CTOR( AccessibleBrowseBoxBase, NULL );
+ if ( m_xFocusWindow.is() )
+ m_xFocusWindow->addFocusListener( this );
+}
+
+AccessibleBrowseBoxBase::AccessibleBrowseBoxBase(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTableProvider& rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ AccessibleBrowseBoxObjType eObjType,
+ const ::rtl::OUString& rName,
+ const ::rtl::OUString& rDescription ) :
+ AccessibleBrowseBoxImplHelper( m_aMutex ),
+ mxParent( rxParent ),
+ mpBrowseBox( &rBrowseBox ),
+ m_xFocusWindow(_xFocusWindow),
+ maName( rName ),
+ maDescription( rDescription ),
+ meObjType( eObjType ),
+ m_aClientId(0)
+{
+ DBG_CTOR( AccessibleBrowseBoxBase, NULL );
+ if ( m_xFocusWindow.is() )
+ m_xFocusWindow->addFocusListener( this );
+}
+
+AccessibleBrowseBoxBase::~AccessibleBrowseBoxBase()
+{
+ DBG_DTOR( AccessibleBrowseBoxBase, NULL );
+
+ if( isAlive() )
+ {
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+}
+
+void SAL_CALL AccessibleBrowseBoxBase::disposing()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ if ( m_xFocusWindow.is() )
+ {
+ BBSolarGuard aSolarGuard;
+ m_xFocusWindow->removeFocusListener( this );
+ }
+
+ if ( getClientId( ) )
+ {
+ AccessibleEventNotifier::TClientId nId( getClientId( ) );
+ setClientId( 0 );
+ AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
+ }
+
+ mxParent = NULL;
+ mpBrowseBox = NULL;
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleParent()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return mxParent;
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ // -1 for child not found/no parent (according to specification)
+ sal_Int32 nRet = -1;
+
+ Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY );
+
+ // iterate over parent's children and search for this object
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleContext >
+ xParentContext( mxParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ {
+ Reference< uno::XInterface > xChild;
+
+ sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
+ for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild )
+ {
+ xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
+
+ if ( xMeMyselfAndI.get() == xChild.get() )
+ {
+ nRet = nChild;
+ break;
+ }
+ }
+ }
+ }
+ return nRet;
+}
+
+OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleDescription()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return maDescription;
+}
+
+OUString SAL_CALL AccessibleBrowseBoxBase::getAccessibleName()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return maName;
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL
+AccessibleBrowseBoxBase::getAccessibleRelationSet()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ // BrowseBox does not have relations.
+ return new utl::AccessibleRelationSetHelper;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL
+AccessibleBrowseBoxBase::getAccessibleStateSet()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ // don't check whether alive -> StateSet may contain DEFUNC
+ return implCreateStateSetHelper();
+}
+
+lang::Locale SAL_CALL AccessibleBrowseBoxBase::getLocale()
+ throw ( IllegalAccessibleComponentStateException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleContext >
+ xParentContext( mxParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ return xParentContext->getLocale();
+ }
+ throw IllegalAccessibleComponentStateException();
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleBrowseBoxBase::containsPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+}
+
+awt::Rectangle SAL_CALL AccessibleBrowseBoxBase::getBounds()
+ throw ( uno::RuntimeException )
+{
+ return AWTRectangle( getBoundingBox() );
+}
+
+awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocation()
+ throw ( uno::RuntimeException )
+{
+ return AWTPoint( getBoundingBox().TopLeft() );
+}
+
+awt::Point SAL_CALL AccessibleBrowseBoxBase::getLocationOnScreen()
+ throw ( uno::RuntimeException )
+{
+ return AWTPoint( getBoundingBoxOnScreen().TopLeft() );
+}
+
+awt::Size SAL_CALL AccessibleBrowseBoxBase::getSize()
+ throw ( uno::RuntimeException )
+{
+ return AWTSize( getBoundingBox().GetSize() );
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxBase::isShowing()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implIsShowing();
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxBase::isVisible()
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
+ return xStateSet.is() ?
+ xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False;
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxBase::isFocusTraversable()
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
+ return xStateSet.is() ?
+ xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False;
+}
+
+void SAL_CALL AccessibleBrowseBoxBase::focusGained( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ com::sun::star::uno::Any aFocused;
+ com::sun::star::uno::Any aEmpty;
+ aFocused <<= FOCUSED;
+
+ commitEvent(AccessibleEventId::STATE_CHANGED,aFocused,aEmpty);
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleBrowseBoxBase::focusLost( const ::com::sun::star::awt::FocusEvent& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ com::sun::star::uno::Any aFocused;
+ com::sun::star::uno::Any aEmpty;
+ aFocused <<= FOCUSED;
+
+ commitEvent(AccessibleEventId::STATE_CHANGED,aEmpty,aFocused);
+}
+// XAccessibleEventBroadcaster ------------------------------------------------
+
+void SAL_CALL AccessibleBrowseBoxBase::addEventListener(
+ const Reference< XAccessibleEventListener>& _rxListener )
+ throw ( uno::RuntimeException )
+{
+ if ( _rxListener.is() )
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ if ( !getClientId( ) )
+ setClientId( AccessibleEventNotifier::registerClient( ) );
+
+ AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener );
+ }
+}
+
+void SAL_CALL AccessibleBrowseBoxBase::removeEventListener(
+ const Reference< XAccessibleEventListener>& _rxListener )
+ throw ( uno::RuntimeException )
+{
+ if( _rxListener.is() && getClientId( ) )
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+
+ AccessibleEventNotifier::TClientId nId( getClientId( ) );
+ setClientId( 0 );
+ AccessibleEventNotifier::revokeClient( nId );
+ }
+ }
+}
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxBase::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleBrowseBoxBase::supportsService(
+ const OUString& rServiceName )
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
+ const OUString* pArrBegin = aSupportedServices.getConstArray();
+ const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength();
+ const OUString* pString = pArrBegin;
+
+ for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString )
+ ;
+
+ return pString != pArrEnd;
+}
+
+Sequence< OUString > SAL_CALL AccessibleBrowseBoxBase::getSupportedServiceNames()
+ throw ( uno::RuntimeException )
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
+ return Sequence< OUString >( &aServiceName, 1 );
+}
+
+// other public methods -------------------------------------------------------
+
+void AccessibleBrowseBoxBase::setAccessibleName( const OUString& rName )
+{
+ ::osl::ClearableMutexGuard aGuard( getOslMutex() );
+ Any aOld;
+ aOld <<= maName;
+ maName = rName;
+
+ aGuard.clear();
+
+ commitEvent(
+ AccessibleEventId::NAME_CHANGED,
+ uno::makeAny( maName ),
+ aOld );
+}
+
+void AccessibleBrowseBoxBase::setAccessibleDescription( const OUString& rDescription )
+{
+ ::osl::ClearableMutexGuard aGuard( getOslMutex() );
+ Any aOld;
+ aOld <<= maDescription;
+ maDescription = rDescription;
+
+ aGuard.clear();
+
+ commitEvent(
+ AccessibleEventId::DESCRIPTION_CHANGED,
+ uno::makeAny( maDescription ),
+ aOld );
+}
+
+// internal virtual methods ---------------------------------------------------
+
+sal_Bool AccessibleBrowseBoxBase::implIsShowing()
+{
+ sal_Bool bShowing = sal_False;
+ if( mxParent.is() )
+ {
+ Reference< XAccessibleComponent >
+ xParentComp( mxParent->getAccessibleContext(), uno::UNO_QUERY );
+ if( xParentComp.is() )
+ bShowing = implGetBoundingBox().IsOver(
+ VCLRectangle( xParentComp->getBounds() ) );
+ }
+ return bShowing;
+}
+
+::utl::AccessibleStateSetHelper* AccessibleBrowseBoxBase::implCreateStateSetHelper()
+{
+ ::utl::AccessibleStateSetHelper*
+ pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with mxParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ // BrowseBox fills StateSet with states depending on object type
+ mpBrowseBox->FillAccessibleStateSet( *pStateSetHelper, getType() );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+
+// internal helper methods ----------------------------------------------------
+
+sal_Bool AccessibleBrowseBoxBase::isAlive() const
+{
+ return !rBHelper.bDisposed && !rBHelper.bInDispose && mpBrowseBox;
+}
+
+void AccessibleBrowseBoxBase::ensureIsAlive() const
+ throw ( lang::DisposedException )
+{
+ if( !isAlive() )
+ throw lang::DisposedException();
+}
+
+Rectangle AccessibleBrowseBoxBase::getBoundingBox()
+ throw ( lang::DisposedException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Rectangle aRect = implGetBoundingBox();
+ if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
+ {
+ DBG_ERRORFILE( "shit" );
+ }
+ return aRect;
+}
+
+Rectangle AccessibleBrowseBoxBase::getBoundingBoxOnScreen()
+ throw ( lang::DisposedException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Rectangle aRect = implGetBoundingBoxOnScreen();
+ if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
+ {
+ DBG_ERRORFILE( "shit" );
+ }
+ return aRect;
+}
+
+void AccessibleBrowseBoxBase::commitEvent(
+ sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
+{
+ ::osl::ClearableMutexGuard aGuard( getOslMutex() );
+ if ( !getClientId( ) )
+ // if we don't have a client id for the notifier, then we don't have listeners, then
+ // we don't need to notify anything
+ return;
+
+ // build an event object
+ AccessibleEventObject aEvent;
+ aEvent.Source = *this;
+ aEvent.EventId = _nEventId;
+ aEvent.OldValue = _rOldValue;
+ aEvent.NewValue = _rNewValue;
+
+ // let the notifier handle this event
+
+ AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
+}
+// -----------------------------------------------------------------------------
+
+void AccessibleBrowseBoxBase::implCreateUuid( Sequence< sal_Int8 >& rId )
+{
+ if( !rId.hasElements() )
+ {
+ rId.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True );
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Int16 SAL_CALL AccessibleBrowseBoxBase::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ sal_Int16 nRole = AccessibleRole::UNKNOWN;
+ switch ( meObjType )
+ {
+ case BBTYPE_ROWHEADERCELL:
+ nRole = AccessibleRole::ROW_HEADER;
+ break;
+ case BBTYPE_COLUMNHEADERCELL:
+ nRole = AccessibleRole::COLUMN_HEADER;
+ break;
+ case BBTYPE_COLUMNHEADERBAR:
+ case BBTYPE_ROWHEADERBAR:
+ case BBTYPE_TABLE:
+ nRole = AccessibleRole::TABLE;
+ break;
+ case BBTYPE_TABLECELL:
+ nRole = AccessibleRole::TABLE_CELL;
+ break;
+ case BBTYPE_BROWSEBOX:
+ nRole = AccessibleRole::PANEL;
+ break;
+ case BBTYPE_CHECKBOXCELL:
+ nRole = AccessibleRole::CHECK_BOX;
+ break;
+ }
+ return nRole;
+}
+// -----------------------------------------------------------------------------
+Any SAL_CALL AccessibleBrowseBoxBase::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ return Any();
+}
+// -----------------------------------------------------------------------------
+Reference<XAccessible > SAL_CALL AccessibleBrowseBoxBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& )
+ throw ( uno::RuntimeException )
+{
+ return NULL;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL AccessibleBrowseBoxBase::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_xFocusWindow = NULL;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getForeground( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ sal_Int32 nColor = 0;
+ Window* pInst = mpBrowseBox->GetWindowInstance();
+ if ( pInst )
+ {
+ if ( pInst->IsControlForeground() )
+ nColor = pInst->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( pInst->IsControlFont() )
+ aFont = pInst->GetControlFont();
+ else
+ aFont = pInst->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
+ }
+
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleBrowseBoxBase::getBackground( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nColor = 0;
+ Window* pInst = mpBrowseBox->GetWindowInstance();
+ if ( pInst )
+ {
+ if ( pInst->IsControlBackground() )
+ nColor = pInst->GetControlBackground().GetColor();
+ else
+ nColor = pInst->GetBackground().GetColor().GetColor();
+ }
+
+ return nColor;
+}
+
+// ============================================================================
+DBG_NAME( BrowseBoxAccessibleElement )
+
+// XInterface -----------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base )
+
+// XTypeProvider --------------------------------------------------------------
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( BrowseBoxAccessibleElement, AccessibleBrowseBoxBase, BrowseBoxAccessibleElement_Base )
+
+// XAccessible ----------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL BrowseBoxAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return this;
+}
+
+// ----------------------------------------------------------------------------
+BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox,
+ const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType eObjType )
+ :AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType )
+{
+ DBG_CTOR( BrowseBoxAccessibleElement, NULL );
+}
+
+// ----------------------------------------------------------------------------
+BrowseBoxAccessibleElement::BrowseBoxAccessibleElement( const Reference< XAccessible >& rxParent, IAccessibleTableProvider& rBrowseBox,
+ const Reference< awt::XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType eObjType,
+ const ::rtl::OUString& rName, const ::rtl::OUString& rDescription )
+ :AccessibleBrowseBoxBase( rxParent, rBrowseBox, _xFocusWindow, eObjType, rName, rDescription )
+{
+ DBG_CTOR( BrowseBoxAccessibleElement, NULL );
+}
+
+// ----------------------------------------------------------------------------
+BrowseBoxAccessibleElement::~BrowseBoxAccessibleElement( )
+{
+ DBG_DTOR( BrowseBoxAccessibleElement, NULL );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx
new file mode 100644
index 000000000000..560878b544f3
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <svtools/accessibletableprovider.hxx>
+
+namespace accessibility
+{
+ using namespace com::sun::star::accessibility;
+ using namespace com::sun::star::uno;
+ using namespace com::sun::star::accessibility::AccessibleEventId;
+ using namespace ::svt;
+
+ AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference<XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos
+ ,const TriState& _eState,
+ sal_Bool _bEnabled,
+ sal_Bool _bIsTriState)
+ :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos, BBTYPE_CHECKBOXCELL)
+ ,m_eState(_eState)
+ ,m_bEnabled(_bEnabled)
+ ,m_bIsTriState(_bIsTriState)
+ {
+ }
+ // -----------------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE )
+ // -----------------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE )
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > SAL_CALL AccessibleCheckBoxCell::getAccessibleContext( ) throw (RuntimeException)
+ {
+ ensureIsAlive();
+ return this;
+ }
+ // -----------------------------------------------------------------------------
+ ::utl::AccessibleStateSetHelper* AccessibleCheckBoxCell::implCreateStateSetHelper()
+ {
+ ::utl::AccessibleStateSetHelper* pStateSetHelper =
+ AccessibleBrowseBoxCell::implCreateStateSetHelper();
+ if( isAlive() )
+ {
+ mpBrowseBox->FillAccessibleStateSetForCell(
+ *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) );
+ if ( m_eState == STATE_CHECK )
+ pStateSetHelper->AddState( AccessibleStateType::CHECKED );
+ }
+ return pStateSetHelper;
+ }
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ // XAccessibleValue
+ // -----------------------------------------------------------------------------
+
+ Any SAL_CALL AccessibleCheckBoxCell::getCurrentValue( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ sal_Int32 nValue = 0;
+ switch( m_eState )
+ {
+ case STATE_NOCHECK:
+ nValue = 0;
+ break;
+ case STATE_CHECK:
+ nValue = 1;
+ break;
+ case STATE_DONTKNOW:
+ nValue = 2;
+ break;
+ }
+ return makeAny(nValue);
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool SAL_CALL AccessibleCheckBoxCell::setCurrentValue( const Any& ) throw (RuntimeException)
+ {
+ return sal_False;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Any SAL_CALL AccessibleCheckBoxCell::getMaximumValue( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ Any aValue;
+
+ if ( m_bIsTriState )
+ aValue <<= (sal_Int32) 2;
+ else
+ aValue <<= (sal_Int32) 1;
+
+ return aValue;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Any SAL_CALL AccessibleCheckBoxCell::getMinimumValue( ) throw (RuntimeException)
+ {
+ Any aValue;
+ aValue <<= (sal_Int32) 0;
+
+ return aValue;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return 0;
+ }
+ // -----------------------------------------------------------------------------
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL AccessibleCheckBoxCell::getAccessibleChild( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleCheckBoxCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.TableCheckBoxCell" ) );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleCheckBoxCell::getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ return ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleCheckBoxCell::SetChecked( sal_Bool _bChecked )
+ {
+ m_eState = _bChecked ? STATE_CHECK : STATE_NOCHECK;
+ Any aOldValue, aNewValue;
+ if ( _bChecked )
+ aNewValue <<= AccessibleStateType::CHECKED;
+ else
+ aOldValue <<= AccessibleStateType::CHECKED;
+ commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue );
+ }
+}
+
diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
new file mode 100644
index 000000000000..43d016b86588
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderBar.cxx
@@ -0,0 +1,419 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx"
+#include <svtools/accessibletableprovider.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleBrowseBoxHeaderBar )
+
+AccessibleBrowseBoxHeaderBar::AccessibleBrowseBoxHeaderBar(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTableProvider& rBrowseBox,
+ AccessibleBrowseBoxObjType eObjType ) :
+ AccessibleBrowseBoxTableBase( rxParent, rBrowseBox,eObjType )
+{
+ DBG_CTOR( AccessibleBrowseBoxHeaderBar, NULL );
+
+ DBG_ASSERT( isRowBar() || isColumnBar(),
+ "accessibility/extended/AccessibleBrowseBoxHeaderBar - invalid object type" );
+}
+
+AccessibleBrowseBoxHeaderBar::~AccessibleBrowseBoxHeaderBar()
+{
+ DBG_DTOR( AccessibleBrowseBoxHeaderBar, NULL );
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleBrowseBoxHeaderBar::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidHeaderIndex( nChildIndex );
+ return implGetChild( nChildIndex, implToVCLColumnPos( nChildIndex ) );
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ return isRowBar() ? BBINDEX_ROWHEADERBAR : BBINDEX_COLUMNHEADERBAR;
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleBrowseBoxHeaderBar::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ sal_Int32 nRow = 0;
+ sal_uInt16 nColumnPos = 0;
+ sal_Bool bConverted = isRowBar() ?
+ mpBrowseBox->ConvertPointToRowHeader( nRow, VCLPoint( rPoint ) ) :
+ mpBrowseBox->ConvertPointToColumnHeader( nColumnPos, VCLPoint( rPoint ) );
+
+ return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
+}
+
+void SAL_CALL AccessibleBrowseBoxHeaderBar::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ // focus on header not supported
+}
+
+Any SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any(); // no special key bindings for header
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return OUString(); // no headers in headers
+}
+
+OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return OUString(); // no headers in headers
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleRowHeaders()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // no headers in headers
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleColumnHeaders()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // no headers in headers
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleRows()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Sequence< sal_Int32 > aSelSeq;
+ // row of column header bar not selectable
+ if( isRowBar() )
+ implGetSelectedRows( aSelSeq );
+ return aSelSeq;
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleColumns()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Sequence< sal_Int32 > aSelSeq;
+ // column of row header bar ("handle column") not selectable
+ if( isColumnBar() )
+ implGetSelectedColumns( aSelSeq );
+ return aSelSeq;
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return isRowBar() ? implIsRowSelected( nRow ) : sal_False;
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return isColumnBar() ? implIsColumnSelected( nColumn ) : sal_False;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBrowseBoxHeaderBar::getAccessibleCellAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return implGetChild( nRow, implToVCLColumnPos( nColumn ) );
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleSelected(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return isRowBar() ? implIsRowSelected( nRow ) : implIsColumnSelected( nColumn );
+}
+
+// XAccessibleSelection -------------------------------------------------------
+
+void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidHeaderIndex( nChildIndex );
+ if( isRowBar() )
+ implSelectRow( nChildIndex, sal_True );
+ else
+ implSelectColumn( implToVCLColumnPos( nChildIndex ), sal_True );
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxHeaderBar::isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ // using interface methods - no mutex
+ return isRowBar() ?
+ isAccessibleRowSelected( nChildIndex ) :
+ isAccessibleColumnSelected( nChildIndex );
+}
+
+void SAL_CALL AccessibleBrowseBoxHeaderBar::clearAccessibleSelection()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ mpBrowseBox->SetNoSelection();
+}
+
+void SAL_CALL AccessibleBrowseBoxHeaderBar::selectAllAccessibleChildren()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ // no multiselection of columns possible
+ if( isRowBar() )
+ mpBrowseBox->SelectAll();
+ else
+ implSelectColumn( implToVCLColumnPos( 0 ), sal_True );
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderBar::getSelectedAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return isRowBar() ? implGetSelectedRowCount() : implGetSelectedColumnCount();
+}
+
+Reference< XAccessible > SAL_CALL
+AccessibleBrowseBoxHeaderBar::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ // method may throw lang::IndexOutOfBoundsException
+ sal_Int32 nIndex = implGetChildIndexFromSelectedIndex( nSelectedChildIndex );
+ return implGetChild( nIndex, implToVCLColumnPos( nIndex ) );
+}
+
+void SAL_CALL AccessibleBrowseBoxHeaderBar::deselectAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ // method may throw lang::IndexOutOfBoundsException
+ if ( isAccessibleChildSelected(nSelectedChildIndex) )
+ {
+ if( isRowBar() )
+ implSelectRow( nSelectedChildIndex, sal_False );
+ else
+ implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), sal_False );
+ }
+}
+
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL AccessibleBrowseBoxHeaderBar::queryInterface( const uno::Type& rType )
+ throw ( uno::RuntimeException )
+{
+ Any aAny( AccessibleBrowseBoxTableBase::queryInterface( rType ) );
+ return aAny.hasValue() ?
+ aAny : AccessibleBrowseBoxHeaderBarImplHelper::queryInterface( rType );
+}
+
+void SAL_CALL AccessibleBrowseBoxHeaderBar::acquire() throw ()
+{
+ AccessibleBrowseBoxTableBase::acquire();
+}
+
+void SAL_CALL AccessibleBrowseBoxHeaderBar::release() throw ()
+{
+ AccessibleBrowseBoxTableBase::release();
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderBar" ) );
+}
+
+Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxHeaderBar::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBox()
+{
+ return mpBrowseBox->calcHeaderRect(isColumnBar(),sal_False);
+}
+
+Rectangle AccessibleBrowseBoxHeaderBar::implGetBoundingBoxOnScreen()
+{
+ return mpBrowseBox->calcHeaderRect(isColumnBar(),sal_True);
+}
+
+sal_Int32 AccessibleBrowseBoxHeaderBar::implGetRowCount() const
+{
+ // column header bar: only 1 row
+ return isRowBar() ? AccessibleBrowseBoxTableBase::implGetRowCount() : 1;
+}
+
+sal_Int32 AccessibleBrowseBoxHeaderBar::implGetColumnCount() const
+{
+ // row header bar ("handle column"): only 1 column
+ return isColumnBar() ? AccessibleBrowseBoxTableBase::implGetColumnCount() : 1;
+}
+
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessible > AccessibleBrowseBoxHeaderBar::implGetChild(
+ sal_Int32 nRow, sal_uInt16 nColumnPos )
+{
+ return isRowBar() ?
+ mpBrowseBox->CreateAccessibleRowHeader( nRow ) :
+ mpBrowseBox->CreateAccessibleColumnHeader( nColumnPos );
+}
+
+sal_Int32 AccessibleBrowseBoxHeaderBar::implGetChildIndexFromSelectedIndex(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ Sequence< sal_Int32 > aSelSeq;
+ if( isRowBar() )
+ implGetSelectedRows( aSelSeq );
+ else
+ implGetSelectedColumns( aSelSeq );
+
+ if( (nSelectedChildIndex < 0) || (nSelectedChildIndex >= aSelSeq.getLength()) )
+ throw lang::IndexOutOfBoundsException();
+
+ return aSelSeq[ nSelectedChildIndex ];
+}
+
+void AccessibleBrowseBoxHeaderBar::ensureIsValidHeaderIndex( sal_Int32 nIndex )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( isRowBar() )
+ ensureIsValidRow( nIndex );
+ else
+ ensureIsValidColumn( nIndex );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
new file mode 100644
index 000000000000..44d547f8fd5b
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx"
+#include <svtools/accessibletableprovider.hxx>
+#include "accessibility/extended/AccessibleBrowseBox.hxx"
+
+namespace accessibility
+{
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::uno;
+ using namespace ::svt;
+
+AccessibleBrowseBoxHeaderCell::AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId,
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTableProvider& rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ AccessibleBrowseBoxObjType eObjType)
+: BrowseBoxAccessibleElement(rxParent,
+ rBrowseBox,
+ _xFocusWindow,
+ eObjType,
+ rBrowseBox.GetAccessibleObjectName( eObjType ,_nColumnRowId),
+ rBrowseBox.GetAccessibleObjectDescription( eObjType ,_nColumnRowId))
+, m_nColumnRowId(_nColumnRowId)
+{
+}
+/** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+*/
+::utl::AccessibleStateSetHelper* AccessibleBrowseBoxHeaderCell::implCreateStateSetHelper()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ::utl::AccessibleStateSetHelper*
+ pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with mxParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ BBSolarGuard aSolarGuard;
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+
+ sal_Bool bSelected = isRowBarCell() ? mpBrowseBox->IsRowSelected(m_nColumnRowId) : mpBrowseBox->IsColumnSelected(m_nColumnRowId);
+ if ( bSelected )
+ pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+// -----------------------------------------------------------------------------
+/** @return
+ The count of visible children.
+*/
+sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleChildCount()
+ throw ( RuntimeException )
+{
+ return 0;
+}
+// -----------------------------------------------------------------------------
+
+/** @return
+ The XAccessible interface of the specified child.
+*/
+Reference<XAccessible > SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleChild( sal_Int32 )
+ throw ( IndexOutOfBoundsException,RuntimeException )
+{
+ throw IndexOutOfBoundsException();
+}
+// -----------------------------------------------------------------------------
+
+/** Grabs the focus to the column header. */
+void SAL_CALL AccessibleBrowseBoxHeaderCell::grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ if ( isRowBarCell() )
+ mpBrowseBox->SelectRow(m_nColumnRowId);
+ else
+ mpBrowseBox->SelectColumn(static_cast<sal_uInt16>(m_nColumnRowId)); //!!!
+}
+// -----------------------------------------------------------------------------
+/** @return
+ The name of this class.
+*/
+::rtl::OUString SAL_CALL AccessibleBrowseBoxHeaderCell::getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException )
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxHeaderCell" ) );
+}
+// -----------------------------------------------------------------------------
+namespace
+{
+ Rectangle getRectangle(IAccessibleTableProvider* _pBrowseBox,sal_Int32 _nRowColIndex, sal_Bool _bOnScreen,sal_Bool _bRowBar)
+ {
+ sal_Int32 nRow = 0;
+ sal_uInt16 nCol = (sal_uInt16)_nRowColIndex;
+ if ( _bRowBar )
+ {
+ nRow = _nRowColIndex + 1;
+ nCol = 0;
+ }
+
+ Rectangle aRet(_pBrowseBox->GetFieldRectPixelAbs( nRow , nCol, sal_True, _bOnScreen));
+ return Rectangle(aRet.TopLeft() - Point(0,aRet.GetHeight()),aRet.GetSize());
+ }
+}
+
+Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBox()
+{
+ return getRectangle(mpBrowseBox,m_nColumnRowId,sal_False,isRowBarCell());
+}
+// -----------------------------------------------------------------------------
+
+Rectangle AccessibleBrowseBoxHeaderCell::implGetBoundingBoxOnScreen()
+{
+ return getRectangle(mpBrowseBox,m_nColumnRowId,sal_True,isRowBarCell());
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleIndexInParent()
+ throw ( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nIndex = m_nColumnRowId;
+ if ( mpBrowseBox->HasRowHeader() )
+ --nIndex;
+ return nIndex;
+}
+// -----------------------------------------------------------------------------
+} // namespace accessibility
+// -----------------------------------------------------------------------------
+
+
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTable.cxx b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx
new file mode 100644
index 000000000000..1ac635ec6230
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBoxTable.cxx
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleBrowseBoxTable.hxx"
+#include <svtools/accessibletableprovider.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleBrowseBoxTable )
+
+AccessibleBrowseBoxTable::AccessibleBrowseBoxTable(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTableProvider& rBrowseBox ) :
+ AccessibleBrowseBoxTableBase( rxParent, rBrowseBox, BBTYPE_TABLE )
+{
+ DBG_CTOR( AccessibleBrowseBoxTable, NULL );
+}
+
+AccessibleBrowseBoxTable::~AccessibleBrowseBoxTable()
+{
+ DBG_DTOR( AccessibleBrowseBoxTable, NULL );
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleBrowseBoxTable::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return mpBrowseBox->CreateAccessibleCell(
+ implGetRow( nChildIndex ), (sal_Int16)implGetColumn( nChildIndex ) );
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTable::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return BBINDEX_TABLE;
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleBrowseBoxTable::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 nRow = 0;
+ sal_uInt16 nColumnPos = 0;
+ if( mpBrowseBox->ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) )
+ xChild = mpBrowseBox->CreateAccessibleCell( nRow, nColumnPos );
+
+ return xChild;
+}
+
+void SAL_CALL AccessibleBrowseBoxTable::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ mpBrowseBox->GrabTableFocus();
+}
+
+Any SAL_CALL AccessibleBrowseBoxTable::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any(); // no special key bindings for data table
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return mpBrowseBox->GetRowDescription( nRow );
+}
+
+OUString SAL_CALL AccessibleBrowseBoxTable::getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return mpBrowseBox->GetColumnDescription( (sal_uInt16)nColumn );
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxTable::getAccessibleRowHeaders()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implGetHeaderBar( BBINDEX_ROWHEADERBAR );
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleBrowseBoxTable::getAccessibleColumnHeaders()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implGetHeaderBar( BBINDEX_COLUMNHEADERBAR );
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleRows()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Sequence< sal_Int32 > aSelSeq;
+ implGetSelectedRows( aSelSeq );
+ return aSelSeq;
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleBrowseBoxTable::getSelectedAccessibleColumns()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Sequence< sal_Int32 > aSelSeq;
+ implGetSelectedColumns( aSelSeq );
+ return aSelSeq;
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return implIsRowSelected( nRow );
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return implIsColumnSelected( nColumn );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTable::getAccessibleCellAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return mpBrowseBox->CreateAccessibleCell( nRow, (sal_Int16)nColumn );
+}
+
+sal_Bool SAL_CALL AccessibleBrowseBoxTable::isAccessibleSelected(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleBrowseBoxTable::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxTable" ) );
+}
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleBrowseBoxTable::implGetBoundingBox()
+{
+ return mpBrowseBox->calcTableRect(sal_False);
+}
+
+Rectangle AccessibleBrowseBoxTable::implGetBoundingBoxOnScreen()
+{
+ return mpBrowseBox->calcTableRect();
+}
+
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessibleTable > AccessibleBrowseBoxTable::implGetHeaderBar(
+ sal_Int32 nChildIndex )
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessible > xRet;
+ Reference< XAccessibleContext > xContext( mxParent, uno::UNO_QUERY );
+ if( xContext.is() )
+ {
+ try
+ {
+ xRet = xContext->getAccessibleChild( nChildIndex );
+ }
+ catch( lang::IndexOutOfBoundsException& )
+ {
+ DBG_ERROR( "implGetHeaderBar - wrong child index" );
+ }
+ // RuntimeException goes to caller
+ }
+ return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
new file mode 100644
index 000000000000..7a7aed644f5c
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBoxTableBase.cxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleBrowseBoxTableBase.hxx"
+#include <svtools/accessibletableprovider.hxx>
+#include <tools/multisel.hxx>
+#include <comphelper/sequence.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+// Ctor/Dtor/disposing --------------------------------------------------------
+
+DBG_NAME( AccessibleBrowseBoxTableBase )
+
+AccessibleBrowseBoxTableBase::AccessibleBrowseBoxTableBase(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTableProvider& rBrowseBox,
+ AccessibleBrowseBoxObjType eObjType ) :
+ BrowseBoxAccessibleElement( rxParent, rBrowseBox,NULL, eObjType )
+{
+ DBG_CTOR( AccessibleBrowseBoxTableBase, NULL );
+}
+
+AccessibleBrowseBoxTableBase::~AccessibleBrowseBoxTableBase()
+{
+ DBG_DTOR( AccessibleBrowseBoxTableBase, NULL );
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implGetChildCount();
+}
+
+sal_Int16 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return AccessibleRole::TABLE;
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRowCount()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implGetRowCount();
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumnCount()
+ throw ( uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implGetColumnCount();
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRowExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return 1; // merged cells not supported
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumnExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return 1; // merged cells not supported
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleCaption()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // not supported
+}
+
+Reference< XAccessible > SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleSummary()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // not supported
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleIndex(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return implGetChildIndex( nRow, nColumn );
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleRow( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return implGetRow( nChildIndex );
+}
+
+sal_Int32 SAL_CALL AccessibleBrowseBoxTableBase::getAccessibleColumn( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return implGetColumn( nChildIndex );
+}
+
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL AccessibleBrowseBoxTableBase::queryInterface( const uno::Type& rType )
+ throw ( uno::RuntimeException )
+{
+ Any aAny( BrowseBoxAccessibleElement::queryInterface( rType ) );
+ return aAny.hasValue() ?
+ aAny : AccessibleBrowseBoxTableImplHelper::queryInterface( rType );
+}
+
+void SAL_CALL AccessibleBrowseBoxTableBase::acquire() throw ()
+{
+ BrowseBoxAccessibleElement::acquire();
+}
+
+void SAL_CALL AccessibleBrowseBoxTableBase::release() throw ()
+{
+ BrowseBoxAccessibleElement::release();
+}
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< uno::Type > SAL_CALL AccessibleBrowseBoxTableBase::getTypes()
+ throw ( uno::RuntimeException )
+{
+ return ::comphelper::concatSequences(
+ BrowseBoxAccessibleElement::getTypes(),
+ AccessibleBrowseBoxTableImplHelper::getTypes() );
+}
+
+Sequence< sal_Int8 > SAL_CALL AccessibleBrowseBoxTableBase::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// internal virtual methods ---------------------------------------------------
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetRowCount() const
+{
+ return mpBrowseBox->GetRowCount();
+}
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetColumnCount() const
+{
+ sal_uInt16 nColumns = mpBrowseBox->GetColumnCount();
+ // do not count the "handle column"
+ if( nColumns && implHasHandleColumn() )
+ --nColumns;
+ return nColumns;
+}
+
+// internal helper methods ----------------------------------------------------
+
+sal_Bool AccessibleBrowseBoxTableBase::implHasHandleColumn() const
+{
+ return mpBrowseBox->HasRowHeader();
+}
+
+sal_uInt16 AccessibleBrowseBoxTableBase::implToVCLColumnPos( sal_Int32 nColumn ) const
+{
+ sal_uInt16 nVCLPos = 0;
+ if( (0 <= nColumn) && (nColumn < implGetColumnCount()) )
+ {
+ // regard "handle column"
+ if( implHasHandleColumn() )
+ ++nColumn;
+ nVCLPos = static_cast< sal_uInt16 >( nColumn );
+ }
+ return nVCLPos;
+}
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetChildCount() const
+{
+ return implGetRowCount() * implGetColumnCount();
+}
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetRow( sal_Int32 nChildIndex ) const
+{
+ sal_Int32 nColumns = implGetColumnCount();
+ return nColumns ? (nChildIndex / nColumns) : 0;
+}
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetColumn( sal_Int32 nChildIndex ) const
+{
+ sal_Int32 nColumns = implGetColumnCount();
+ return nColumns ? (nChildIndex % nColumns) : 0;
+}
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetChildIndex(
+ sal_Int32 nRow, sal_Int32 nColumn ) const
+{
+ return nRow * implGetColumnCount() + nColumn;
+}
+
+sal_Bool AccessibleBrowseBoxTableBase::implIsRowSelected( sal_Int32 nRow ) const
+{
+ return mpBrowseBox->IsRowSelected( nRow );
+}
+
+sal_Bool AccessibleBrowseBoxTableBase::implIsColumnSelected( sal_Int32 nColumn ) const
+{
+ if( implHasHandleColumn() )
+ --nColumn;
+ return mpBrowseBox->IsColumnSelected( nColumn );
+}
+
+void AccessibleBrowseBoxTableBase::implSelectRow( sal_Int32 nRow, sal_Bool bSelect )
+{
+ mpBrowseBox->SelectRow( nRow, bSelect, sal_True );
+}
+
+void AccessibleBrowseBoxTableBase::implSelectColumn( sal_Int32 nColumnPos, sal_Bool bSelect )
+{
+ mpBrowseBox->SelectColumn( (sal_uInt16)nColumnPos, bSelect );
+}
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetSelectedRowCount() const
+{
+ return mpBrowseBox->GetSelectedRowCount();
+}
+
+sal_Int32 AccessibleBrowseBoxTableBase::implGetSelectedColumnCount() const
+{
+ return mpBrowseBox->GetSelectedColumnCount();
+}
+
+void AccessibleBrowseBoxTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq )
+{
+ mpBrowseBox->GetAllSelectedRows( rSeq );
+}
+
+void AccessibleBrowseBoxTableBase::implGetSelectedColumns( Sequence< sal_Int32 >& rSeq )
+{
+ mpBrowseBox->GetAllSelectedColumns( rSeq );
+}
+
+void AccessibleBrowseBoxTableBase::ensureIsValidRow( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nRow >= implGetRowCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this );
+}
+
+void AccessibleBrowseBoxTableBase::ensureIsValidColumn( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nColumn >= implGetColumnCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this );
+}
+
+void AccessibleBrowseBoxTableBase::ensureIsValidAddress(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ ensureIsValidRow( nRow );
+ ensureIsValidColumn( nColumn );
+}
+
+void AccessibleBrowseBoxTableBase::ensureIsValidIndex( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nChildIndex >= implGetChildCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
new file mode 100644
index 000000000000..a7392ff46e4a
--- /dev/null
+++ b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
@@ -0,0 +1,354 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx"
+#include <svtools/accessibletableprovider.hxx>
+#include "accessibility/extended/AccessibleBrowseBox.hxx"
+#include <tools/gen.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+namespace accessibility
+{
+ namespace
+ {
+ void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ {
+ if ( _nIndex >= _sText.getLength() )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount )
+ {
+ return _nRow * _nColumnCount + _nColumn;
+ }
+ }
+ using namespace ::com::sun::star::lang;
+ using namespace utl;
+ using namespace comphelper;
+ using ::rtl::OUString;
+ using ::accessibility::AccessibleBrowseBox;
+ using namespace ::com::sun::star::uno;
+ using ::com::sun::star::accessibility::XAccessible;
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::svt;
+
+
+ // implementation of a table cell
+ ::rtl::OUString AccessibleBrowseBoxTableCell::implGetText()
+ {
+ ensureIsAlive();
+ return mpBrowseBox->GetAccessibleCellText( getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) );
+ }
+
+ ::com::sun::star::lang::Locale AccessibleBrowseBoxTableCell::implGetLocale()
+ {
+ ensureIsAlive();
+ return mpBrowseBox->GetAccessible()->getAccessibleContext()->getLocale();
+ }
+
+ void AccessibleBrowseBoxTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+ {
+ nStartIndex = 0;
+ nEndIndex = 0;
+ }
+
+ AccessibleBrowseBoxTableCell::AccessibleBrowseBoxTableCell(const Reference<XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ sal_Int32 _nOffset )
+ :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos )
+ {
+ m_nOffset = ( OFFSET_DEFAULT == _nOffset ) ? (sal_Int32)BBINDEX_FIRSTCONTROL : _nOffset;
+ sal_Int32 nIndex = getIndex_Impl( _nRowPos, _nColPos, _rBrowseBox.GetColumnCount() );
+ setAccessibleName( _rBrowseBox.GetAccessibleObjectName( BBTYPE_TABLECELL, nIndex ) );
+ setAccessibleDescription( _rBrowseBox.GetAccessibleObjectDescription( BBTYPE_TABLECELL, nIndex ) );
+ // Need to register as event listener
+ Reference< XComponent > xComponent(_rxParent, UNO_QUERY);
+ if( xComponent.is() )
+ xComponent->addEventListener(static_cast< XEventListener *> (this));
+ }
+
+ void AccessibleBrowseBoxTableCell::nameChanged( const ::rtl::OUString& rNewName, const ::rtl::OUString& rOldName )
+ {
+ implSetName( rNewName );
+ Any aOldValue, aNewValue;
+ aOldValue <<= rOldName;
+ aNewValue <<= rNewName;
+ commitEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
+ }
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL AccessibleBrowseBoxTableCell::queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ Any aRet = AccessibleBrowseBoxCell::queryInterface(rType);
+ if ( !aRet.hasValue() )
+ aRet = AccessibleTextHelper_BASE::queryInterface(rType);
+ return aRet;
+ }
+
+ /** Aquires the object (calls acquire() on base class). */
+ void SAL_CALL AccessibleBrowseBoxTableCell::acquire() throw ()
+ {
+ AccessibleBrowseBoxCell::acquire();
+ }
+
+ /** Releases the object (calls release() on base class). */
+ void SAL_CALL AccessibleBrowseBoxTableCell::release() throw ()
+ {
+ AccessibleBrowseBoxCell::release();
+ }
+
+ ::com::sun::star::awt::Rectangle SAL_CALL AccessibleBrowseBoxTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ ::com::sun::star::awt::Rectangle aRect;
+
+ if ( mpBrowseBox )
+ {
+ aRect = AWTRectangle( mpBrowseBox->GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) );
+ }
+
+ return aRect;
+ }
+
+ sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException)
+ {
+ //! TODO CTL bidi
+ // DBG_ASSERT(0,"Need to be done by base class!");
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ return mpBrowseBox->GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) );
+ }
+
+ /** @return
+ The name of this class.
+ */
+ ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.AccessibleBrowseBoxTableCell" ) );
+ }
+
+ /** @return The count of visible children. */
+ sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return 0;
+ }
+
+ /** @return The XAccessible interface of the specified child. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ AccessibleBrowseBoxTableCell::getAccessibleChild( sal_Int32 )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException )
+ {
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+ */
+ ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxTableCell::implCreateStateSetHelper()
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with mxParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ mpBrowseBox->FillAccessibleStateSetForCell( *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+ }
+
+
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ Reference< XAccessibleContext > SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleContext() throw ( RuntimeException )
+ {
+ ensureIsAlive();
+ return this;
+ }
+
+ // XAccessibleContext -----------------------------------------------------
+
+ sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ return /*BBINDEX_FIRSTCONTROL*/ m_nOffset + ( getRowPos() * mpBrowseBox->GetColumnCount() ) + getColumnPos();
+ }
+
+ sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return -1;
+ }
+ sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ sal_Unicode SAL_CALL AccessibleBrowseBoxTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getCharacter( nIndex );
+ }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleBrowseBoxTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >();
+ }
+ sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getCharacterCount( );
+ }
+
+ ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectedText( );
+ }
+ sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectionStart( );
+ }
+ sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectionEnd( );
+ }
+ sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getText( );
+ }
+ ::rtl::OUString SAL_CALL AccessibleBrowseBoxTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
+ }
+ sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ BBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ::rtl::OUString sText = implGetText();
+ checkIndex_Impl( nStartIndex, sText );
+ checkIndex_Impl( nEndIndex, sText );
+
+ //!!! don't know how to put a string into the clipboard
+ return sal_False;
+ }
+ void AccessibleBrowseBoxTableCell::disposing( const EventObject& _rSource ) throw (RuntimeException)
+ {
+ if ( _rSource.Source == mxParent )
+ {
+ dispose();
+ }
+ }
+
+}
diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx
new file mode 100755
index 000000000000..f0aa406b62bf
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include "accessibility/extended/AccessibleGridControl.hxx"
+#include "accessibility/extended/AccessibleGridControlTable.hxx"
+#include "accessibility/extended/AccessibleGridControlHeader.hxx"
+#include <svtools/accessibletable.hxx>
+#include <comphelper/types.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+// ============================================================================
+
+namespace accessibility
+{
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+
+// ============================================================================
+class AccessibleGridControl_Impl
+{
+public:
+ /// the XAccessible which created the AccessibleGridControl
+ WeakReference< XAccessible > m_aCreator;
+
+ /** The data table child. */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xTable;
+ AccessibleGridControlTable* m_pTable;
+
+ /** The header bar for rows. */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xRowHeaderBar;
+ AccessibleGridControlHeader* m_pRowHeaderBar;
+
+ /** The header bar for columns (first row of the table). */
+ Reference<
+ ::com::sun::star::accessibility::XAccessible > m_xColumnHeaderBar;
+ AccessibleGridControlHeader* m_pColumnHeaderBar;
+};
+
+DBG_NAME( AccessibleGridControl )
+
+AccessibleGridControl::AccessibleGridControl(
+ const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxCreator,
+ IAccessibleTable& _rTable )
+ : AccessibleGridControlBase( _rxParent, _rTable, TCTYPE_GRIDCONTROL )
+{
+ m_pImpl.reset( new AccessibleGridControl_Impl() );
+ m_pImpl->m_aCreator = _rxCreator;
+}
+
+// -----------------------------------------------------------------------------
+AccessibleGridControl::~AccessibleGridControl()
+{
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleGridControl::disposing()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ m_pImpl->m_pTable = NULL;
+ m_pImpl->m_pColumnHeaderBar = NULL;
+ m_pImpl->m_pRowHeaderBar = NULL;
+ m_pImpl->m_aCreator = Reference< XAccessible >();
+
+ Reference< XAccessible > xTable = m_pImpl->m_xTable;
+
+ Reference< XComponent > xComp( m_pImpl->m_xTable, UNO_QUERY );
+ if ( xComp.is() )
+ {
+ xComp->dispose();
+ }
+
+ AccessibleGridControlBase::disposing();
+}
+// -----------------------------------------------------------------------------
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleGridControl::getAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aTable.GetAccessibleControlCount();
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControl::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ if (isAlive())
+ {
+ if(nChildIndex == 0 && m_aTable.HasColHeader())
+ {
+ if(!m_pImpl->m_xColumnHeaderBar.is())
+ {
+ AccessibleGridControlHeader* pColHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_COLUMNHEADERBAR);
+ m_pImpl->m_xColumnHeaderBar = pColHeaderBar;
+ }
+ xChild = m_pImpl->m_xColumnHeaderBar;
+ }
+ else if(m_aTable.HasRowHeader() && (nChildIndex == 1 || nChildIndex == 0))
+ {
+ if(!m_pImpl->m_xRowHeaderBar.is())
+ {
+ AccessibleGridControlHeader* pRowHeaderBar = new AccessibleGridControlHeader(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_ROWHEADERBAR);
+ m_pImpl->m_xRowHeaderBar = pRowHeaderBar;
+ }
+ xChild = m_pImpl->m_xRowHeaderBar;
+ }
+ else
+ {
+ AccessibleGridControlTable* pTable = new AccessibleGridControlTable(m_pImpl->m_aCreator, m_aTable, svt::table::TCTYPE_TABLE);
+ m_pImpl->m_xTable = pTable;
+ xChild = m_pImpl->m_xTable;
+ }
+ }
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL AccessibleGridControl::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return AccessibleRole::PANEL;
+}
+// -----------------------------------------------------------------------------
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControl::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 nIndex = 0;
+ if( m_aTable.ConvertPointToControlIndex( nIndex, VCLPoint( rPoint ) ) )
+ xChild = m_aTable.CreateAccessibleControl( nIndex );
+ else
+ {
+ // try whether point is in one of the fixed children
+ // (table, header bars, corner control)
+ Point aPoint( VCLPoint( rPoint ) );
+ for( nIndex = 0; (nIndex < 3) && !xChild.is(); ++nIndex )
+ {
+ Reference< XAccessible > xCurrChild( implGetFixedChild( nIndex ) );
+ Reference< XAccessibleComponent >
+ xCurrChildComp( xCurrChild, uno::UNO_QUERY );
+
+ if( xCurrChildComp.is() &&
+ VCLRectangle( xCurrChildComp->getBounds() ).IsInside( aPoint ) )
+ xChild = xCurrChild;
+ }
+ }
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL AccessibleGridControl::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ m_aTable.GrabFocus();
+}
+// -----------------------------------------------------------------------------
+
+Any SAL_CALL AccessibleGridControl::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any();
+}
+// -----------------------------------------------------------------------------
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControl::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControl" ) );
+}
+// -----------------------------------------------------------------------------
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleGridControl::implGetBoundingBox()
+{
+ Window* pParent = m_aTable.GetAccessibleParentWindow();
+ DBG_ASSERT( pParent, "implGetBoundingBox - missing parent window" );
+ return m_aTable.GetWindowExtentsRelative( pParent );
+}
+// -----------------------------------------------------------------------------
+
+Rectangle AccessibleGridControl::implGetBoundingBoxOnScreen()
+{
+ return m_aTable.GetWindowExtentsRelative( NULL );
+}
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessible > AccessibleGridControl::implGetTable()
+{
+ if( !m_pImpl->m_xTable.is() )
+ {
+ m_pImpl->m_pTable = createAccessibleTable();
+ m_pImpl->m_xTable = m_pImpl->m_pTable;
+ }
+ return m_pImpl->m_xTable;
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible >
+AccessibleGridControl::implGetHeaderBar( AccessibleTableControlObjType eObjType )
+{
+ Reference< XAccessible > xRet;
+ Reference< XAccessible >* pxMember = NULL;
+
+ if( eObjType == TCTYPE_ROWHEADERBAR )
+ pxMember = &m_pImpl->m_xRowHeaderBar;
+ else if( eObjType == TCTYPE_COLUMNHEADERBAR )
+ pxMember = &m_pImpl->m_xColumnHeaderBar;
+
+ if( pxMember )
+ {
+ if( !pxMember->is() )
+ {
+ AccessibleGridControlHeader* pHeaderBar = new AccessibleGridControlHeader(
+ (Reference< XAccessible >)m_pImpl->m_aCreator, m_aTable, eObjType );
+
+ if ( TCTYPE_COLUMNHEADERBAR == eObjType)
+ m_pImpl->m_pColumnHeaderBar = pHeaderBar;
+ else
+ m_pImpl->m_pRowHeaderBar = pHeaderBar;
+
+ *pxMember = pHeaderBar;
+ }
+ xRet = *pxMember;
+ }
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible >
+AccessibleGridControl::implGetFixedChild( sal_Int32 nChildIndex )
+{
+ Reference< XAccessible > xRet;
+ switch( nChildIndex )
+ {
+ case TCINDEX_COLUMNHEADERBAR:
+ xRet = implGetHeaderBar( TCTYPE_COLUMNHEADERBAR );
+ break;
+ case TCINDEX_ROWHEADERBAR:
+ xRet = implGetHeaderBar( TCTYPE_ROWHEADERBAR );
+ break;
+ case TCINDEX_TABLE:
+ xRet = implGetTable();
+ break;
+ }
+ return xRet;
+}
+// -----------------------------------------------------------------------------
+AccessibleGridControlTable* AccessibleGridControl::createAccessibleTable()
+{
+ Reference< XAccessible > xCreator = (Reference< XAccessible >)m_pImpl->m_aCreator;
+ DBG_ASSERT( xCreator.is(), "accessibility/extended/AccessibleGirdControl::createAccessibleTable: my creator died - how this?" );
+ return new AccessibleGridControlTable( xCreator, m_aTable, TCTYPE_TABLE );
+}
+// ============================================================================
+// = AccessibleGridControlAccess
+// ============================================================================
+DBG_NAME( AccessibleGridControlAccess )
+// -----------------------------------------------------------------------------
+AccessibleGridControlAccess::AccessibleGridControlAccess( const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable )
+ :m_xParent( _rxParent )
+ ,m_rTable( _rTable )
+ ,m_pContext( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+AccessibleGridControlAccess::~AccessibleGridControlAccess()
+{
+}
+
+// -----------------------------------------------------------------------------
+void AccessibleGridControlAccess::dispose()
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_pContext = NULL;
+ ::comphelper::disposeComponent( m_xContext );
+}
+
+// -----------------------------------------------------------------------------
+Reference< XAccessibleContext > SAL_CALL AccessibleGridControlAccess::getAccessibleContext() throw ( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ DBG_ASSERT( ( m_pContext && m_xContext.is() ) || ( !m_pContext && !m_xContext.is() ),
+ "accessibility/extended/AccessibleGridControlAccess::getAccessibleContext: inconsistency!" );
+
+ // if the context died meanwhile (we're no listener, so it won't tell us explicitily when this happens),
+ // then reset an re-create.
+ if ( m_pContext && !m_pContext->isAlive() )
+ m_xContext = m_pContext = NULL;
+
+ if ( !m_xContext.is() )
+ m_xContext = m_pContext = new AccessibleGridControl( m_xParent, this, m_rTable );
+
+ return m_xContext;
+}
+
+// -----------------------------------------------------------------------------
+bool AccessibleGridControlAccess::isContextAlive() const
+{
+ return ( NULL != m_pContext ) && m_pContext->isAlive();
+}
+
+// ============================================================================
+
+} // namespace accessibility
diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx
new file mode 100755
index 000000000000..ea81bd350426
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlBase.cxx
@@ -0,0 +1,535 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include "accessibility/extended/AccessibleGridControlBase.hxx"
+#include <svtools/accessibletable.hxx>
+#include <rtl/uuid.h>
+//
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblerelationsethelper.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+using namespace ::svt;
+using namespace ::svt::table;
+
+
+// ============================================================================
+
+namespace accessibility {
+
+using namespace com::sun::star::accessibility::AccessibleStateType;
+// ============================================================================
+
+DBG_NAME( AccessibleGridControlBase )
+
+AccessibleGridControlBase::AccessibleGridControlBase(
+ const Reference< XAccessible >& rxParent,
+ svt::table::IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType ) :
+ AccessibleGridControlImplHelper( m_aMutex ),
+ m_xParent( rxParent ),
+ m_aTable( rTable),
+ m_eObjType( eObjType ),
+ m_aName( rTable.GetAccessibleObjectName( eObjType, 0, 0 ) ),
+ m_aDescription( rTable.GetAccessibleObjectDescription( eObjType ) ),
+ m_aClientId(0)
+{
+}
+
+AccessibleGridControlBase::~AccessibleGridControlBase()
+{
+ if( isAlive() )
+ {
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+}
+
+void SAL_CALL AccessibleGridControlBase::disposing()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ m_xParent = NULL;
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleParent()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_xParent;
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlBase::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ // -1 for child not found/no parent (according to specification)
+ sal_Int32 nRet = -1;
+
+ Reference< uno::XInterface > xMeMyselfAndI( static_cast< XAccessibleContext* >( this ), uno::UNO_QUERY );
+
+ // iterate over parent's children and search for this object
+ if( m_xParent.is() )
+ {
+ Reference< XAccessibleContext >
+ xParentContext( m_xParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ {
+ Reference< uno::XInterface > xChild;
+
+ sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
+ for( sal_Int32 nChild = 0; nChild < nChildCount; ++nChild )
+ {
+ xChild = xChild.query( xParentContext->getAccessibleChild( nChild ) );
+ if ( xMeMyselfAndI.get() == xChild.get() )
+ {
+ nRet = nChild;
+ break;
+ }
+ }
+ }
+ }
+ return nRet;
+}
+
+OUString SAL_CALL AccessibleGridControlBase::getAccessibleDescription()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aDescription;
+}
+
+OUString SAL_CALL AccessibleGridControlBase::getAccessibleName()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aName;
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL
+AccessibleGridControlBase::getAccessibleRelationSet()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ // GridControl does not have relations.
+ return new utl::AccessibleRelationSetHelper;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL
+AccessibleGridControlBase::getAccessibleStateSet()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ // don't check whether alive -> StateSet may contain DEFUNC
+ return implCreateStateSetHelper();
+}
+
+lang::Locale SAL_CALL AccessibleGridControlBase::getLocale()
+ throw ( IllegalAccessibleComponentStateException, uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ if( m_xParent.is() )
+ {
+ Reference< XAccessibleContext >
+ xParentContext( m_xParent->getAccessibleContext() );
+ if( xParentContext.is() )
+ return xParentContext->getLocale();
+ }
+ throw IllegalAccessibleComponentStateException();
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleGridControlBase::containsPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ return Rectangle( Point(), getBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+}
+
+awt::Rectangle SAL_CALL AccessibleGridControlBase::getBounds()
+ throw ( uno::RuntimeException )
+{
+ return AWTRectangle( getBoundingBox() );
+}
+
+awt::Point SAL_CALL AccessibleGridControlBase::getLocation()
+ throw ( uno::RuntimeException )
+{
+ return AWTPoint( getBoundingBox().TopLeft() );
+}
+
+awt::Point SAL_CALL AccessibleGridControlBase::getLocationOnScreen()
+ throw ( uno::RuntimeException )
+{
+ return AWTPoint( getBoundingBoxOnScreen().TopLeft() );
+}
+
+awt::Size SAL_CALL AccessibleGridControlBase::getSize()
+ throw ( uno::RuntimeException )
+{
+ return AWTSize( getBoundingBox().GetSize() );
+}
+
+sal_Bool SAL_CALL AccessibleGridControlBase::isShowing()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implIsShowing();
+}
+
+sal_Bool SAL_CALL AccessibleGridControlBase::isVisible()
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
+ return xStateSet.is() ?
+ xStateSet->contains( AccessibleStateType::VISIBLE ) : sal_False;
+}
+
+sal_Bool SAL_CALL AccessibleGridControlBase::isFocusTraversable()
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessibleStateSet > xStateSet = getAccessibleStateSet();
+ return xStateSet.is() ?
+ xStateSet->contains( AccessibleStateType::FOCUSABLE ) : sal_False;
+}
+// XAccessibleEventBroadcaster ------------------------------------------------
+
+void SAL_CALL AccessibleGridControlBase::addEventListener(
+ const Reference< XAccessibleEventListener>& _rxListener )
+ throw ( uno::RuntimeException )
+{
+ if ( _rxListener.is() )
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ if ( !getClientId( ) )
+ setClientId( AccessibleEventNotifier::registerClient( ) );
+
+ AccessibleEventNotifier::addEventListener( getClientId( ), _rxListener );
+ }
+}
+
+void SAL_CALL AccessibleGridControlBase::removeEventListener(
+ const Reference< XAccessibleEventListener>& _rxListener )
+ throw ( uno::RuntimeException )
+{
+ if( _rxListener.is() && getClientId( ) )
+ {
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( getClientId( ), _rxListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ AccessibleEventNotifier::TClientId nId( getClientId( ) );
+ setClientId( 0 );
+ AccessibleEventNotifier::revokeClient( nId );
+ }
+ }
+}
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< sal_Int8 > SAL_CALL AccessibleGridControlBase::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+sal_Bool SAL_CALL AccessibleGridControlBase::supportsService(
+ const OUString& rServiceName )
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ Sequence< OUString > aSupportedServices( getSupportedServiceNames() );
+ const OUString* pArrBegin = aSupportedServices.getConstArray();
+ const OUString* pArrEnd = pArrBegin + aSupportedServices.getLength();
+ const OUString* pString = pArrBegin;
+
+ for( ; ( pString != pArrEnd ) && ( rServiceName != *pString ); ++pString )
+ ;
+ return pString != pArrEnd;
+}
+
+Sequence< OUString > SAL_CALL AccessibleGridControlBase::getSupportedServiceNames()
+ throw ( uno::RuntimeException )
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
+ return Sequence< OUString >( &aServiceName, 1 );
+}
+// internal virtual methods ---------------------------------------------------
+
+sal_Bool AccessibleGridControlBase::implIsShowing()
+{
+ sal_Bool bShowing = sal_False;
+ if( m_xParent.is() )
+ {
+ Reference< XAccessibleComponent >
+ xParentComp( m_xParent->getAccessibleContext(), uno::UNO_QUERY );
+ if( xParentComp.is() )
+ bShowing = implGetBoundingBox().IsOver(
+ VCLRectangle( xParentComp->getBounds() ) );
+ }
+ return bShowing;
+}
+
+::utl::AccessibleStateSetHelper* AccessibleGridControlBase::implCreateStateSetHelper()
+{
+ ::utl::AccessibleStateSetHelper*
+ pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with m_xParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ // GridControl fills StateSet with states depending on object type
+ m_aTable.FillAccessibleStateSet( *pStateSetHelper, getType() );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ return pStateSetHelper;
+}
+
+// internal helper methods ----------------------------------------------------
+
+sal_Bool AccessibleGridControlBase::isAlive() const
+{
+ return !rBHelper.bDisposed && !rBHelper.bInDispose && &m_aTable;
+}
+
+void AccessibleGridControlBase::ensureIsAlive() const
+ throw ( lang::DisposedException )
+{
+ if( !isAlive() )
+ throw lang::DisposedException();
+}
+
+Rectangle AccessibleGridControlBase::getBoundingBox()
+ throw ( lang::DisposedException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Rectangle aRect = implGetBoundingBox();
+ if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
+ {
+ DBG_ERRORFILE( "rectangle doesn't exist" );
+ }
+ return aRect;
+}
+
+Rectangle AccessibleGridControlBase::getBoundingBoxOnScreen()
+ throw ( lang::DisposedException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Rectangle aRect = implGetBoundingBoxOnScreen();
+ if ( 0 == aRect.Left() && 0 == aRect.Top() && 0 == aRect.Right() && 0 == aRect.Bottom() )
+ {
+ DBG_ERRORFILE( "rectangle doesn't exist" );
+ }
+ return aRect;
+}
+
+void AccessibleGridControlBase::commitEvent(
+ sal_Int16 _nEventId, const Any& _rNewValue, const Any& _rOldValue )
+{
+ ::osl::ClearableMutexGuard aGuard( getOslMutex() );
+ if ( !getClientId( ) )
+ // if we don't have a client id for the notifier, then we don't have listeners, then
+ // we don't need to notify anything
+ return;
+
+ // build an event object
+ AccessibleEventObject aEvent;
+ aEvent.Source = *this;
+ aEvent.EventId = _nEventId;
+ aEvent.OldValue = _rOldValue;
+ aEvent.NewValue = _rNewValue;
+
+ // let the notifier handle this event
+
+ AccessibleEventNotifier::addEvent( getClientId( ), aEvent );
+}
+// -----------------------------------------------------------------------------
+
+void AccessibleGridControlBase::implCreateUuid( Sequence< sal_Int8 >& rId )
+{
+ if( !rId.hasElements() )
+ {
+ rId.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( rId.getArray() ), 0, sal_True );
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Int16 SAL_CALL AccessibleGridControlBase::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ sal_Int16 nRole = AccessibleRole::UNKNOWN;
+ switch ( m_eObjType )
+ {
+ case TCTYPE_ROWHEADERCELL:
+ nRole = AccessibleRole::ROW_HEADER;
+ break;
+ case TCTYPE_COLUMNHEADERCELL:
+ nRole = AccessibleRole::COLUMN_HEADER;
+ break;
+ case TCTYPE_COLUMNHEADERBAR:
+ case TCTYPE_ROWHEADERBAR:
+ case TCTYPE_TABLE:
+ nRole = AccessibleRole::TABLE;
+ break;
+ case TCTYPE_TABLECELL:
+ nRole = AccessibleRole::TABLE_CELL;
+ break;
+ case TCTYPE_GRIDCONTROL:
+ nRole = AccessibleRole::PANEL;
+ break;
+ }
+ return nRole;
+}
+// -----------------------------------------------------------------------------
+Any SAL_CALL AccessibleGridControlBase::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ return Any();
+}
+// -----------------------------------------------------------------------------
+Reference<XAccessible > SAL_CALL AccessibleGridControlBase::getAccessibleAtPoint( const ::com::sun::star::awt::Point& )
+ throw ( uno::RuntimeException )
+{
+ return NULL;
+}
+//// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleGridControlBase::getForeground( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ sal_Int32 nColor = 0;
+ Window* pInst = m_aTable.GetWindowInstance();
+ if ( pInst )
+ {
+ if ( pInst->IsControlForeground() )
+ nColor = pInst->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( pInst->IsControlFont() )
+ aFont = pInst->GetControlFont();
+ else
+ aFont = pInst->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
+ }
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleGridControlBase::getBackground( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nColor = 0;
+ Window* pInst = m_aTable.GetWindowInstance();
+ if ( pInst )
+ {
+ if ( pInst->IsControlBackground() )
+ nColor = pInst->GetControlBackground().GetColor();
+ else
+ nColor = pInst->GetBackground().GetColor().GetColor();
+ }
+ return nColor;
+}
+
+//// ============================================================================
+GridControlAccessibleElement::GridControlAccessibleElement( const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType )
+ :AccessibleGridControlBase( rxParent, rTable, eObjType )
+{
+}
+
+// XInterface -----------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base)
+
+// XTypeProvider --------------------------------------------------------------
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( GridControlAccessibleElement, AccessibleGridControlBase, GridControlAccessibleElement_Base )
+
+// XAccessible ----------------------------------------------------------------
+
+Reference< XAccessibleContext > SAL_CALL GridControlAccessibleElement::getAccessibleContext() throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return this;
+}
+// ----------------------------------------------------------------------------
+GridControlAccessibleElement::~GridControlAccessibleElement( )
+{
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx
new file mode 100755
index 000000000000..1870eebc8e3e
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -0,0 +1,284 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleGridControlHeader.hxx"
+#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
+#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
+#include <svtools/accessibletable.hxx>
+
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+DBG_NAME( AccessibleGridControlHeader )
+
+AccessibleGridControlHeader::AccessibleGridControlHeader(
+ const Reference< XAccessible >& rxParent,
+ ::svt::table::IAccessibleTable& rTable,
+ ::svt::table::AccessibleTableControlObjType eObjType):
+ AccessibleGridControlTableBase( rxParent, rTable, eObjType )
+{
+ DBG_ASSERT( isRowBar() || isColumnBar(),
+ "accessibility/extended/AccessibleGridControlHeaderBar - invalid object type" );
+}
+
+AccessibleGridControlHeader::~AccessibleGridControlHeader()
+{
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ if (nChildIndex<0 || nChildIndex>=getAccessibleChildCount())
+ throw IndexOutOfBoundsException();
+ ensureIsAlive();
+ Reference< XAccessible > xChild;
+ if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL);
+ xChild = pColHeaderCell;
+ }
+ else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL);
+ xChild = pRowHeaderCell;
+ }
+ return xChild;
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlHeader::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR && m_aTable.HasColHeader())
+ return 1;
+ else
+ return 0;
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlHeader::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ sal_Int32 nRow = 0;
+ sal_Int32 nColumnPos = 0;
+ sal_Bool bConverted = isRowBar() ?
+ m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) :
+ m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) );
+
+ return bConverted ? implGetChild( nRow, nColumnPos ) : Reference< XAccessible >();
+}
+
+void SAL_CALL AccessibleGridControlHeader::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ // focus on header not supported
+}
+
+Any SAL_CALL AccessibleGridControlHeader::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any(); // no special key bindings for header
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlHeader::getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return OUString(); // no headers in headers
+}
+
+OUString SAL_CALL AccessibleGridControlHeader::getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return OUString(); // no headers in headers
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleRowHeaders()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // no headers in headers
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlHeader::getAccessibleColumnHeaders()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // no headers in headers
+}
+//not selectable
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleRows()
+ throw ( uno::RuntimeException )
+{
+ Sequence< sal_Int32 > aSelSeq(0);
+ return aSelSeq;
+}
+//columns aren't selectable
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlHeader::getSelectedAccessibleColumns()
+ throw ( uno::RuntimeException )
+{
+ Sequence< sal_Int32 > aSelSeq(0);
+ return aSelSeq;
+}
+//row headers not selectable
+sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleRowSelected( sal_Int32 /*nRow*/ )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ return sal_False;
+}
+//columns aren't selectable
+sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ (void)nColumn;
+ return sal_False;
+}
+//not implemented
+Reference< XAccessible > SAL_CALL AccessibleGridControlHeader::getAccessibleCellAt(
+ sal_Int32 /*nRow*/, sal_Int32 /*nColumn*/ )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ return NULL;
+}
+// not selectable
+sal_Bool SAL_CALL AccessibleGridControlHeader::isAccessibleSelected(
+ sal_Int32 /*nRow*/, sal_Int32 /*nColumn */)
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ return sal_False;
+}
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlHeader::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeader" ) );
+}
+
+Sequence< sal_Int8 > SAL_CALL AccessibleGridControlHeader::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleGridControlHeader::implGetBoundingBox()
+{
+ return m_aTable.calcHeaderRect(isColumnBar());
+}
+
+Rectangle AccessibleGridControlHeader::implGetBoundingBoxOnScreen()
+{
+ return m_aTable.calcHeaderRect(isColumnBar());
+}
+
+sal_Int32 AccessibleGridControlHeader::implGetRowCount() const
+{
+ return 1;
+}
+
+sal_Int32 AccessibleGridControlHeader::implGetColumnCount() const
+{
+ return 1;
+}
+
+// internal helper methods ----------------------------------------------------
+
+Reference< XAccessible > AccessibleGridControlHeader::implGetChild(
+ sal_Int32 nRow, sal_uInt32 nColumnPos )
+{
+ Reference< XAccessible > xChild;
+ if(m_eObjType == svt::table::TCTYPE_COLUMNHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, svt::table::TCTYPE_COLUMNHEADERCELL);
+ xChild = pColHeaderCell;
+ }
+ else if(m_eObjType == svt::table::TCTYPE_ROWHEADERBAR)
+ {
+ AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, svt::table::TCTYPE_ROWHEADERCELL);
+ xChild = pRowHeaderCell;
+ }
+ return xChild;
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
new file mode 100755
index 000000000000..485c57c40ae1
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleGridControlHeaderCell.hxx"
+#include <svtools/accessibletable.hxx>
+#include "accessibility/extended/AccessibleGridControl.hxx"
+
+namespace accessibility
+{
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::uno;
+ using namespace ::svt;
+ using namespace ::svt::table;
+
+AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nColumnRowId,
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType)
+: AccessibleGridControlCell( rxParent, rTable, _nColumnRowId, 0, eObjType)
+, m_nColumnRowId(_nColumnRowId)
+{
+}
+/** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+*/
+::utl::AccessibleStateSetHelper* AccessibleGridControlHeaderCell::implCreateStateSetHelper()
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ::utl::AccessibleStateSetHelper*
+ pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with mxParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ TCSolarGuard aSolarGuard;
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+
+ if ( m_aTable.IsRowSelected(m_nColumnRowId) )
+ pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+}
+// -----------------------------------------------------------------------------
+/** @return
+ The count of visible children.
+*/
+sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChildCount()
+ throw ( RuntimeException )
+{
+ return 0;
+}
+// -----------------------------------------------------------------------------
+
+/** @return
+ The XAccessible interface of the specified child.
+*/
+Reference<XAccessible > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleChild( sal_Int32 )
+ throw ( IndexOutOfBoundsException,RuntimeException )
+{
+ throw IndexOutOfBoundsException();
+}
+// XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlHeaderCell::queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ Any aRet = AccessibleGridControlCell::queryInterface(rType);
+ return aRet;
+ }
+
+ /** Aquires the object (calls acquire() on base class). */
+ void SAL_CALL AccessibleGridControlHeaderCell::acquire() throw ()
+ {
+ AccessibleGridControlCell::acquire();
+ }
+
+ /** Releases the object (calls release() on base class). */
+ void SAL_CALL AccessibleGridControlHeaderCell::release() throw ()
+ {
+ AccessibleGridControlCell::release();
+ }
+ /** @return The XAccessibleContext interface of this object. */
+ Reference< com::sun::star::accessibility::XAccessibleContext > SAL_CALL AccessibleGridControlHeaderCell::getAccessibleContext() throw ( RuntimeException )
+ {
+ ensureIsAlive();
+ return this;
+ }
+
+// -----------------------------------------------------------------------------
+
+/** Grabs the focus to the column header. */
+void SAL_CALL AccessibleGridControlHeaderCell::grabFocus()
+ throw ( ::com::sun::star::uno::RuntimeException )
+{
+}
+// -----------------------------------------------------------------------------
+/** @return
+ The name of this class.
+*/
+::rtl::OUString SAL_CALL AccessibleGridControlHeaderCell::getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException )
+{
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlHeaderCell" ) );
+}
+// -----------------------------------------------------------------------------
+Rectangle AccessibleGridControlHeaderCell::implGetBoundingBox()
+{
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+}
+// -----------------------------------------------------------------------------
+
+Rectangle AccessibleGridControlHeaderCell::implGetBoundingBoxOnScreen()
+{
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleGridControlHeaderCell::getAccessibleIndexInParent()
+ throw ( RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nIndex = m_nColumnRowId;
+ return nIndex;
+}
+// -----------------------------------------------------------------------------
+} // namespace accessibility
+// -----------------------------------------------------------------------------
+
+
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx
new file mode 100755
index 000000000000..406baeb2973c
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -0,0 +1,376 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleGridControlTable.hxx"
+#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
+#include <svtools/accessibletable.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+DBG_NAME( AccessibleGridControlTable )
+
+AccessibleGridControlTable::AccessibleGridControlTable(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType _eType) :
+ AccessibleGridControlTableBase( rxParent, rTable, _eType )
+{
+}
+
+AccessibleGridControlTable::~AccessibleGridControlTable()
+{
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount(), TCTYPE_TABLECELL);
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ if(m_aTable.HasRowHeader() && m_aTable.HasColHeader())
+ return 0;
+ else if((!m_aTable.HasRowHeader() && m_aTable.HasColHeader()) || (m_aTable.HasRowHeader() && !m_aTable.HasColHeader()) )
+ return 1;
+ else
+ return 2;
+}
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlTable::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 nRow = 0;
+ sal_Int32 nColumnPos = 0;
+ if( m_aTable.ConvertPointToCellAddress( nRow, nColumnPos, VCLPoint( rPoint ) ) )
+ xChild = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumnPos, TCTYPE_TABLECELL);
+
+ return xChild;
+}
+
+void SAL_CALL AccessibleGridControlTable::grabFocus()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ m_aTable.GrabFocus();
+}
+
+Any SAL_CALL AccessibleGridControlTable::getAccessibleKeyBinding()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return Any(); // no special key bindings for data table
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlTable::getAccessibleRowDescription( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ return m_aTable.GetRowDescription( nRow );
+}
+
+OUString SAL_CALL AccessibleGridControlTable::getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidColumn( nColumn );
+ return m_aTable.GetColumnDescription( (sal_uInt16)nColumn );
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleRowHeaders()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ if(m_aTable.HasColHeader())
+ return implGetHeaderBar( 1 );
+ else
+ return implGetHeaderBar( 0 );
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleGridControlTable::getAccessibleColumnHeaders()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return implGetHeaderBar( 0 );
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleRows()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Sequence< sal_Int32 > aSelSeq;
+ implGetSelectedRows( aSelSeq );
+ return aSelSeq;
+}
+
+//columns aren't selectable
+Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessibleColumns()
+ throw ( uno::RuntimeException )
+{
+ Sequence< sal_Int32 > aSelSeq(0);
+ return aSelSeq;
+}
+
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ sal_Bool bSelected = sal_False;
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ for(int i=0; i<selectedRows.getLength(); i++)
+ {
+ if(nRow == selectedRows[i])
+ {
+ bSelected = sal_True;
+ continue;
+ }
+ }
+ return bSelected;
+}
+
+//columns aren't selectable
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ (void) nColumn;
+ return sal_False;
+}
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn, TCTYPE_TABLECELL);
+}
+
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ (void) nColumn;
+ //selection of single cells not possible, so if row is selected, the cell will be selected too
+ return isAccessibleRowSelected(nRow);
+}
+void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ sal_Int32 nRow = (nChildIndex / nColumns);
+ m_aTable.SelectRow( nRow, sal_True );
+}
+sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ sal_Int32 nRow = (nChildIndex / nColumns);
+ return isAccessibleRowSelected(nRow);
+}
+void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ m_aTable.SelectAllRows( false );
+}
+void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ for(int i=0;i<m_aTable.GetRowCount();i++)
+ selectedRows[i]=i;
+}
+sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ return selectedRows.getLength()*nColumns;
+}
+Reference< XAccessible > SAL_CALL
+AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ if(isAccessibleChildSelected(nSelectedChildIndex))
+ return getAccessibleChild(nSelectedChildIndex);
+ else
+ return NULL;
+}
+//not implemented yet, because only row selection possible
+void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild(
+ sal_Int32 nSelectedChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ (void)nSelectedChildIndex;
+}
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL AccessibleGridControlTable::queryInterface( const uno::Type& rType )
+ throw ( uno::RuntimeException )
+{
+ Any aAny( AccessibleGridControlTableBase::queryInterface( rType ) );
+ return aAny.hasValue() ?
+ aAny : AccessibleGridControlTableImplHelper1::queryInterface( rType );
+}
+
+void SAL_CALL AccessibleGridControlTable::acquire() throw ()
+{
+ AccessibleGridControlTableBase::acquire();
+}
+
+void SAL_CALL AccessibleGridControlTable::release() throw ()
+{
+ AccessibleGridControlTableBase::release();
+}
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL AccessibleGridControlTable::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTable" ) );
+}
+
+// internal virtual methods ---------------------------------------------------
+
+Rectangle AccessibleGridControlTable::implGetBoundingBox()
+{
+ return m_aTable.calcTableRect();
+}
+
+Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen()
+{
+ return m_aTable.calcTableRect();
+}
+// internal helper methods ----------------------------------------------------
+Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
+ sal_Int32 nChildIndex )
+ throw ( uno::RuntimeException )
+{
+ Reference< XAccessible > xRet;
+ Reference< XAccessibleContext > xContext( m_xParent, uno::UNO_QUERY );
+ if( xContext.is() )
+ {
+ try
+ {
+ xRet = xContext->getAccessibleChild( nChildIndex );
+ }
+ catch( lang::IndexOutOfBoundsException& )
+ {
+ DBG_ERROR( "implGetHeaderBar - wrong child index" );
+ }
+ // RuntimeException goes to caller
+ }
+ return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlTableBase.cxx b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
new file mode 100644
index 000000000000..d97feb1277ec
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlTableBase.cxx
@@ -0,0 +1,291 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+
+#include "accessibility/extended/AccessibleGridControlTableBase.hxx"
+#include <svtools/accessibletable.hxx>
+#include <tools/multisel.hxx>
+#include <comphelper/sequence.hxx>
+
+// ============================================================================
+
+using ::rtl::OUString;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::svt;
+using namespace ::svt::table;
+
+// ============================================================================
+
+namespace accessibility {
+
+// ============================================================================
+
+DBG_NAME( AccessibleGridControlTableBase )
+
+AccessibleGridControlTableBase::AccessibleGridControlTableBase(
+ const Reference< XAccessible >& rxParent,
+ IAccessibleTable& rTable,
+ AccessibleTableControlObjType eObjType ) :
+ GridControlAccessibleElement( rxParent, rTable, eObjType )
+{
+}
+
+AccessibleGridControlTableBase::~AccessibleGridControlTableBase()
+{
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleChildCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ sal_Int32 nChildren = 0;
+ if(m_eObjType == TCTYPE_ROWHEADERBAR)
+ nChildren = m_aTable.GetRowCount();
+ else if(m_eObjType == TCTYPE_TABLE)
+ nChildren = m_aTable.GetRowCount()*m_aTable.GetColumnCount();
+ else if(m_eObjType == TCTYPE_COLUMNHEADERBAR)
+ nChildren = m_aTable.GetColumnCount();
+ return nChildren;
+}
+
+sal_Int16 SAL_CALL AccessibleGridControlTableBase::getAccessibleRole()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return AccessibleRole::TABLE;
+}
+
+// XAccessibleTable -----------------------------------------------------------
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aTable.GetRowCount();
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnCount()
+ throw ( uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ return m_aTable.GetColumnCount();
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRowExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return 1; // merged cells not supported
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumnExtentAt(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return 1; // merged cells not supported
+}
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleCaption()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // not supported
+}
+
+Reference< XAccessible > SAL_CALL AccessibleGridControlTableBase::getAccessibleSummary()
+ throw ( uno::RuntimeException )
+{
+ ensureIsAlive();
+ return NULL; // not supported
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleIndex(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidAddress( nRow, nColumn );
+ return implGetChildIndex( nRow, nColumn );
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleRow( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return implGetRow( nChildIndex );
+}
+
+sal_Int32 SAL_CALL AccessibleGridControlTableBase::getAccessibleColumn( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ return implGetColumn( nChildIndex );
+}
+
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL AccessibleGridControlTableBase::queryInterface( const uno::Type& rType )
+ throw ( uno::RuntimeException )
+{
+ Any aAny( GridControlAccessibleElement::queryInterface( rType ) );
+ return aAny.hasValue() ?
+ aAny : AccessibleGridControlTableImplHelper::queryInterface( rType );
+}
+
+void SAL_CALL AccessibleGridControlTableBase::acquire() throw ()
+{
+ GridControlAccessibleElement::acquire();
+}
+
+void SAL_CALL AccessibleGridControlTableBase::release() throw ()
+{
+ GridControlAccessibleElement::release();
+}
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< uno::Type > SAL_CALL AccessibleGridControlTableBase::getTypes()
+ throw ( uno::RuntimeException )
+{
+ return ::comphelper::concatSequences(
+ GridControlAccessibleElement::getTypes(),
+ AccessibleGridControlTableImplHelper::getTypes() );
+}
+
+Sequence< sal_Int8 > SAL_CALL AccessibleGridControlTableBase::getImplementationId()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( getOslGlobalMutex() );
+ static Sequence< sal_Int8 > aId;
+ implCreateUuid( aId );
+ return aId;
+}
+
+// internal helper methods ----------------------------------------------------
+
+sal_Int32 AccessibleGridControlTableBase::implGetChildCount() const
+{
+ return m_aTable.GetRowCount()*m_aTable.GetColumnCount();
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetRow( sal_Int32 nChildIndex ) const
+{
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ return nColumns ? (nChildIndex / nColumns) : 0;
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetColumn( sal_Int32 nChildIndex ) const
+{
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ return nColumns ? (nChildIndex % nColumns) : 0;
+}
+
+sal_Int32 AccessibleGridControlTableBase::implGetChildIndex(
+ sal_Int32 nRow, sal_Int32 nColumn ) const
+{
+ return nRow * m_aTable.GetColumnCount() + nColumn;
+}
+
+void AccessibleGridControlTableBase::implGetSelectedRows( Sequence< sal_Int32 >& rSeq )
+{
+ sal_Int32 const selectionCount( m_aTable.GetSelectedRowCount() );
+ rSeq.realloc( selectionCount );
+ for ( sal_Int32 i=0; i<selectionCount; ++i )
+ rSeq[i] = m_aTable.GetSelectedRowIndex(i);
+}
+
+void AccessibleGridControlTableBase::ensureIsValidRow( sal_Int32 nRow )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nRow >= m_aTable.GetRowCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this );
+}
+
+void AccessibleGridControlTableBase::ensureIsValidColumn( sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nColumn >= m_aTable.GetColumnCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this );
+}
+
+void AccessibleGridControlTableBase::ensureIsValidAddress(
+ sal_Int32 nRow, sal_Int32 nColumn )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ ensureIsValidRow( nRow );
+ ensureIsValidColumn( nColumn );
+}
+
+void AccessibleGridControlTableBase::ensureIsValidIndex( sal_Int32 nChildIndex )
+ throw ( lang::IndexOutOfBoundsException )
+{
+ if( nChildIndex >= implGetChildCount() )
+ throw lang::IndexOutOfBoundsException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this );
+}
+
+// ============================================================================
+
+} // namespace accessibility
+
+// ============================================================================
+
diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
new file mode 100755
index 000000000000..43b9400e9050
--- /dev/null
+++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleGridControlTableCell.hxx"
+#include <svtools/accessibletable.hxx>
+#include "accessibility/extended/AccessibleGridControl.hxx"
+#include <tools/gen.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+namespace accessibility
+{
+ namespace
+ {
+ void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ {
+ if ( _nIndex >= _sText.getLength() )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount )
+ {
+ return _nRow * _nColumnCount + _nColumn;
+ }
+ }
+ using namespace ::com::sun::star::lang;
+ using namespace utl;
+ using namespace comphelper;
+ using ::rtl::OUString;
+ using ::accessibility::AccessibleGridControl;
+ using namespace ::com::sun::star::uno;
+ using ::com::sun::star::accessibility::XAccessible;
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::svt;
+ using namespace ::svt::table;
+
+
+ // =============================================================================
+ // = AccessibleGridControlCell
+ // =============================================================================
+ // -----------------------------------------------------------------------------
+ AccessibleGridControlCell::AccessibleGridControlCell(
+ const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable,
+ sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleTableControlObjType _eType )
+ :AccessibleGridControlBase( _rxParent, _rTable, _eType )
+ ,m_nRowPos( _nRowPos )
+ ,m_nColPos( _nColPos )
+ {
+ // set accessible name here, because for that we need the position of the cell
+ // and so the base class isn't capable of doing this
+ ::rtl::OUString aAccName;
+ if(_eType == TCTYPE_TABLECELL)
+ aAccName = _rTable.GetAccessibleObjectName( TCTYPE_TABLECELL, _nRowPos, _nColPos );
+ else if(_eType == TCTYPE_ROWHEADERCELL)
+ aAccName = _rTable.GetAccessibleObjectName( TCTYPE_ROWHEADERCELL, _nRowPos, 0 );
+ else if(_eType == TCTYPE_COLUMNHEADERCELL)
+ aAccName = _rTable.GetAccessibleObjectName( TCTYPE_COLUMNHEADERCELL, 0, _nRowPos );
+ implSetName( aAccName );
+ }
+
+ // -----------------------------------------------------------------------------
+ AccessibleGridControlCell::~AccessibleGridControlCell()
+ {
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleGridControlCell::grabFocus() throw ( RuntimeException )
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ m_aTable.GoToCell( m_nColPos, m_nRowPos );
+ }
+ //// -----------------------------------------------------------------------------
+ // implementation of a table cell
+ ::rtl::OUString AccessibleGridControlTableCell::implGetText()
+ {
+ ensureIsAlive();
+ return m_aTable.GetAccessibleCellText( getRowPos(), getColumnPos() );
+ }
+
+ ::com::sun::star::lang::Locale AccessibleGridControlTableCell::implGetLocale()
+ {
+ ensureIsAlive();
+ return m_aTable.GetAccessible()->getAccessibleContext()->getLocale();
+ }
+
+ void AccessibleGridControlTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+ {
+ nStartIndex = 0;
+ nEndIndex = 0;
+ }
+
+ AccessibleGridControlTableCell::AccessibleGridControlTableCell(const Reference<XAccessible >& _rxParent,
+ IAccessibleTable& _rTable,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ AccessibleTableControlObjType eObjType)
+ :AccessibleGridControlCell( _rxParent, _rTable, _nRowPos, _nColPos, eObjType )
+ {
+ }
+
+ // XInterface -------------------------------------------------------------
+
+ /** Queries for a new interface. */
+ ::com::sun::star::uno::Any SAL_CALL AccessibleGridControlTableCell::queryInterface(
+ const ::com::sun::star::uno::Type& rType )
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ Any aRet = AccessibleGridControlCell::queryInterface(rType);
+ if ( !aRet.hasValue() )
+ aRet = AccessibleTextHelper_BASE::queryInterface(rType);
+ return aRet;
+ }
+
+ /** Aquires the object (calls acquire() on base class). */
+ void SAL_CALL AccessibleGridControlTableCell::acquire() throw ()
+ {
+ AccessibleGridControlCell::acquire();
+ }
+
+ /** Releases the object (calls release() on base class). */
+ void SAL_CALL AccessibleGridControlTableCell::release() throw ()
+ {
+ AccessibleGridControlCell::release();
+ }
+
+ ::com::sun::star::awt::Rectangle SAL_CALL AccessibleGridControlTableCell::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ ::com::sun::star::awt::Rectangle aRect;
+
+ if ( &m_aTable )
+ aRect = AWTRectangle( m_aTable.GetFieldCharacterBounds( getRowPos(), getColumnPos(), nIndex ) );
+ return aRect;
+ }
+
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getIndexAtPoint( const ::com::sun::star::awt::Point& _aPoint ) throw (RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ return m_aTable.GetFieldIndexAtPoint( getRowPos(), getColumnPos(), VCLPoint( _aPoint ) );
+ }
+
+ /** @return
+ The name of this class.
+ */
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleGridControlTableCell" ) );
+ }
+
+ /** @return The count of visible children. */
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleChildCount()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return 0;
+ }
+
+ /** @return The XAccessible interface of the specified child. */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ AccessibleGridControlTableCell::getAccessibleChild( sal_Int32 )
+ throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException )
+ {
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ /** Creates a new AccessibleStateSetHelper and fills it with states of the
+ current object.
+ @return
+ A filled AccessibleStateSetHelper.
+ */
+ ::utl::AccessibleStateSetHelper* AccessibleGridControlTableCell::implCreateStateSetHelper()
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+
+ if( isAlive() )
+ {
+ // SHOWING done with mxParent
+ if( implIsShowing() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+ m_aTable.FillAccessibleStateSetForCell( *pStateSetHelper, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return pStateSetHelper;
+ }
+
+
+ // XAccessible ------------------------------------------------------------
+
+ /** @return The XAccessibleContext interface of this object. */
+ Reference< XAccessibleContext > SAL_CALL AccessibleGridControlTableCell::getAccessibleContext() throw ( RuntimeException )
+ {
+ ensureIsAlive();
+ return this;
+ }
+
+ // XAccessibleContext -----------------------------------------------------
+
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getAccessibleIndexInParent()
+ throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ return ( getRowPos() * m_aTable.GetColumnCount() ) + getColumnPos();
+ }
+
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return -1;
+ }
+ sal_Bool SAL_CALL AccessibleGridControlTableCell::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ sal_Unicode SAL_CALL AccessibleGridControlTableCell::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getCharacter( nIndex );
+ }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleGridControlTableCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >();
+ }
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getCharacterCount( );
+ }
+
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectedText( );
+ }
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectionStart( );
+ }
+ sal_Int32 SAL_CALL AccessibleGridControlTableCell::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getSelectionEnd( );
+ }
+ sal_Bool SAL_CALL AccessibleGridControlTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getText( );
+ }
+ ::rtl::OUString SAL_CALL AccessibleGridControlTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleGridControlTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
+ }
+ sal_Bool SAL_CALL AccessibleGridControlTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ::rtl::OUString sText = implGetText();
+ checkIndex_Impl( nStartIndex, sText );
+ checkIndex_Impl( nEndIndex, sText );
+
+ //!!! don't know how to put a string into the clipboard
+ return sal_False;
+ }
+
+ Rectangle AccessibleGridControlTableCell::implGetBoundingBox()
+ {
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ }
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleGridControlTableCell::implGetBoundingBoxOnScreen()
+ {
+ return Rectangle(Point(0,0),Point(0,0));//To Do - return headercell rectangle
+ }
+}
diff --git a/accessibility/source/extended/AccessibleToolPanelDeck.cxx b/accessibility/source/extended/AccessibleToolPanelDeck.cxx
new file mode 100755
index 000000000000..6976b221a8b5
--- /dev/null
+++ b/accessibility/source/extended/AccessibleToolPanelDeck.cxx
@@ -0,0 +1,412 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleToolPanelDeck.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <svtools/toolpanel/toolpaneldeck.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <boost/noncopyable.hpp>
+#include <vector>
+
+//......................................................................................................................
+namespace accessibility
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::accessibility::XAccessibleContext;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::lang::Locale;
+ using ::com::sun::star::accessibility::XAccessibleRelationSet;
+ using ::com::sun::star::accessibility::XAccessibleStateSet;
+ using ::com::sun::star::accessibility::IllegalAccessibleComponentStateException;
+ using ::com::sun::star::awt::XFont;
+ /** === end UNO using === **/
+ namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
+ namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
+ namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
+
+ typedef ::com::sun::star::awt::Rectangle UnoRectangle;
+ typedef ::com::sun::star::awt::Point UnoPoint;
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeck_Impl - declaration
+ //==================================================================================================================
+ class AccessibleToolPanelDeck_Impl :public ::boost::noncopyable
+ ,public ::svt::IToolPanelDeckListener
+ {
+ public:
+ AccessibleToolPanelDeck_Impl(
+ AccessibleToolPanelDeck& i_rAntiImpl,
+ const Reference< XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck
+ );
+
+ void checkDisposed();
+ bool isDisposed() const { return m_pPanelDeck == NULL; }
+ void dispose();
+
+ ~AccessibleToolPanelDeck_Impl();
+
+ Reference< XAccessible > getOwnAccessible() const;
+ Reference< XAccessible > getActivePanelAccessible();
+
+ protected:
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ public:
+ AccessibleToolPanelDeck& m_rAntiImpl;
+ Reference< XAccessible > m_xAccessibleParent;
+ ::svt::ToolPanelDeck* m_pPanelDeck;
+
+ typedef ::std::vector< Reference< XAccessible > > AccessibleChildren;
+ Reference< XAccessible > m_xActivePanelAccessible;
+ };
+
+ //==================================================================================================================
+ //= MethodGuard
+ //==================================================================================================================
+ namespace
+ {
+ class MethodGuard
+ {
+ public:
+ MethodGuard( AccessibleToolPanelDeck_Impl& i_rImpl )
+ :m_aGuard( Application::GetSolarMutex() )
+ {
+ i_rImpl.checkDisposed();
+ }
+ ~MethodGuard()
+ {
+ }
+
+ void clear()
+ {
+ m_aGuard.clear();
+ }
+
+ private:
+ ::vos::OClearableGuard m_aGuard;
+ };
+ }
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeck_Impl - implementation
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeck_Impl::AccessibleToolPanelDeck_Impl( AccessibleToolPanelDeck& i_rAntiImpl, const Reference< XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck )
+ :m_rAntiImpl( i_rAntiImpl )
+ ,m_xAccessibleParent( i_rAccessibleParent )
+ ,m_pPanelDeck( &i_rPanelDeck )
+ ,m_xActivePanelAccessible()
+ {
+ m_pPanelDeck->AddListener( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeck_Impl::~AccessibleToolPanelDeck_Impl()
+ {
+ if ( !isDisposed() )
+ dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck_Impl::dispose()
+ {
+ ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" );
+ m_pPanelDeck->RemoveListener( *this );
+ m_pPanelDeck = NULL;
+ m_xAccessibleParent.clear();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck_Impl::checkDisposed()
+ {
+ if ( isDisposed() )
+ throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleToolPanelDeck_Impl::getOwnAccessible() const
+ {
+ Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) );
+ OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ),
+ "AccessibleToolPanelDeck_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" );
+ return xOwnAccessible;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleToolPanelDeck_Impl::getActivePanelAccessible()
+ {
+ ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: already disposed!", NULL );
+
+ if ( !m_xActivePanelAccessible.is() )
+ {
+ ::boost::optional< size_t > aActivePanel( m_pPanelDeck->GetActivePanel() );
+ ENSURE_OR_RETURN( !!aActivePanel, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: this should not be called without an active panel!", NULL );
+ ::svt::PToolPanel pActivePanel( m_pPanelDeck->GetPanel( *aActivePanel ) );
+ ENSURE_OR_RETURN( pActivePanel.get() != NULL, "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: no active panel!", NULL );
+ m_xActivePanelAccessible = pActivePanel->CreatePanelAccessible( getOwnAccessible() );
+ OSL_ENSURE( m_xActivePanelAccessible.is(), "AccessibleToolPanelDeck_Impl::getActivePanelAccessible: illegal accessible returned by the panel!" );
+ }
+
+ return m_xActivePanelAccessible;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ (void)i_pPanel;
+ (void)i_nPosition;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck_Impl::PanelRemoved( const size_t i_nPosition )
+ {
+ (void)i_nPosition;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ if ( !!i_rOldActive )
+ {
+ if ( !m_xActivePanelAccessible.is() )
+ {
+ // again, this might in theory happen if the XAccessible for the active panel has never before been requested.
+ // In this case, just say that all our children are invalid, so they all must be re-requested.
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() );
+ }
+ else
+ {
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( m_xActivePanelAccessible ), Any() );
+ }
+ }
+
+ m_xActivePanelAccessible.clear();
+
+ if ( !!i_rNewActive )
+ {
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getActivePanelAccessible() ) );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
+ {
+ MethodGuard aGuard( *this );
+
+ (void)i_rNewLayouter;
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck_Impl::Dying()
+ {
+ // the tool panel deck is dying, so dispose ourself
+ m_rAntiImpl.dispose();
+ }
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeck
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeck::AccessibleToolPanelDeck( const Reference< XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck )
+ :AccessibleToolPanelDeck_Base( i_rPanelDeck.GetWindowPeer() )
+ ,m_pImpl( new AccessibleToolPanelDeck_Impl( *this, i_rAccessibleParent, i_rPanelDeck ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeck::~AccessibleToolPanelDeck()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleToolPanelDeck::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+
+ sal_Int32 nChildCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() );
+
+ ::boost::optional< size_t > aActivePanel( m_pImpl->m_pPanelDeck->GetActivePanel() );
+ if ( !!aActivePanel )
+ return ++nChildCount;
+
+ return nChildCount;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+
+ const sal_Int32 nChildCount( getAccessibleChildCount() );
+ if ( ( i_nIndex < 0 ) || ( i_nIndex >= nChildCount ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ // first "n" children are provided by the layouter
+ const size_t nLayouterCount( m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChildCount() );
+ if ( size_t( i_nIndex ) < nLayouterCount )
+ return m_pImpl->m_pPanelDeck->GetLayouter()->GetAccessibleChild(
+ size_t( i_nIndex ),
+ m_pImpl->getOwnAccessible()
+ );
+
+ // the last child is the XAccessible of the active panel
+ return m_pImpl->getActivePanelAccessible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleParent( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+ const Reference< XAccessible > xParent = implGetForeignControlledParent();
+ if ( xParent.is() )
+ return xParent;
+ return m_pImpl->m_xAccessibleParent;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int16 SAL_CALL AccessibleToolPanelDeck::getAccessibleRole( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+ return AccessibleRole::PANEL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelDeck::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+
+ const ::Point aRequestedPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) );
+ // check the panel window itself
+ const ::Window& rActivePanelAnchor( m_pImpl->m_pPanelDeck->GetPanelWindowAnchor() );
+ const Rectangle aPanelAnchorArea( rActivePanelAnchor.GetPosPixel(), rActivePanelAnchor.GetOutputSizePixel() );
+ if ( aPanelAnchorArea.IsInside( aRequestedPoint ) )
+ // note that this assumes that the Window which actually implements the concrete panel covers
+ // the complete area of its "anchor" Window. But this is ensured by the ToolPanelDeck implementation.
+ return m_pImpl->getActivePanelAccessible();
+
+ // check the XAccessible instances provided by the layouter
+ try
+ {
+ const ::svt::PDeckLayouter pLayouter( m_pImpl->m_pPanelDeck->GetLayouter() );
+ ENSURE_OR_THROW( pLayouter.get() != NULL, "invalid layouter" );
+
+ const size_t nLayouterChildren = pLayouter->GetAccessibleChildCount();
+ for ( size_t i=0; i<nLayouterChildren; ++i )
+ {
+ const Reference< XAccessible > xLayoutItemAccessible( pLayouter->GetAccessibleChild( i, m_pImpl->getOwnAccessible() ), UNO_SET_THROW );
+ const Reference< XAccessibleComponent > xLayoutItemComponent( xLayoutItemAccessible->getAccessibleContext(), UNO_QUERY_THROW );
+ const ::Rectangle aLayoutItemBounds( VCLUnoHelper::ConvertToVCLRect( xLayoutItemComponent->getBounds() ) );
+ if ( aLayoutItemBounds.IsInside( aRequestedPoint ) )
+ return xLayoutItemAccessible;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AccessibleToolPanelDeck::grabFocus( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+ m_pImpl->m_pPanelDeck->GrabFocus();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AccessibleToolPanelDeck::disposing()
+ {
+ AccessibleToolPanelDeck_Base::disposing();
+ m_pImpl->dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleToolPanelDeck::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent )
+ {
+ // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those
+ // A11Y events ourself
+ (void)i_rVclWindowEvent;
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeck::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet )
+ {
+ AccessibleToolPanelDeck_Base::FillAccessibleStateSet( i_rStateSet );
+ if ( m_pImpl->isDisposed() )
+ {
+ i_rStateSet.AddState( AccessibleStateType::DEFUNC );
+ }
+ else
+ {
+ i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ }
+ }
+
+//......................................................................................................................
+} // namespace accessibility
+//......................................................................................................................
diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
new file mode 100644
index 000000000000..7e97e3714172
--- /dev/null
+++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBar.cxx
@@ -0,0 +1,459 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleToolPanelDeckTabBar.hxx"
+#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx"
+#include "accessibility/helper/accresmgr.hxx"
+#include "accessibility/helper/accessiblestrings.hrc"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <svtools/toolpanel/toolpaneldeck.hxx>
+#include <svtools/toolpanel/paneltabbar.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/button.hxx>
+#include <vos/mutex.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <vector>
+
+//......................................................................................................................
+namespace accessibility
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::accessibility::XAccessibleContext;
+ /** === end UNO using === **/
+
+ namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
+ namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
+ namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
+
+ typedef ::com::sun::star::awt::Point UnoPoint;
+ typedef ::com::sun::star::awt::Size UnoSize;
+ typedef ::com::sun::star::awt::Rectangle UnoRectangle;
+
+ //==================================================================================================================
+ //= AccessibleWrapper
+ //==================================================================================================================
+ typedef ::cppu::WeakImplHelper1< XAccessible > AccessibleWrapper_Base;
+ class AccessibleWrapper : public AccessibleWrapper_Base
+ {
+ public:
+ AccessibleWrapper( const Reference< XAccessibleContext >& i_rContext )
+ :m_xContext( i_rContext )
+ {
+ }
+
+ // XAccessible
+ virtual Reference< XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (RuntimeException)
+ {
+ return m_xContext;
+ }
+
+ private:
+ const Reference< XAccessibleContext > m_xContext;
+ };
+
+ //==================================================================================================================
+ //= AccessibleToolPanelTabBar_Impl
+ //==================================================================================================================
+ class AccessibleToolPanelTabBar_Impl :public ::boost::noncopyable
+ ,public ::svt::IToolPanelDeckListener
+ {
+ public:
+ AccessibleToolPanelTabBar_Impl(
+ AccessibleToolPanelTabBar& i_rAntiImpl,
+ const Reference< XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar
+ );
+ ~AccessibleToolPanelTabBar_Impl();
+
+ void checkDisposed();
+ bool isDisposed() const { return m_pPanelDeck == NULL; }
+ void dispose();
+
+ ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; }
+ ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; }
+ const Reference< XAccessible >& getAccessibleParent() const { return m_xAccessibleParent; }
+ Reference< XAccessible > getAccessiblePanelItem( size_t i_nPosition );
+ Reference< XAccessible > getOwnAccessible() const;
+
+ protected:
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ DECL_LINK( OnWindowEvent, const VclSimpleEvent* );
+
+ private:
+ AccessibleToolPanelTabBar& m_rAntiImpl;
+ Reference< XAccessible > m_xAccessibleParent;
+ ::svt::IToolPanelDeck* m_pPanelDeck;
+ ::svt::PanelTabBar* m_pTabBar;
+ ::std::vector< Reference< XAccessible > > m_aChildren;
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelTabBar_Impl::AccessibleToolPanelTabBar_Impl( AccessibleToolPanelTabBar& i_rAntiImpl,
+ const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar )
+ :m_rAntiImpl( i_rAntiImpl )
+ ,m_xAccessibleParent( i_rAccessibleParent )
+ ,m_pPanelDeck( &i_rPanelDeck )
+ ,m_pTabBar( &i_rTabBar )
+ ,m_aChildren()
+ {
+ m_pPanelDeck->AddListener( *this );
+ m_aChildren.resize( m_pPanelDeck->GetPanelCount() );
+
+ const String sAccessibleDescription( TK_RES_STRING( RID_STR_ACC_DESC_PANELDECL_TABBAR ) );
+ i_rTabBar.SetAccessibleName( sAccessibleDescription );
+ i_rTabBar.SetAccessibleDescription( sAccessibleDescription );
+
+ i_rTabBar.GetScrollButton( true ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
+ i_rTabBar.GetScrollButton( false ).AddEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar_Impl::checkDisposed()
+ {
+ if ( isDisposed() )
+ throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelTabBar_Impl::~AccessibleToolPanelTabBar_Impl()
+ {
+ if ( !isDisposed() )
+ dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar_Impl::dispose()
+ {
+ ENSURE_OR_RETURN_VOID( !isDisposed(), "disposed twice" );
+ m_pPanelDeck->RemoveListener( *this );
+ m_pPanelDeck = NULL;
+
+ m_pTabBar->GetScrollButton( true ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
+ m_pTabBar->GetScrollButton( false ).RemoveEventListener( LINK( this, AccessibleToolPanelTabBar_Impl, OnWindowEvent ) );
+ m_pTabBar = NULL;
+
+ m_xAccessibleParent.clear();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem( size_t i_nPosition )
+ {
+ ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: already disposed!", NULL );
+ ENSURE_OR_RETURN( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::getAccessiblePanelItem: invalid index!", NULL );
+
+ Reference< XAccessible >& rAccessibleChild( m_aChildren[ i_nPosition ] );
+ if ( !rAccessibleChild.is() )
+ {
+ ::rtl::Reference< AccessibleToolPanelDeckTabBarItem > pAccesibleItemContext( new AccessibleToolPanelDeckTabBarItem(
+ getOwnAccessible(), *m_pPanelDeck, *m_pTabBar, i_nPosition ) );
+ rAccessibleChild.set( new AccessibleWrapper( pAccesibleItemContext.get() ) );
+ pAccesibleItemContext->lateInit( rAccessibleChild );
+ }
+ return rAccessibleChild;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleToolPanelTabBar_Impl::getOwnAccessible() const
+ {
+ Reference< XAccessible > xOwnAccessible( static_cast< XAccessible* >( m_rAntiImpl.GetVCLXWindow() ) );
+ OSL_ENSURE( xOwnAccessible->getAccessibleContext() == Reference< XAccessibleContext >( &m_rAntiImpl ),
+ "AccessibleToolPanelTabBar_Impl::getOwnAccessible: could not retrieve proper XAccessible for /myself!" );
+ return xOwnAccessible;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ ENSURE_OR_RETURN_VOID( i_nPosition <= m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" );
+ (void)i_pPanel;
+ m_aChildren.insert( m_aChildren.begin() + i_nPosition, NULL );
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny( getAccessiblePanelItem( i_nPosition ) ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar_Impl::PanelRemoved( const size_t i_nPosition )
+ {
+ ENSURE_OR_RETURN_VOID( i_nPosition < m_aChildren.size(), "AccessibleToolPanelTabBar_Impl::PanelInserted: illegal position (or invalid cache!)" );
+
+ const Reference< XAccessible > xOldChild( getAccessiblePanelItem( i_nPosition ) );
+ m_aChildren.erase( m_aChildren.begin() + i_nPosition );
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xOldChild ), Any() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ (void)i_rOldActive;
+ (void)i_rNewActive;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
+ {
+ (void)i_rNewLayouter;
+ m_rAntiImpl.dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar_Impl::Dying()
+ {
+ m_rAntiImpl.dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( AccessibleToolPanelTabBar_Impl, OnWindowEvent, const VclSimpleEvent*, i_pEvent )
+ {
+ ENSURE_OR_RETURN( !isDisposed(), "AccessibleToolPanelTabBar_Impl::OnWindowEvent: already disposed!", 0L );
+
+ const VclWindowEvent* pWindowEvent( dynamic_cast< const VclWindowEvent* >( i_pEvent ) );
+ if ( !pWindowEvent )
+ return 0L;
+
+ const bool bForwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( true ) );
+ const bool bBackwardButton = ( pWindowEvent->GetWindow() == &m_pTabBar->GetScrollButton( false ) );
+ ENSURE_OR_RETURN( bForwardButton || bBackwardButton, "AccessibleToolPanelTabBar_Impl::OnWindowEvent: where does this come from?", 0L );
+
+ const bool bShow = ( i_pEvent->GetId() == VCLEVENT_WINDOW_SHOW );
+ const bool bHide = ( i_pEvent->GetId() == VCLEVENT_WINDOW_HIDE );
+ if ( !bShow && !bHide )
+ // not interested in events other than visibility changes
+ return 0L;
+
+ const Reference< XAccessible > xButtonAccessible( m_pTabBar->GetScrollButton( bForwardButton ).GetAccessible() );
+ const Any aOldChild( bHide ? xButtonAccessible : Reference< XAccessible >() );
+ const Any aNewChild( bShow ? xButtonAccessible : Reference< XAccessible >() );
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldChild, aNewChild );
+
+ return 1L;
+ }
+
+ //==================================================================================================================
+ //= MethodGuard
+ //==================================================================================================================
+ namespace
+ {
+ class MethodGuard
+ {
+ public:
+ MethodGuard( AccessibleToolPanelTabBar_Impl& i_rImpl )
+ :m_aGuard( Application::GetSolarMutex() )
+ {
+ i_rImpl.checkDisposed();
+ }
+ ~MethodGuard()
+ {
+ }
+
+ void clear()
+ {
+ m_aGuard.clear();
+ }
+
+ private:
+ ::vos::OClearableGuard m_aGuard;
+ };
+ }
+
+ //==================================================================================================================
+ //= AccessibleToolPanelTabBar
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelTabBar::AccessibleToolPanelTabBar( const Reference< XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar )
+ :AccessibleToolPanelTabBar_Base( i_rTabBar.GetWindowPeer() )
+ ,m_pImpl( new AccessibleToolPanelTabBar_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelTabBar::~AccessibleToolPanelTabBar()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleToolPanelTabBar::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+
+ const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible();
+ const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible();
+
+ return m_pImpl->getPanelDeck()->GetPanelCount()
+ + ( bHasScrollBack ? 1 : 0 )
+ + ( bHasScrollForward ? 1 : 0 );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleChild( sal_Int32 i_nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+
+ const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible();
+ const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible();
+
+ const bool bScrollBackRequested = ( bHasScrollBack && ( i_nIndex == 0 ) );
+ const bool bScrollForwardRequested = ( bHasScrollForward && ( i_nIndex == getAccessibleChildCount() - 1 ) );
+ OSL_ENSURE( !( bScrollBackRequested && bScrollForwardRequested ), "AccessibleToolPanelTabBar::getAccessibleChild: ouch!" );
+
+ if ( bScrollBackRequested || bScrollForwardRequested )
+ {
+ Reference< XAccessible > xScrollButtonAccessible( m_pImpl->getTabBar()->GetScrollButton( bScrollForwardRequested ).GetAccessible() );
+ ENSURE_OR_RETURN( xScrollButtonAccessible.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible!", NULL );
+ #if OSL_DEBUG_LEVEL > 0
+ Reference< XAccessibleContext > xScrollButtonContext( xScrollButtonAccessible->getAccessibleContext() );
+ ENSURE_OR_RETURN( xScrollButtonContext.is(), "AccessibleToolPanelTabBar::getAccessibleChild: invalid button accessible context!", xScrollButtonAccessible );
+ OSL_ENSURE( xScrollButtonContext->getAccessibleParent() == m_pImpl->getOwnAccessible(),
+ "AccessibleToolPanelTabBar::getAccessibleChild: wrong parent at the button's accesible!" );
+ #endif
+ return xScrollButtonAccessible;
+ }
+
+ return m_pImpl->getAccessiblePanelItem( i_nIndex - ( bHasScrollBack ? 1 : 0 ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleParent( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getAccessibleParent();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int16 SAL_CALL AccessibleToolPanelTabBar::getAccessibleRole( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+ return AccessibleRole::PAGE_TAB_LIST;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ bool lcl_covers( const ::Window& i_rWindow, const ::Point& i_rPoint )
+ {
+ const Rectangle aWindowBounds( i_rWindow.GetWindowExtentsRelative( i_rWindow.GetParent() ) );
+ return aWindowBounds.IsInside( i_rPoint );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelTabBar::getAccessibleAtPoint( const UnoPoint& i_rPoint ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *m_pImpl );
+
+ // check the tab items
+ const UnoPoint aOwnScreenPos( getLocationOnScreen() );
+ const ::Point aRequestedScreenPoint( i_rPoint.X + aOwnScreenPos.X, i_rPoint.Y + aOwnScreenPos.Y );
+
+ for ( size_t i=0; i<m_pImpl->getPanelDeck()->GetPanelCount(); ++i )
+ {
+ const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect(i) );
+ if ( aItemScreenRect.IsInside( aRequestedScreenPoint ) )
+ return m_pImpl->getAccessiblePanelItem(i);
+ }
+
+ // check the scroll buttons
+ const ::Point aRequestedClientPoint( VCLUnoHelper::ConvertToVCLPoint( i_rPoint ) );
+
+ const bool bHasScrollBack = m_pImpl->getTabBar()->GetScrollButton( false ).IsVisible();
+ if ( bHasScrollBack && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( false ), aRequestedClientPoint ) )
+ return m_pImpl->getTabBar()->GetScrollButton( false ).GetAccessible();
+
+ const bool bHasScrollForward = m_pImpl->getTabBar()->GetScrollButton( true ).IsVisible();
+ if ( bHasScrollForward && lcl_covers( m_pImpl->getTabBar()->GetScrollButton( true ), aRequestedClientPoint ) )
+ return m_pImpl->getTabBar()->GetScrollButton( true ).GetAccessible();
+
+ // no hit
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AccessibleToolPanelTabBar::disposing()
+ {
+ AccessibleToolPanelTabBar_Base::disposing();
+ m_pImpl->dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleToolPanelTabBar::GetChildAccessible( const VclWindowEvent& i_rVclWindowEvent )
+ {
+ // don't let the base class generate any A11Y events from VclWindowEvent, we completely manage those
+ // A11Y events ourself
+ (void)i_rVclWindowEvent;
+ return NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelTabBar::FillAccessibleStateSet( ::utl::AccessibleStateSetHelper& i_rStateSet )
+ {
+ AccessibleToolPanelTabBar_Base::FillAccessibleStateSet( i_rStateSet );
+ i_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ ENSURE_OR_RETURN_VOID( !m_pImpl->isDisposed(), "AccessibleToolPanelTabBar::FillAccessibleStateSet: already disposed!" );
+ if ( m_pImpl->getTabBar()->IsVertical() )
+ i_rStateSet.AddState( AccessibleStateType::VERTICAL );
+ else
+ i_rStateSet.AddState( AccessibleStateType::HORIZONTAL );
+ }
+
+//......................................................................................................................
+} // namespace accessibility
+//......................................................................................................................
diff --git a/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
new file mode 100644
index 000000000000..0cdfd8480457
--- /dev/null
+++ b/accessibility/source/extended/AccessibleToolPanelDeckTabBarItem.cxx
@@ -0,0 +1,455 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_accessibility.hxx"
+
+#include "accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <svtools/toolpanel/toolpaneldeck.hxx>
+#include <svtools/toolpanel/paneltabbar.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+
+//......................................................................................................................
+namespace accessibility
+{
+//......................................................................................................................
+
+ typedef ::com::sun::star::awt::Rectangle UnoRectangle;
+ typedef ::com::sun::star::awt::Point UnoPoint;
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::accessibility::XAccessible;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::accessibility::XAccessibleRelationSet;
+ using ::com::sun::star::accessibility::XAccessibleStateSet;
+ using ::com::sun::star::accessibility::XAccessibleComponent;
+ using ::com::sun::star::accessibility::XAccessibleExtendedComponent;
+ using ::com::sun::star::awt::XFont;
+ /** === end UNO using === **/
+
+ namespace AccessibleRole = ::com::sun::star::accessibility::AccessibleRole;
+ namespace AccessibleStateType = ::com::sun::star::accessibility::AccessibleStateType;
+ namespace AccessibleEventId = ::com::sun::star::accessibility::AccessibleEventId;
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeckTabBarItem_Impl
+ //==================================================================================================================
+ class AccessibleToolPanelDeckTabBarItem_Impl : public ::svt::IToolPanelDeckListener
+ {
+ public:
+ AccessibleToolPanelDeckTabBarItem_Impl(
+ AccessibleToolPanelDeckTabBarItem& i_rAntiImpl,
+ const Reference< XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar,
+ const size_t i_nItemPos
+ );
+ ~AccessibleToolPanelDeckTabBarItem_Impl();
+
+ ::svt::PanelTabBar* getTabBar() const { return m_pTabBar; }
+
+ // IToolPanelDeckListener
+ virtual void PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition );
+ virtual void PanelRemoved( const size_t i_nPosition );
+ virtual void ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive );
+ virtual void LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter );
+ virtual void Dying();
+
+ public:
+ bool isDisposed() const { return m_pPanelDeck == NULL; }
+ void checkDisposed() const;
+ void dispose();
+
+ const Reference< XAccessible >&
+ getAccessibleParent() const { return m_xAccessibleParent; }
+ size_t getItemPos() const { return m_nItemPos; }
+
+ Reference< XAccessibleComponent > getParentAccessibleComponent() const;
+ ::svt::IToolPanelDeck* getPanelDeck() const { return m_pPanelDeck; }
+ ::rtl::OUString getPanelDisplayName();
+
+ private:
+ void impl_notifyBoundRectChanges();
+ void impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState );
+
+ private:
+ AccessibleToolPanelDeckTabBarItem& m_rAntiImpl;
+ Reference< XAccessible > m_xAccessibleParent;
+ ::svt::IToolPanelDeck* m_pPanelDeck;
+ ::svt::PanelTabBar* m_pTabBar;
+ size_t m_nItemPos;
+ };
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeckTabBarItem_Impl
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeckTabBarItem_Impl::AccessibleToolPanelDeckTabBarItem_Impl( AccessibleToolPanelDeckTabBarItem& i_rAntiImpl,
+ const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar,
+ const size_t i_nItemPos )
+ :m_rAntiImpl( i_rAntiImpl )
+ ,m_xAccessibleParent( i_rAccessibleParent )
+ ,m_pPanelDeck( &i_rPanelDeck )
+ ,m_pTabBar( &i_rTabBar )
+ ,m_nItemPos( i_nItemPos )
+ {
+ m_pPanelDeck->AddListener( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeckTabBarItem_Impl::~AccessibleToolPanelDeckTabBarItem_Impl()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::checkDisposed() const
+ {
+ if ( isDisposed() )
+ throw DisposedException( ::rtl::OUString(), *&m_rAntiImpl );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::dispose()
+ {
+ ENSURE_OR_RETURN_VOID( !isDisposed(), "AccessibleToolPanelDeckTabBarItem_Impl::dispose: disposed twice!" );
+
+ m_xAccessibleParent.clear();
+ m_pPanelDeck->RemoveListener( *this );
+ m_pPanelDeck = NULL;
+ m_pTabBar = NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XAccessibleComponent > AccessibleToolPanelDeckTabBarItem_Impl::getParentAccessibleComponent() const
+ {
+ Reference< XAccessible > xAccessibleParent( m_rAntiImpl.getAccessibleParent(), UNO_QUERY_THROW );
+ return Reference< XAccessibleComponent >( xAccessibleParent->getAccessibleContext(), UNO_QUERY );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString AccessibleToolPanelDeckTabBarItem_Impl::getPanelDisplayName()
+ {
+ const ::svt::PToolPanel pPanel( m_pPanelDeck->GetPanel( getItemPos() ) );
+ if ( pPanel.get() == NULL )
+ throw DisposedException();
+ return pPanel->GetDisplayName();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyBoundRectChanges()
+ {
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::BOUNDRECT_CHANGED, Any(), Any() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::impl_notifyStateChange( const sal_Int16 i_nLostState, const sal_Int16 i_nGainedState )
+ {
+ m_rAntiImpl.NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED,
+ i_nLostState > -1 ? makeAny( i_nLostState ) : Any(),
+ i_nGainedState > -1 ? makeAny( i_nGainedState ) : Any()
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::PanelInserted( const ::svt::PToolPanel& i_pPanel, const size_t i_nPosition )
+ {
+ (void)i_pPanel;
+ if ( i_nPosition <= m_nItemPos )
+ ++m_nItemPos;
+ impl_notifyBoundRectChanges();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::PanelRemoved( const size_t i_nPosition )
+ {
+ if ( i_nPosition == m_nItemPos )
+ {
+ m_rAntiImpl.dispose();
+ }
+ else if ( i_nPosition < m_nItemPos )
+ {
+ --m_nItemPos;
+ impl_notifyBoundRectChanges();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::ActivePanelChanged( const ::boost::optional< size_t >& i_rOldActive, const ::boost::optional< size_t >& i_rNewActive )
+ {
+ if ( m_nItemPos == i_rOldActive )
+ {
+ impl_notifyStateChange( AccessibleStateType::ACTIVE, -1 );
+ impl_notifyStateChange( AccessibleStateType::SELECTED, -1 );
+ }
+ else if ( m_nItemPos == i_rNewActive )
+ {
+ impl_notifyStateChange( -1, AccessibleStateType::ACTIVE );
+ impl_notifyStateChange( -1, AccessibleStateType::SELECTED );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::LayouterChanged( const ::svt::PDeckLayouter& i_rNewLayouter )
+ {
+ (void)i_rNewLayouter;
+ // if the tool panel deck has a new layouter, then the old layouter, and thus all items it was
+ // responsible for, died. So do we.
+ dispose();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AccessibleToolPanelDeckTabBarItem_Impl::Dying()
+ {
+ // if the tool panel deck is dying, then its layouter dies, so should we.
+ dispose();
+ }
+
+ //==================================================================================================================
+ //= ItemMethodGuard
+ //==================================================================================================================
+ class ItemMethodGuard
+ {
+ public:
+ ItemMethodGuard( AccessibleToolPanelDeckTabBarItem_Impl& i_rImpl )
+ :m_aGuard( Application::GetSolarMutex() )
+ {
+ i_rImpl.checkDisposed();
+ }
+ ~ItemMethodGuard()
+ {
+ }
+
+ void clear()
+ {
+ m_aGuard.clear();
+ }
+
+ private:
+ ::vos::OClearableGuard m_aGuard;
+ };
+
+ //==================================================================================================================
+ //= AccessibleToolPanelDeckTabBarItem
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeckTabBarItem::AccessibleToolPanelDeckTabBarItem( const Reference< XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar, const size_t i_nItemPos )
+ :m_pImpl( new AccessibleToolPanelDeckTabBarItem_Impl( *this, i_rAccessibleParent, i_rPanelDeck, i_rTabBar, i_nItemPos ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AccessibleToolPanelDeckTabBarItem::~AccessibleToolPanelDeckTabBarItem()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ return 0;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ (void)i;
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleParent( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getAccessibleParent();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRole( ) throw (RuntimeException)
+ {
+ return AccessibleRole::PAGE_TAB;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getPanelDisplayName();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleName( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getPanelDisplayName();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleRelationSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleRelationSet( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ ::utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper;
+ return pRelationSet;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleStateSet > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleStateSet( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+
+ ::utl::AccessibleStateSetHelper* pStateSet( new ::utl::AccessibleStateSetHelper );
+ pStateSet->AddState( AccessibleStateType::FOCUSABLE );
+ pStateSet->AddState( AccessibleStateType::SELECTABLE );
+ pStateSet->AddState( AccessibleStateType::ICONIFIED );
+
+ if ( m_pImpl->getItemPos() == m_pImpl->getPanelDeck()->GetActivePanel() )
+ {
+ pStateSet->AddState( AccessibleStateType::ACTIVE );
+ pStateSet->AddState( AccessibleStateType::SELECTED );
+ }
+
+ if ( m_pImpl->getItemPos() == m_pImpl->getTabBar()->GetFocusedPanelItem() )
+ pStateSet->AddState( AccessibleStateType::FOCUSED );
+
+ if ( m_pImpl->getTabBar()->IsEnabled() )
+ pStateSet->AddState( AccessibleStateType::ENABLED );
+
+ if ( m_pImpl->getTabBar()->IsVisible() )
+ {
+ pStateSet->AddState( AccessibleStateType::SHOWING );
+ pStateSet->AddState( AccessibleStateType::VISIBLE );
+ }
+
+ return pStateSet;
+ }
+
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleToolPanelDeckTabBarItem::getAccessibleAtPoint( const UnoPoint& i_rLocation ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ // we do not have children ...
+ (void)i_rLocation;
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL AccessibleToolPanelDeckTabBarItem::grabFocus( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ m_pImpl->getTabBar()->FocusPanelItem( m_pImpl->getItemPos() );
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getForeground( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW );
+ return xParentComponent->getForeground();
+ }
+
+ //--------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL AccessibleToolPanelDeckTabBarItem::getBackground( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW );
+ return xParentComponent->getBackground();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XFont > SAL_CALL AccessibleToolPanelDeckTabBarItem::getFont( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ Reference< XAccessibleExtendedComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_QUERY_THROW );
+ // TODO: strictly, this is not correct: The TabBar implementation of the TabLayouter might use
+ // a different font ...
+ return xParentComponent->getFont();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getTitledBorderText( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ // no support
+ return ::rtl::OUString();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleToolPanelDeckTabBarItem::getToolTipText( ) throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->getPanelDisplayName();
+ }
+
+ //--------------------------------------------------------------------
+ UnoRectangle SAL_CALL AccessibleToolPanelDeckTabBarItem::implGetBounds() throw (RuntimeException)
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+
+ const ::Rectangle aItemScreenRect( m_pImpl->getTabBar()->GetItemScreenRect( m_pImpl->getItemPos() ) );
+
+ Reference< XAccessibleComponent > xParentComponent( m_pImpl->getParentAccessibleComponent(), UNO_SET_THROW );
+ const UnoPoint aParentLocation( xParentComponent->getLocationOnScreen() );
+ return UnoRectangle(
+ aItemScreenRect.Left() - aParentLocation.X,
+ aItemScreenRect.Top() - aParentLocation.Y,
+ aItemScreenRect.GetWidth(),
+ aItemScreenRect.GetHeight()
+ );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL AccessibleToolPanelDeckTabBarItem::disposing()
+ {
+ ItemMethodGuard aGuard( *m_pImpl );
+ m_pImpl->dispose();
+ }
+
+//......................................................................................................................
+} // namespace accessibility
+//......................................................................................................................
diff --git a/accessibility/source/extended/accessiblebrowseboxcell.cxx b/accessibility/source/extended/accessiblebrowseboxcell.cxx
new file mode 100644
index 000000000000..87e47d83c600
--- /dev/null
+++ b/accessibility/source/extended/accessiblebrowseboxcell.cxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include "accessibility/extended/accessiblebrowseboxcell.hxx"
+#include <svtools/accessibletableprovider.hxx>
+
+// .................................................................................
+namespace accessibility
+{
+// .................................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::svt;
+
+ // =============================================================================
+ // = AccessibleBrowseBoxCell
+ // =============================================================================
+ DBG_NAME( svt_AccessibleBrowseBoxCell )
+ // -----------------------------------------------------------------------------
+ AccessibleBrowseBoxCell::AccessibleBrowseBoxCell(
+ const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox,
+ const Reference< XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleBrowseBoxObjType _eType )
+ :AccessibleBrowseBoxBase( _rxParent, _rBrowseBox, _xFocusWindow, _eType )
+ ,m_nRowPos( _nRowPos )
+ ,m_nColPos( _nColPos )
+ {
+ DBG_CTOR( svt_AccessibleBrowseBoxCell, NULL );
+ // set accessible name here, because for that we need the position of the cell
+ // and so the base class isn't capable of doing this
+ sal_Int32 nPos = _nRowPos * _rBrowseBox.GetColumnCount() + _nColPos;
+ ::rtl::OUString aAccName = _rBrowseBox.GetAccessibleObjectName( BBTYPE_TABLECELL, nPos );
+ implSetName( aAccName );
+ }
+
+ // -----------------------------------------------------------------------------
+ AccessibleBrowseBoxCell::~AccessibleBrowseBoxCell()
+ {
+ DBG_DTOR( svt_AccessibleBrowseBoxCell, NULL );
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleBrowseBoxCell::grabFocus() throw ( RuntimeException )
+ {
+ SolarMethodGuard aGuard( *this );
+ mpBrowseBox->GoToCell( m_nRowPos, m_nColPos );
+ }
+ // -----------------------------------------------------------------------------
+ ::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox()
+ {
+ return mpBrowseBox->GetFieldRectPixelAbs( m_nRowPos, m_nColPos, sal_False, sal_False );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::Rectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen()
+ {
+ return mpBrowseBox->GetFieldRectPixelAbs( m_nRowPos, m_nColPos, sal_False );
+ }
+
+// .................................................................................
+} // namespace accessibility
+// .................................................................................
+
+
diff --git a/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
new file mode 100644
index 000000000000..5f5472d04050
--- /dev/null
+++ b/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/extended/accessibleeditbrowseboxcell.hxx>
+#include <svtools/editbrowsebox.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+
+// .................................................................................
+namespace accessibility
+{
+// .................................................................................
+
+ using namespace com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::awt;
+ using namespace ::comphelper;
+ using namespace ::svt;
+
+ DBG_NAME( acc_EditBrowseBoxTableCell )
+ // -----------------------------------------------------------------------------
+ EditBrowseBoxTableCell::EditBrowseBoxTableCell(
+ const com::sun::star::uno::Reference< XAccessible >& _rxParent,
+ const com::sun::star::uno::Reference< XAccessible >& _rxOwningAccessible,
+ const com::sun::star::uno::Reference< XAccessibleContext >& _xControlChild,
+ IAccessibleTableProvider& _rBrowseBox,
+ const Reference< XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos)
+ :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos )
+ ,OAccessibleContextWrapperHelper( ::comphelper::getProcessServiceFactory(), rBHelper, _xControlChild, _rxOwningAccessible, _rxParent )
+ {
+ DBG_CTOR( acc_EditBrowseBoxTableCell, NULL );
+
+ aggregateProxy( m_refCount, *this );
+ }
+
+ // -----------------------------------------------------------------------------
+ EditBrowseBoxTableCell::~EditBrowseBoxTableCell()
+ {
+ if ( !rBHelper.bDisposed )
+ {
+ acquire(); // to prevent duplicate dtor calls
+ dispose();
+ }
+
+ DBG_DTOR( acc_EditBrowseBoxTableCell, NULL );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getImplementationName() throw ( ::com::sun::star::uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.svtools.TableCellProxy" ) );
+ }
+
+ // -----------------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper )
+
+ // -----------------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper )
+
+ // -----------------------------------------------------------------------------
+ void EditBrowseBoxTableCell::notifyTranslatedEvent( const AccessibleEventObject& _rEvent ) throw (RuntimeException)
+ {
+ commitEvent( _rEvent.EventId, _rEvent.NewValue, _rEvent.OldValue );
+ }
+
+ // XAccessibleComponent
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL EditBrowseBoxTableCell::getForeground( ) throw (RuntimeException)
+ {
+ SolarMethodGuard aGuard( *this );
+ Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
+ if ( xAccComp.is() )
+ return xAccComp->getForeground();
+ return 0;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL EditBrowseBoxTableCell::getBackground( ) throw (RuntimeException)
+ {
+ SolarMethodGuard aGuard( *this );
+ Reference< XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY );
+ if ( xAccComp.is() )
+ return xAccComp->getBackground();
+ return 0;
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleParent( ) throw (RuntimeException)
+ {
+ return m_xParentAccessible;
+ }
+
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleDescription() throw ( RuntimeException )
+ {
+ SolarMethodGuard aGuard( *this );
+ return m_xInnerContext->getAccessibleDescription();
+ }
+
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleName() throw ( RuntimeException )
+ {
+ SolarMethodGuard aGuard( *this );
+
+ // TODO: localize this!
+ String sName = mpBrowseBox->GetColumnDescription( ::sal::static_int_cast< sal_uInt16 >( getColumnPos() ) );
+ if ( 0 == sName.Len() )
+ {
+ sName = String::CreateFromAscii( "Column " );
+ sName += String::CreateFromInt32( getColumnPos( ) );
+ }
+
+ sName += String::CreateFromAscii( ", Row " );
+ sName += String::CreateFromInt32( getRowPos( ) );
+
+ return ::rtl::OUString( sName );
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() throw ( RuntimeException )
+ {
+ SolarMethodGuard aGuard( *this );
+ return OAccessibleContextWrapperHelper::getAccessibleRelationSet( );
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference<XAccessibleStateSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleStateSet() throw ( RuntimeException )
+ {
+ SolarMethodGuard aGuard( *this );
+ return m_xInnerContext->getAccessibleStateSet();
+ // TODO: shouldn't we add an ACTIVE here? Isn't the EditBrowseBoxTableCell always ACTIVE?
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL EditBrowseBoxTableCell::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ SolarMethodGuard aGuard( *this );
+ return OAccessibleContextWrapperHelper::getAccessibleChildCount();
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, RuntimeException)
+ {
+ SolarMethodGuard aGuard( *this );
+ return OAccessibleContextWrapperHelper::getAccessibleChild( i );
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Int16 SAL_CALL EditBrowseBoxTableCell::getAccessibleRole() throw ( RuntimeException )
+ {
+ SolarMethodGuard aGuard( *this );
+ return m_xInnerContext->getAccessibleRole( );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL EditBrowseBoxTableCell::dispose() throw( RuntimeException )
+ {
+ // simply disambiguate. Note that the OComponentHelper base in AccessibleBrowseBoxCell
+ // will call our "disposing()", which will call "dispose()" on the OAccessibleContextWrapperHelper
+ // so there is no need to do this here.
+ AccessibleBrowseBoxCell::dispose();
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL EditBrowseBoxTableCell::disposing( const EventObject& _rSource ) throw (RuntimeException)
+ {
+ AccessibleBrowseBoxCell::disposing( _rSource );
+ OAccessibleContextWrapperHelper::disposing( _rSource );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL EditBrowseBoxTableCell::disposing()
+ {
+ SolarMethodGuard aGuard( *this, false );
+ OAccessibleContextWrapperHelper::dispose();
+ // TODO: do we need to dispose our inner object? The base class does this, but is it a good idea?
+ AccessibleBrowseBoxCell::disposing();
+ }
+ // =============================================================================
+ // = EditBrowseBoxTableCell
+ // =============================================================================
+ DBG_NAME( EditBrowseBoxTableCellAccess )
+ // -----------------------------------------------------------------------------
+ EditBrowseBoxTableCellAccess::EditBrowseBoxTableCellAccess(
+ const Reference< XAccessible >& _rxParent, const Reference< XAccessible > _rxControlAccessible,
+ const Reference< XWindow >& _rxFocusWindow,
+ IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos )
+ :EditBrowseBoxTableCellAccess_Base( m_aMutex )
+ ,m_xParent( _rxParent )
+ ,m_xControlAccessible( _rxControlAccessible )
+ ,m_xFocusWindow( _rxFocusWindow )
+ ,m_pBrowseBox( &_rBrowseBox )
+ ,m_nRowPos( _nRowPos )
+ ,m_nColPos( _nColPos )
+ {
+ DBG_CTOR( EditBrowseBoxTableCellAccess, NULL );
+ }
+ // -----------------------------------------------------------------------------
+ EditBrowseBoxTableCellAccess::~EditBrowseBoxTableCellAccess( )
+ {
+ DBG_DTOR( EditBrowseBoxTableCellAccess, NULL );
+ }
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > SAL_CALL EditBrowseBoxTableCellAccess::getAccessibleContext( ) throw (RuntimeException)
+ {
+ if ( !m_pBrowseBox || !m_xControlAccessible.is() )
+ throw DisposedException();
+ Reference< XAccessibleContext > xMyContext( m_aContext );
+ if ( !xMyContext.is() )
+ {
+ Reference< XAccessibleContext > xInnerContext = m_xControlAccessible->getAccessibleContext();
+ Reference< XAccessible > xMe( this );
+
+ xMyContext = new EditBrowseBoxTableCell( m_xParent, xMe, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos );
+ m_aContext = xMyContext;
+ }
+ return xMyContext;
+ }
+ //--------------------------------------------------------------------
+ void SAL_CALL EditBrowseBoxTableCellAccess::disposing()
+ {
+ // dispose our context, if it still alive
+ Reference< XComponent > xMyContext( (Reference< XAccessibleContext >)m_aContext, UNO_QUERY );
+ if ( xMyContext.is() )
+ {
+ try
+ {
+ xMyContext->dispose();
+ }
+ catch( const Exception& e )
+ {
+ (void)e;
+ OSL_ENSURE( false, "EditBrowseBoxTableCellAccess::disposing: caught an exception while disposing the context!" );
+ }
+ }
+
+ m_pBrowseBox = NULL;
+ m_xControlAccessible.clear();
+ m_aContext = Reference< XAccessibleContext >( );
+ // NO dispose of the inner object there: it is the XAccessible of an window, and disposing
+ // it would delete the respective VCL window
+ }
+// .................................................................................
+} // namespace accessibility
+// .................................................................................
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx
new file mode 100644
index 000000000000..3a98169c620a
--- /dev/null
+++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -0,0 +1,372 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include "accessibility/extended/accessibleiconchoicectrl.hxx"
+#include "accessibility/extended/accessibleiconchoicectrlentry.hxx"
+#include <svtools/ivctrl.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ // class AccessibleIconChoiceCtrl ----------------------------------------------
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+
+ DBG_NAME(AccessibleIconChoiceCtrl)
+
+ // -----------------------------------------------------------------------------
+ // Ctor() and Dtor()
+ // -----------------------------------------------------------------------------
+ AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl( SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) :
+
+ VCLXAccessibleComponent( _rIconCtrl.GetWindowPeer() ),
+ m_xParent ( _xParent )
+ {
+ DBG_CTOR( AccessibleIconChoiceCtrl, NULL );
+ }
+ // -----------------------------------------------------------------------------
+ AccessibleIconChoiceCtrl::~AccessibleIconChoiceCtrl()
+ {
+ DBG_DTOR( AccessibleIconChoiceCtrl, NULL );
+ }
+ // -----------------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2(AccessibleIconChoiceCtrl, VCLXAccessibleComponent, AccessibleIconChoiceCtrl_BASE)
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleIconChoiceCtrl, VCLXAccessibleComponent, AccessibleIconChoiceCtrl_BASE)
+ // -----------------------------------------------------------------------------
+ void AccessibleIconChoiceCtrl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+ {
+ if ( isAlive() )
+ {
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_LISTBOX_SELECT :
+ {
+ // First send an event that tells the listeners of a
+ // modified selection. The active descendant event is
+ // send after that so that the receiving AT has time to
+ // read the text or name of the active child.
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ if ( pCtrl && pCtrl->HasFocus() )
+ {
+ SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ sal_uLong nPos = pCtrl->GetEntryListPos( pEntry );
+ Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, nPos, this );
+ uno::Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+ }
+ default:
+ VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent);
+ }
+ }
+ }
+ // -----------------------------------------------------------------------------
+ // XComponent
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrl::disposing()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ m_xParent = NULL;
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrl::getImplementationName() throw (RuntimeException)
+ {
+ return getImplementationName_Static();
+ }
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AccessibleIconChoiceCtrl::getSupportedServiceNames() throw (RuntimeException)
+ {
+ return getSupportedServiceNames_Static();
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrl::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported )
+ ;
+
+ return pSupported != pEnd;
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo - static methods
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > AccessibleIconChoiceCtrl::getSupportedServiceNames_Static(void) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aSupported(3);
+ aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") );
+ aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") );
+ aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleIconChoiceControl") );
+ return aSupported;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString AccessibleIconChoiceCtrl::getImplementationName_Static(void) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleIconChoiceControl") );
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessible
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleContext( ) throw (RuntimeException)
+ {
+ ensureAlive();
+ return this;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+ return getCtrl()->GetEntryCount();
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChild( sal_Int32 i ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry(i);
+ if ( !pEntry )
+ throw RuntimeException();
+
+ return new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this );
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleParent( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ensureAlive();
+ return m_xParent;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int16 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleRole( ) throw (RuntimeException)
+ {
+ return AccessibleRole::TREE;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+ return getCtrl()->GetAccessibleDescription();
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleName( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ ::rtl::OUString sName = getCtrl()->GetAccessibleName();
+ if ( sName.getLength() == 0 )
+ sName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconChoiceControl" ) );
+ return sName;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleSelection
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ pCtrl->SetCursor( pEntry );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ return ( pCtrl->GetCursor() == pEntry );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrl::clearAccessibleSelection( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+ getCtrl()->SetNoSelection();
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrl::selectAllAccessibleChildren( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ sal_Int32 i, nCount = 0;
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ nCount = pCtrl->GetEntryCount();
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
+ if ( pCtrl->GetCursor() != pEntry )
+ pCtrl->SetCursor( pEntry );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ sal_Int32 i, nSelCount = 0, nCount = 0;
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ nCount = pCtrl->GetEntryCount();
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
+ if ( pCtrl->GetCursor() == pEntry )
+ ++nSelCount;
+ }
+
+ return nSelCount;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 i, nSelCount = 0, nCount = 0;
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ nCount = pCtrl->GetEntryCount();
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
+ if ( pCtrl->GetCursor() == pEntry )
+ ++nSelCount;
+
+ if ( nSelCount == ( nSelectedChildIndex + 1 ) )
+ {
+ xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this );
+ break;
+ }
+ }
+
+ return xChild;
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrl::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 i, nSelCount = 0, nCount = 0;
+ SvtIconChoiceCtrl* pCtrl = getCtrl();
+ nCount = pCtrl->GetEntryCount();
+ bool bFound = false;
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i );
+ if ( pEntry->IsSelected() )
+ {
+ ++nSelCount;
+ if ( i == nSelectedChildIndex )
+ bFound = true;
+ }
+ }
+
+ // if only one entry is selected and its index is choosen to deselect -> no selection anymore
+ if ( 1 == nSelCount && bFound )
+ pCtrl->SetNoSelection();
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleIconChoiceCtrl::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+ {
+ VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+ if ( isAlive() )
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ rStateSet.AddState( AccessibleStateType::SELECTABLE );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ SvtIconChoiceCtrl* AccessibleIconChoiceCtrl::getCtrl()
+ {
+ return static_cast<SvtIconChoiceCtrl*>(GetWindow());
+ }
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
new file mode 100644
index 000000000000..e910b503ad1c
--- /dev/null
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -0,0 +1,756 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/extended/accessibleiconchoicectrlentry.hxx>
+#include <svtools/ivctrl.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/controllayout.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <svtools/stringtransfer.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+
+#define ACCESSIBLE_ACTION_COUNT 1
+#define AID_EXPAND 0
+#define AID_COLLAPSE 1
+
+namespace
+{
+ void checkActionIndex_Impl( sal_Int32 _nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ {
+ if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT )
+ // only three actions
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+}
+
+//........................................................................
+namespace accessibility
+{
+ //........................................................................
+ // class ALBSolarGuard ---------------------------------------------------------
+
+ /** Aquire the solar mutex. */
+ class ALBSolarGuard : public ::vos::OGuard
+ {
+ public:
+ inline ALBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
+ };
+
+ // class AccessibleIconChoiceCtrlEntry -----------------------------------------------------
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+
+ DBG_NAME(AccessibleIconChoiceCtrlEntry)
+
+ // -----------------------------------------------------------------------------
+ // Ctor() and Dtor()
+ // -----------------------------------------------------------------------------
+ AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl,
+ sal_uLong _nPos,
+ const Reference< XAccessible >& _xParent ) :
+
+ AccessibleIconChoiceCtrlEntry_BASE ( m_aMutex ),
+
+ m_pIconCtrl ( &_rIconCtrl ),
+ m_nIndex ( _nPos ),
+ m_nClientId ( 0 ),
+ m_xParent ( _xParent )
+
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ Reference< XComponent > xComp( m_xParent, UNO_QUERY );
+ if ( xComp.is() )
+ xComp->addEventListener( this );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+
+ DBG_CTOR( AccessibleIconChoiceCtrlEntry, NULL );
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleIconChoiceCtrlEntry::disposing( const EventObject& _rSource )
+throw(RuntimeException)
+ {
+ if ( _rSource.Source == m_xParent )
+ {
+ dispose();
+ DBG_ASSERT( !m_xParent.is() && ( NULL == m_pIconCtrl ), "" );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry()
+ {
+ DBG_DTOR( AccessibleIconChoiceCtrlEntry, NULL );
+
+ if ( IsAlive_Impl() )
+ {
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+ }
+ #ifdef ACCESSIBLE_EVENT_NOTIFICATION_ENABLED
+ // (the following method is unused currently. If you need it, simply remove the #ifdef thing here and
+ // in the hxx)
+ // -----------------------------------------------------------------------------
+ void AccessibleIconChoiceCtrlEntry::NotifyAccessibleEvent( sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _aOldValue,
+ const ::com::sun::star::uno::Any& _aNewValue )
+ {
+ Reference< uno::XInterface > xSource( *this );
+ AccessibleEventObject aEventObj( xSource, _nEventId, _aNewValue, _aOldValue );
+
+ if (m_nClientId)
+ comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEventObj );
+ }
+ #endif
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const
+ {
+ Rectangle aRect;
+ SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex );
+ if ( pEntry )
+ aRect = m_pIconCtrl->GetBoundingBox( pEntry );
+
+ return aRect;
+ }
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const
+ {
+ Rectangle aRect;
+ SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex );
+ if ( pEntry )
+ {
+ aRect = m_pIconCtrl->GetBoundingBox( pEntry );
+ Point aTopLeft = aRect.TopLeft();
+ aTopLeft += m_pIconCtrl->GetWindowExtentsRelative( NULL ).TopLeft();
+ aRect = Rectangle( aTopLeft, aRect.GetSize() );
+ }
+
+ return aRect;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const
+ {
+ return ( !rBHelper.bDisposed && !rBHelper.bInDispose && m_pIconCtrl );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const
+ {
+ sal_Bool bShowing = sal_False;
+ Reference< XAccessibleContext > m_xParentContext =
+ m_xParent.is() ? m_xParent->getAccessibleContext() : Reference< XAccessibleContext >();
+ if( m_xParentContext.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( m_xParentContext, uno::UNO_QUERY );
+ if( xParentComp.is() )
+ bShowing = GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp->getBounds() ) );
+ }
+
+ return bShowing;
+ }
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox() throw ( lang::DisposedException )
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ return GetBoundingBox_Impl();
+ }
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException )
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ return GetBoundingBoxOnScreen_Impl();
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const throw ( lang::DisposedException )
+ {
+ if ( !IsAlive_Impl() )
+ throw lang::DisposedException();
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString AccessibleIconChoiceCtrlEntry::implGetText()
+ {
+ ::rtl::OUString sRet;
+ SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex );
+ if ( pEntry )
+ sRet = pEntry->GetDisplayText();
+ return sRet;
+ }
+ // -----------------------------------------------------------------------------
+ Locale AccessibleIconChoiceCtrlEntry::implGetLocale()
+ {
+ Locale aLocale;
+ aLocale = Application::GetSettings().GetUILocale();
+
+ return aLocale;
+ }
+ void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+ {
+ nStartIndex = 0;
+ nEndIndex = 0;
+ }
+ // -----------------------------------------------------------------------------
+ // XTypeProvider
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ Sequence< sal_Int8 > AccessibleIconChoiceCtrlEntry::getImplementationId() throw (RuntimeException)
+ {
+ static ::cppu::OImplementationId* pId = NULL;
+
+ if ( !pId )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+
+ if ( !pId )
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+ }
+ // -----------------------------------------------------------------------------
+ // XComponent
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrlEntry::disposing()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // Send a disposing to all listeners.
+ if ( m_nClientId )
+ {
+ sal_uInt32 nId = m_nClientId;
+ m_nClientId = 0;
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
+ }
+
+ Reference< XComponent > xComp( m_xParent, UNO_QUERY );
+ if ( xComp.is() )
+ xComp->removeEventListener( this );
+
+ m_pIconCtrl = NULL;
+ m_xParent = NULL;
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getImplementationName() throw(RuntimeException)
+ {
+ return getImplementationName_Static();
+ }
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return getSupportedServiceNames_Static();
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported )
+ ;
+
+ return pSupported != pEnd;
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo - static methods
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > AccessibleIconChoiceCtrlEntry::getSupportedServiceNames_Static(void) throw( RuntimeException )
+ {
+ Sequence< ::rtl::OUString > aSupported(3);
+ aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") );
+ aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") );
+ aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleIconChoiceControlEntry") );
+ return aSupported;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString AccessibleIconChoiceCtrlEntry::getImplementationName_Static(void) throw( RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry") );
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessible
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleContext( ) throw (RuntimeException)
+ {
+ EnsureIsAlive();
+ return this;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ return 0; // no children
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException,RuntimeException)
+ {
+ throw IndexOutOfBoundsException();
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ return m_xParent;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return m_nIndex;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int16 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) throw (RuntimeException)
+ {
+ return AccessibleRole::LABEL;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ // no description for every item
+ return ::rtl::OUString();
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleName( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ return implGetText();
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleRelationSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) throw (RuntimeException)
+ {
+ return new utl::AccessibleRelationSetHelper;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleStateSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+
+ if ( IsAlive_Impl() )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ if ( IsShowing_Impl() )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ }
+
+ if ( m_pIconCtrl && m_pIconCtrl->GetCursor() == m_pIconCtrl->GetEntry( m_nIndex ) )
+ pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return xStateSet;
+ }
+ // -----------------------------------------------------------------------------
+ Locale SAL_CALL AccessibleIconChoiceCtrlEntry::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return implGetLocale();
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleComponent
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::containsPoint( const awt::Point& rPoint ) throw (RuntimeException)
+ {
+ return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+ {
+ return Reference< XAccessible >();
+ }
+ // -----------------------------------------------------------------------------
+ awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getBounds( ) throw (RuntimeException)
+ {
+ return AWTRectangle( GetBoundingBox() );
+ }
+ // -----------------------------------------------------------------------------
+ awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocation( ) throw (RuntimeException)
+ {
+ return AWTPoint( GetBoundingBox().TopLeft() );
+ }
+ // -----------------------------------------------------------------------------
+ awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) throw (RuntimeException)
+ {
+ return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
+ }
+ // -----------------------------------------------------------------------------
+ awt::Size SAL_CALL AccessibleIconChoiceCtrlEntry::getSize( ) throw (RuntimeException)
+ {
+ return AWTSize( GetBoundingBox().GetSize() );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrlEntry::grabFocus( ) throw (RuntimeException)
+ {
+ // do nothing, because no focus for each item
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 AccessibleIconChoiceCtrlEntry::getForeground( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getForeground();
+ }
+
+ return nColor;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 AccessibleIconChoiceCtrlEntry::getBackground( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getBackground();
+ }
+
+ return nColor;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleText
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( ( 0 > _nIndex ) || ( getCharacterCount() <= _nIndex ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( m_pIconCtrl )
+ {
+ Rectangle aItemRect = GetBoundingBox_Impl();
+ Rectangle aCharRect = m_pIconCtrl->GetEntryCharacterBounds( m_nIndex, _nIndex );
+ aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
+ aBounds = AWTRectangle( aCharRect );
+ }
+
+ return aBounds;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nIndex = -1;
+ if ( m_pIconCtrl )
+ {
+ ::vcl::ControlLayoutData aLayoutData;
+ Rectangle aItemRect = GetBoundingBox_Impl();
+ m_pIconCtrl->RecordLayoutData( &aLayoutData, aItemRect );
+ Point aPnt( VCLPoint( aPoint ) );
+ aPnt += aItemRect.TopLeft();
+ nIndex = aLayoutData.GetIndexForPoint( aPnt );
+
+ long nLen = aLayoutData.m_aUnicodeBoundRects.size();
+ for ( long i = 0; i < nLen; ++i )
+ {
+ Rectangle aRect = aLayoutData.GetCharacterBounds(i);
+ sal_Bool bInside = aRect.IsInside( aPnt );
+
+ if ( bInside )
+ break;
+ }
+ }
+
+ return nIndex;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ String sText = getText();
+ if ( ( 0 > nStartIndex ) || ( sText.Len() <= nStartIndex )
+ || ( 0 > nEndIndex ) || ( sText.Len() <= nEndIndex ) )
+ throw IndexOutOfBoundsException();
+
+ sal_Int32 nLen = nEndIndex - nStartIndex + 1;
+ ::svt::OStringTransfer::CopyString( sText.Copy( (sal_uInt16)nStartIndex, (sal_uInt16)nLen ), m_pIconCtrl );
+
+ return sal_True;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleEventBroadcaster
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrlEntry::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+ {
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_nClientId)
+ m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleIconChoiceCtrlEntry::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+ {
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ sal_Int32 nId = m_nClientId;
+ m_nClientId = 0;
+ comphelper::AccessibleEventNotifier::revokeClient( nId );
+ }
+ }
+ }
+
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return -1;
+ }
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ sal_Unicode SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getCharacter( nIndex );
+ }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >();
+ }
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getCharacterCount( );
+ }
+
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getSelectedText( );
+ }
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getSelectionStart( );
+ }
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getSelectionEnd( );
+ }
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getText( );
+ }
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleAction
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // three actions supported
+ return ACCESSIBLE_ACTION_COUNT;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Bool bRet = sal_False;
+ checkActionIndex_Impl( nIndex );
+ EnsureIsAlive();
+
+ SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex );
+ if ( pEntry && !pEntry->IsSelected() )
+ {
+ m_pIconCtrl->SetNoSelection();
+ m_pIconCtrl->SetCursor( pEntry );
+ bRet = sal_True;
+ }
+
+ return bRet;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkActionIndex_Impl( nIndex );
+ EnsureIsAlive();
+
+ static const ::rtl::OUString sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "Select" ) );
+ return sActionDesc;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleKeyBinding > AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XAccessibleKeyBinding > xRet;
+ checkActionIndex_Impl( nIndex );
+ // ... which key?
+ return xRet;
+ }
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
new file mode 100644
index 000000000000..b95643670985
--- /dev/null
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -0,0 +1,432 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/extended/accessiblelistbox.hxx>
+#include <accessibility/extended/accessiblelistboxentry.hxx>
+#include <svtools/svtreebx.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ // class AccessibleListBox -----------------------------------------------------
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+
+ DBG_NAME(AccessibleListBox)
+
+ // -----------------------------------------------------------------------------
+ // Ctor() and Dtor()
+ // -----------------------------------------------------------------------------
+ AccessibleListBox::AccessibleListBox( SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) :
+
+ VCLXAccessibleComponent( _rListBox.GetWindowPeer() ),
+ m_xParent( _xParent )
+ {
+ DBG_CTOR( AccessibleListBox, NULL );
+ }
+ // -----------------------------------------------------------------------------
+ AccessibleListBox::~AccessibleListBox()
+ {
+ DBG_DTOR( AccessibleListBox, NULL );
+ if ( isAlive() )
+ {
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+ }
+ IMPLEMENT_FORWARD_XINTERFACE2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE)
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleListBox, VCLXAccessibleComponent, AccessibleListBox_BASE)
+ // -----------------------------------------------------------------------------
+ SvTreeListBox* AccessibleListBox::getListBox() const
+ {
+ return static_cast< SvTreeListBox* >( const_cast<AccessibleListBox*>(this)->GetWindow() );
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+ {
+ if ( isAlive() )
+ {
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_CHECKBOX_TOGGLE :
+ {
+ if ( getListBox() && getListBox()->HasFocus() )
+ {
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( !pEntry )
+ pEntry = getListBox()->GetCurEntry();
+
+ if ( pEntry )
+ {
+ Reference< XAccessible > xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ uno::Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+ }
+
+ case VCLEVENT_LISTBOX_SELECT :
+ {
+ // First send an event that tells the listeners of a
+ // modified selection. The active descendant event is
+ // send after that so that the receiving AT has time to
+ // read the text or name of the active child.
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ if ( getListBox() && getListBox()->HasFocus() )
+ {
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ Reference< XAccessible > xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ uno::Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+
+ // --> OD 2009-04-01 #i92103#
+ case VCLEVENT_ITEM_EXPANDED :
+ case VCLEVENT_ITEM_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_ITEM_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);
+ }
+ }
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleListBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
+ {
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ }
+ break;
+ default:
+ {
+ VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent );
+ }
+ break;
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ // XComponent
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBox::disposing()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ VCLXAccessibleComponent::disposing();
+ m_xParent = NULL;
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleListBox::getImplementationName() throw(RuntimeException)
+ {
+ return getImplementationName_Static();
+ }
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AccessibleListBox::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return getSupportedServiceNames_Static();
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleListBox::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported )
+ ;
+
+ return pSupported != pEnd;
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo - static methods
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > AccessibleListBox::getSupportedServiceNames_Static(void) throw( RuntimeException )
+ {
+ Sequence< ::rtl::OUString > aSupported(3);
+ aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") );
+ aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") );
+ aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleTreeListBox") );
+ return aSupported;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString AccessibleListBox::getImplementationName_Static(void) throw( RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleTreeListBox") );
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessible
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleContext > SAL_CALL AccessibleListBox::getAccessibleContext( ) throw (RuntimeException)
+ {
+ ensureAlive();
+ return this;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBox::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ sal_Int32 nCount = 0;
+ SvTreeListBox* pSvTreeListBox = getListBox();
+ if ( pSvTreeListBox )
+ nCount = pSvTreeListBox->GetLevelChildCount( NULL );
+
+ return nCount;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException,RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+ SvLBoxEntry* pEntry = getListBox()->GetEntry(i);
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ return new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleParent( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ensureAlive();
+ return m_xParent;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int16 SAL_CALL AccessibleListBox::getAccessibleRole( ) throw (RuntimeException)
+ {
+ return AccessibleRole::TREE;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleListBox::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+ return getListBox()->GetAccessibleDescription();
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleListBox::getAccessibleName( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+ return getListBox()->GetAccessibleName();
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleSelection
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( nChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ getListBox()->Select( pEntry, sal_True );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleListBox::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( nChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ return getListBox()->IsSelected( pEntry );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBox::clearAccessibleSelection( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ sal_Int32 i, nCount = 0;
+ nCount = getListBox()->GetLevelChildCount( NULL );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( i );
+ if ( getListBox()->IsSelected( pEntry ) )
+ getListBox()->Select( pEntry, sal_False );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBox::selectAllAccessibleChildren( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ sal_Int32 i, nCount = 0;
+ nCount = getListBox()->GetLevelChildCount( NULL );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( i );
+ if ( !getListBox()->IsSelected( pEntry ) )
+ getListBox()->Select( pEntry, sal_True );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBox::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ sal_Int32 i, nSelCount = 0, nCount = 0;
+ nCount = getListBox()->GetLevelChildCount( NULL );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( i );
+ if ( getListBox()->IsSelected( pEntry ) )
+ ++nSelCount;
+ }
+
+ return nSelCount;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleListBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 i, nSelCount = 0, nCount = 0;
+ nCount = getListBox()->GetLevelChildCount( NULL );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( i );
+ if ( getListBox()->IsSelected( pEntry ) )
+ ++nSelCount;
+
+ if ( nSelCount == ( nSelectedChildIndex + 1 ) )
+ {
+ xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ break;
+ }
+ }
+
+ return xChild;
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBox::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::OExternalLockGuard aGuard( this );
+
+ ensureAlive();
+
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( nSelectedChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ getListBox()->Select( pEntry, sal_False );
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleListBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+ {
+ VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+ if ( getListBox() && isAlive() )
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ if ( getListBox()->GetSelectionMode() == MULTIPLE_SELECTION )
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+ }
+ }
+
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
new file mode 100644
index 000000000000..939e99b10fbb
--- /dev/null
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -0,0 +1,970 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include "accessibility/extended/accessiblelistboxentry.hxx"
+#include <svtools/svtreebx.hxx>
+#include <svtools/stringtransfer.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/controllayout.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+#define ACCESSIBLE_ACTION_COUNT 1
+
+namespace
+{
+ void checkActionIndex_Impl( sal_Int32 _nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ {
+ if ( _nIndex < 0 || _nIndex >= ACCESSIBLE_ACTION_COUNT )
+ // only three actions
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+}
+
+//........................................................................
+namespace accessibility
+{
+ //........................................................................
+ // class ALBSolarGuard ---------------------------------------------------------
+
+ /** Aquire the solar mutex. */
+ class ALBSolarGuard : public ::vos::OGuard
+ {
+ public:
+ inline ALBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
+ };
+
+ // class AccessibleListBoxEntry -----------------------------------------------------
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+
+ DBG_NAME(AccessibleListBoxEntry)
+
+ // -----------------------------------------------------------------------------
+ // Ctor() and Dtor()
+ // -----------------------------------------------------------------------------
+ AccessibleListBoxEntry::AccessibleListBoxEntry( SvTreeListBox& _rListBox,
+ SvLBoxEntry* _pEntry,
+ const Reference< XAccessible >& _xParent ) :
+
+ AccessibleListBoxEntry_BASE ( m_aMutex ),
+ ListBoxAccessibleBase( _rListBox ),
+
+ m_nClientId ( 0 ),
+ m_aParent ( _xParent )
+
+ {
+ DBG_CTOR( AccessibleListBoxEntry, NULL );
+
+ _rListBox.FillEntryPath( _pEntry, m_aEntryPath );
+ }
+ // -----------------------------------------------------------------------------
+ AccessibleListBoxEntry::~AccessibleListBoxEntry()
+ {
+ DBG_DTOR( AccessibleListBoxEntry, NULL );
+
+ if ( IsAlive_Impl() )
+ {
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const
+ {
+ Rectangle aRect;
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ {
+ aRect = getListBox()->GetBoundingRect( pEntry );
+ SvLBoxEntry* pParent = getListBox()->GetParent( pEntry );
+ if ( pParent )
+ {
+ // position relative to parent entry
+ Point aTopLeft = aRect.TopLeft();
+ aTopLeft -= getListBox()->GetBoundingRect( pParent ).TopLeft();
+ aRect = Rectangle( aTopLeft, aRect.GetSize() );
+ }
+ }
+
+ return aRect;
+ }
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen_Impl() const
+ {
+ Rectangle aRect;
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ {
+ aRect = getListBox()->GetBoundingRect( pEntry );
+ Point aTopLeft = aRect.TopLeft();
+ aTopLeft += getListBox()->GetWindowExtentsRelative( NULL ).TopLeft();
+ aRect = Rectangle( aTopLeft, aRect.GetSize() );
+ }
+
+ return aRect;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool AccessibleListBoxEntry::IsAlive_Impl() const
+ {
+ return ( !rBHelper.bDisposed && !rBHelper.bInDispose && isAlive() );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool AccessibleListBoxEntry::IsShowing_Impl() const
+ {
+ Reference< XAccessible > xParent = implGetParentAccessible( );
+
+ sal_Bool bShowing = sal_False;
+ Reference< XAccessibleContext > m_xParentContext =
+ xParent.is() ? xParent->getAccessibleContext() : Reference< XAccessibleContext >();
+ if( m_xParentContext.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( m_xParentContext, uno::UNO_QUERY );
+ if( xParentComp.is() )
+ bShowing = GetBoundingBox_Impl().IsOver( VCLRectangle( xParentComp->getBounds() ) );
+ }
+
+ return bShowing;
+ }
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleListBoxEntry::GetBoundingBox() throw ( lang::DisposedException )
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ return GetBoundingBox_Impl();
+ }
+ // -----------------------------------------------------------------------------
+ Rectangle AccessibleListBoxEntry::GetBoundingBoxOnScreen() throw ( lang::DisposedException )
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ return GetBoundingBoxOnScreen_Impl();
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleListBoxEntry::EnsureIsAlive() const throw ( lang::DisposedException )
+ {
+ if ( !IsAlive_Impl() )
+ throw lang::DisposedException();
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString AccessibleListBoxEntry::implGetText()
+ {
+ ::rtl::OUString sRet;
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ sRet = getListBox()->SearchEntryText( pEntry );
+ return sRet;
+ }
+ // -----------------------------------------------------------------------------
+ Locale AccessibleListBoxEntry::implGetLocale()
+ {
+ Locale aLocale;
+ aLocale = Application::GetSettings().GetUILocale();
+
+ return aLocale;
+ }
+ void AccessibleListBoxEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+ {
+ nStartIndex = 0;
+ nEndIndex = 0;
+ }
+ // -----------------------------------------------------------------------------
+ // XTypeProvider
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ Sequence< sal_Int8 > AccessibleListBoxEntry::getImplementationId() throw (RuntimeException)
+ {
+ static ::cppu::OImplementationId* pId = NULL;
+
+ if ( !pId )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+
+ if ( !pId )
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XComponent/ListBoxAccessibleBase
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::dispose() throw ( uno::RuntimeException )
+ {
+ AccessibleListBoxEntry_BASE::dispose();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XComponent
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::disposing()
+ {
+ ALBSolarGuard();
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XAccessible > xKeepAlive( this );
+
+ // Send a disposing to all listeners.
+ if ( m_nClientId )
+ {
+ ::comphelper::AccessibleEventNotifier::TClientId nId = m_nClientId;
+ m_nClientId = 0;
+ ::comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
+ }
+
+ // clean up
+ {
+
+ ListBoxAccessibleBase::disposing();
+ }
+ m_aParent = WeakReference< XAccessible >();
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getImplementationName() throw(RuntimeException)
+ {
+ return getImplementationName_Static();
+ }
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AccessibleListBoxEntry::getSupportedServiceNames() throw(RuntimeException)
+ {
+ return getSupportedServiceNames_Static();
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() );
+ const ::rtl::OUString* pSupported = aSupported.getConstArray();
+ const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
+ for ( ; pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported )
+ ;
+
+ return pSupported != pEnd;
+ }
+ // -----------------------------------------------------------------------------
+ // XServiceInfo - static methods
+ // -----------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > AccessibleListBoxEntry::getSupportedServiceNames_Static(void) throw( RuntimeException )
+ {
+ Sequence< ::rtl::OUString > aSupported(3);
+ aSupported[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleContext") );
+ aSupported[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleComponent") );
+ aSupported[2] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AccessibleTreeListBoxEntry") );
+ return aSupported;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString AccessibleListBoxEntry::getImplementationName_Static(void) throw( RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.svtools.AccessibleTreeListBoxEntry") );
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessible
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleContext > SAL_CALL AccessibleListBoxEntry::getAccessibleContext( ) throw (RuntimeException)
+ {
+ EnsureIsAlive();
+ return this;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ sal_Int32 nCount = 0;
+ if ( pEntry )
+ nCount = getListBox()->GetLevelChildCount( pEntry );
+
+ return nCount;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException,RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ SvLBoxEntry* pEntry = pParent ? getListBox()->GetEntry( pParent, i ) : NULL;
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ return new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > AccessibleListBoxEntry::implGetParentAccessible( ) const
+ {
+ Reference< XAccessible > xParent = (Reference< XAccessible >)m_aParent;
+ if ( !xParent.is() )
+ {
+ DBG_ASSERT( m_aEntryPath.size(), "AccessibleListBoxEntry::getAccessibleParent: invalid path!" );
+ if ( 1 == m_aEntryPath.size() )
+ { // we're a top level entry
+ // -> our parent is the tree listbox itself
+ if ( getListBox() )
+ xParent = getListBox()->GetAccessible( );
+ }
+ else
+ { // we have a entry as parent -> get it's accessible
+
+ // shorten our access path by one
+ ::std::deque< sal_Int32 > aParentPath( m_aEntryPath );
+ aParentPath.pop_back();
+
+ // get the entry for this shortened access path
+ SvLBoxEntry* pParentEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ DBG_ASSERT( pParentEntry, "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!" );
+
+ if ( pParentEntry )
+ xParent = new AccessibleListBoxEntry( *getListBox(), pParentEntry, NULL );
+ // note that we pass NULL here as parent-accessible:
+ // this is allowed, as the AccessibleListBoxEntry class will create it's parent
+ // when needed
+ }
+ }
+
+ return xParent;
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleParent( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ return implGetParentAccessible( );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleIndexInParent( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ DBG_ASSERT( !m_aEntryPath.empty(), "empty path" );
+ return m_aEntryPath.empty() ? -1 : m_aEntryPath.back();
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int16 SAL_CALL AccessibleListBoxEntry::getAccessibleRole( ) throw (RuntimeException)
+ {
+ return AccessibleRole::LABEL;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ // no description for every item
+ return ::rtl::OUString();
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ return implGetText();
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet( ) throw (RuntimeException)
+ {
+ Reference< XAccessibleRelationSet > xRelSet;
+ Reference< XAccessible > xParent;
+ if ( m_aEntryPath.size() > 1 ) // not a root entry
+ xParent = implGetParentAccessible();
+ if ( xParent.is() )
+ {
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Sequence< Reference< XInterface > > aSequence(1);
+ aSequence[0] = xParent;
+ pRelationSetHelper->AddRelation(
+ AccessibleRelation( AccessibleRelationType::NODE_CHILD_OF, aSequence ) );
+ xRelSet = pRelationSetHelper;
+ }
+ return xRelSet;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleStateSet > SAL_CALL AccessibleListBoxEntry::getAccessibleStateSet( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+
+ if ( IsAlive_Impl() )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ if ( getListBox()->IsInplaceEditingEnabled() )
+ pStateSetHelper->AddState( AccessibleStateType::EDITABLE );
+ if ( IsShowing_Impl() )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ getListBox()->FillAccessibleEntryStateSet(
+ getListBox()->GetEntryFromPath( m_aEntryPath ), *pStateSetHelper );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return xStateSet;
+ }
+ // -----------------------------------------------------------------------------
+ Locale SAL_CALL AccessibleListBoxEntry::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return implGetLocale();
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleComponent
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleListBoxEntry::containsPoint( const awt::Point& rPoint ) throw (RuntimeException)
+ {
+ return Rectangle( Point(), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleAtPoint( const awt::Point& _aPoint ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( VCLPoint( _aPoint ) );
+ if ( !pEntry )
+ throw RuntimeException();
+
+ Reference< XAccessible > xAcc;
+ AccessibleListBoxEntry* pAccEntry = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ Rectangle aRect = pAccEntry->GetBoundingBox_Impl();
+ if ( aRect.IsInside( VCLPoint( _aPoint ) ) )
+ xAcc = pAccEntry;
+ return xAcc;
+ }
+ // -----------------------------------------------------------------------------
+ awt::Rectangle SAL_CALL AccessibleListBoxEntry::getBounds( ) throw (RuntimeException)
+ {
+ return AWTRectangle( GetBoundingBox() );
+ }
+ // -----------------------------------------------------------------------------
+ awt::Point SAL_CALL AccessibleListBoxEntry::getLocation( ) throw (RuntimeException)
+ {
+ return AWTPoint( GetBoundingBox().TopLeft() );
+ }
+ // -----------------------------------------------------------------------------
+ awt::Point SAL_CALL AccessibleListBoxEntry::getLocationOnScreen( ) throw (RuntimeException)
+ {
+ return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
+ }
+ // -----------------------------------------------------------------------------
+ awt::Size SAL_CALL AccessibleListBoxEntry::getSize( ) throw (RuntimeException)
+ {
+ return AWTSize( GetBoundingBox().GetSize() );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::grabFocus( ) throw (RuntimeException)
+ {
+ // do nothing, because no focus for each item
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 AccessibleListBoxEntry::getForeground( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getForeground();
+ }
+
+ return nColor;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 AccessibleListBoxEntry::getBackground( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getBackground();
+ }
+
+ return nColor;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleText
+ // -----------------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
+ awt::Rectangle SAL_CALL AccessibleListBoxEntry::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ {
+ ::vcl::ControlLayoutData aLayoutData;
+ Rectangle aItemRect = GetBoundingBox();
+ getListBox()->RecordLayoutData( &aLayoutData, aItemRect );
+ Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex );
+ aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
+ aBounds = AWTRectangle( aCharRect );
+ }
+
+ return aBounds;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ sal_Int32 nIndex = -1;
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ {
+ ::vcl::ControlLayoutData aLayoutData;
+ Rectangle aItemRect = GetBoundingBox();
+ getListBox()->RecordLayoutData( &aLayoutData, aItemRect );
+ Point aPnt( VCLPoint( aPoint ) );
+ aPnt += aItemRect.TopLeft();
+ nIndex = aLayoutData.GetIndexForPoint( aPnt );
+ }
+
+ return nIndex;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleListBoxEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ String sText = getText();
+ if ( ( 0 > nStartIndex ) || ( sText.Len() <= nStartIndex )
+ || ( 0 > nEndIndex ) || ( sText.Len() <= nEndIndex ) )
+ throw IndexOutOfBoundsException();
+
+ sal_Int32 nLen = nEndIndex - nStartIndex + 1;
+ ::svt::OStringTransfer::CopyString( sText.Copy( (sal_uInt16)nStartIndex, (sal_uInt16)nLen ), getListBox() );
+
+ return sal_True;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleEventBroadcaster
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+ {
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ if (!m_nClientId)
+ m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+ {
+ if (xListener.is())
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ sal_Int32 nId = m_nClientId;
+ m_nClientId = 0;
+ comphelper::AccessibleEventNotifier::revokeClient( nId );
+
+ }
+ }
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleAction
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleActionCount( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // three actions supported
+ return ACCESSIBLE_ACTION_COUNT;
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Bool bRet = sal_False;
+ checkActionIndex_Impl( nIndex );
+ EnsureIsAlive();
+
+ SvLBoxEntry* pEntry = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( pEntry )
+ {
+ if ( getListBox()->IsExpanded( pEntry ) )
+ getListBox()->Collapse( pEntry );
+ else
+ getListBox()->Expand( pEntry );
+ bRet = sal_True;
+ }
+
+ return bRet;
+ }
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getAccessibleActionDescription( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkActionIndex_Impl( nIndex );
+ EnsureIsAlive();
+
+ static const ::rtl::OUString sActionDesc( RTL_CONSTASCII_USTRINGPARAM( "toggleExpand" ) );
+ return sActionDesc;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Reference< XAccessibleKeyBinding > xRet;
+ checkActionIndex_Impl( nIndex );
+ // ... which key?
+ return xRet;
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleSelection
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ getListBox()->Select( pEntry, sal_True );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleListBoxEntry::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ return getListBox()->IsSelected( pEntry );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::clearAccessibleSelection( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( !pParent )
+ throw RuntimeException();
+ sal_Int32 i, nCount = 0;
+ nCount = getListBox()->GetLevelChildCount( pParent );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
+ if ( getListBox()->IsSelected( pEntry ) )
+ getListBox()->Select( pEntry, sal_False );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::selectAllAccessibleChildren( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( !pParent )
+ throw RuntimeException();
+ sal_Int32 i, nCount = 0;
+ nCount = getListBox()->GetLevelChildCount( pParent );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
+ if ( !getListBox()->IsSelected( pEntry ) )
+ getListBox()->Select( pEntry, sal_True );
+ }
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ sal_Int32 i, nSelCount = 0, nCount = 0;
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( !pParent )
+ throw RuntimeException();
+ nCount = getListBox()->GetLevelChildCount( pParent );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
+ if ( getListBox()->IsSelected( pEntry ) )
+ ++nSelCount;
+ }
+
+ return nSelCount;
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ sal_Int32 i, nSelCount = 0, nCount = 0;
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ if ( !pParent )
+ throw RuntimeException();
+ nCount = getListBox()->GetLevelChildCount( pParent );
+ for ( i = 0; i < nCount; ++i )
+ {
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, i );
+ if ( getListBox()->IsSelected( pEntry ) )
+ ++nSelCount;
+
+ if ( nSelCount == ( nSelectedChildIndex + 1 ) )
+ {
+ xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this );
+ break;
+ }
+ }
+
+ return xChild;
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleListBoxEntry::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ EnsureIsAlive();
+
+ SvLBoxEntry* pParent = getListBox()->GetEntryFromPath( m_aEntryPath );
+ SvLBoxEntry* pEntry = getListBox()->GetEntry( pParent, nSelectedChildIndex );
+ if ( !pEntry )
+ throw IndexOutOfBoundsException();
+
+ getListBox()->Select( pEntry, sal_False );
+ }
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getCaretPosition( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return -1;
+ }
+ sal_Bool SAL_CALL AccessibleListBoxEntry::setCaretPosition ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ sal_Unicode SAL_CALL AccessibleListBoxEntry::getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getCharacter( nIndex );
+ }
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleListBoxEntry::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >();
+ }
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getCharacterCount( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getCharacterCount( );
+ }
+
+ ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getSelectedText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getSelectedText( );
+ }
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionStart( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getSelectionStart( );
+ }
+ sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionEnd( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getSelectionEnd( );
+ }
+ sal_Bool SAL_CALL AccessibleListBoxEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+ }
+ ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getText( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getText( );
+ }
+ ::rtl::OUString SAL_CALL AccessibleListBoxEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType);
+ }
+ ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ ALBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( m_aMutex );
+ EnsureIsAlive();
+
+ return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType);
+ }
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx
new file mode 100644
index 000000000000..34fd7ef88d1f
--- /dev/null
+++ b/accessibility/source/extended/accessibletabbar.cxx
@@ -0,0 +1,554 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/extended/accessibletabbar.hxx>
+#include <svtools/tabbar.hxx>
+#include <accessibility/extended/accessibletabbarpagelist.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <vector>
+
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::comphelper;
+
+ DBG_NAME( AccessibleTabBar )
+
+ // ----------------------------------------------------
+ // class AccessibleTabBar
+ // ----------------------------------------------------
+
+ AccessibleTabBar::AccessibleTabBar( TabBar* pTabBar )
+ :AccessibleTabBarBase( pTabBar )
+ {
+ DBG_CTOR( AccessibleTabBar, NULL );
+
+ if ( m_pTabBar )
+ m_aAccessibleChildren.assign( m_pTabBar->GetAccessibleChildWindowCount() + 1, Reference< XAccessible >() );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ AccessibleTabBar::~AccessibleTabBar()
+ {
+ DBG_DTOR( AccessibleTabBar, NULL );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+ {
+ Any aOldValue, aNewValue;
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_ENABLED:
+ {
+ aNewValue <<= AccessibleStateType::SENSITIVE;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ aNewValue <<= AccessibleStateType::ENABLED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_DISABLED:
+ {
+ aOldValue <<= AccessibleStateType::ENABLED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ aOldValue <<= AccessibleStateType::SENSITIVE;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ aOldValue <<= AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_SHOW:
+ {
+ aNewValue <<= AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ aOldValue <<= AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ default:
+ {
+ AccessibleTabBarBase::ProcessWindowEvent( rVclWindowEvent );
+ }
+ break;
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+ {
+ if ( m_pTabBar )
+ {
+ if ( m_pTabBar->IsEnabled() )
+ {
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ }
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ if ( m_pTabBar->HasFocus() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+
+ if ( m_pTabBar->IsVisible() )
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+
+ if ( m_pTabBar->GetStyle() & WB_SIZEABLE )
+ rStateSet.AddState( AccessibleStateType::RESIZABLE );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ // OCommonAccessibleComponent
+ // -----------------------------------------------------------------------------
+
+ awt::Rectangle AccessibleTabBar::implGetBounds() throw (RuntimeException)
+ {
+ awt::Rectangle aBounds;
+ if ( m_pTabBar )
+ aBounds = AWTRectangle( Rectangle( m_pTabBar->GetPosPixel(), m_pTabBar->GetSizePixel() ) );
+
+ return aBounds;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XInterface
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBar, AccessibleExtendedComponentHelper_BASE, AccessibleTabBar_BASE )
+
+ // -----------------------------------------------------------------------------
+ // XTypeProvider
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBar, AccessibleExtendedComponentHelper_BASE, AccessibleTabBar_BASE )
+
+ // -----------------------------------------------------------------------------
+ // XComponent
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBar::disposing()
+ {
+ AccessibleTabBarBase::disposing();
+
+ // dispose all children
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBar::getImplementationName() throw (RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.svtools.AccessibleTabBar" );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleTabBar::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Sequence< ::rtl::OUString > AccessibleTabBar::getSupportedServiceNames() throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleTabBar" );
+ return aNames;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessible
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleContext > AccessibleTabBar::getAccessibleContext( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return this;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBar::getAccessibleChildCount() throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return m_aAccessibleChildren.size();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBar::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ if ( !xChild.is() )
+ {
+ if ( m_pTabBar )
+ {
+ sal_Int32 nCount = m_pTabBar->GetAccessibleChildWindowCount();
+
+ if ( i < nCount )
+ {
+ Window* pChild = m_pTabBar->GetAccessibleChildWindow( (sal_uInt16)i );
+ if ( pChild )
+ xChild = pChild->GetAccessible();
+ }
+ else if ( i == nCount )
+ {
+ xChild = new AccessibleTabBarPageList( m_pTabBar, i );
+ }
+
+ // insert into child list
+ m_aAccessibleChildren[i] = xChild;
+ }
+ }
+
+ return xChild;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBar::getAccessibleParent( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xParent;
+ if ( m_pTabBar )
+ {
+ Window* pParent = m_pTabBar->GetAccessibleParentWindow();
+ if ( pParent )
+ xParent = pParent->GetAccessible();
+ }
+
+ return xParent;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBar::getAccessibleIndexInParent( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndexInParent = -1;
+ if ( m_pTabBar )
+ {
+ Window* pParent = m_pTabBar->GetAccessibleParentWindow();
+ if ( pParent )
+ {
+ for ( sal_uInt16 i = 0, nCount = pParent->GetAccessibleChildWindowCount(); i < nCount; ++i )
+ {
+ Window* pChild = pParent->GetAccessibleChildWindow( i );
+ if ( pChild == static_cast< Window* >( m_pTabBar ) )
+ {
+ nIndexInParent = i;
+ break;
+ }
+ }
+ }
+ }
+
+ return nIndexInParent;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int16 AccessibleTabBar::getAccessibleRole( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::PANEL;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBar::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sDescription;
+ if ( m_pTabBar )
+ sDescription = m_pTabBar->GetAccessibleDescription();
+
+ return sDescription;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBar::getAccessibleName( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sName;
+ if ( m_pTabBar )
+ sName = m_pTabBar->GetAccessibleName();
+
+ return sName;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleRelationSet > AccessibleTabBar::getAccessibleRelationSet( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleStateSet > AccessibleTabBar::getAccessibleStateSet( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+
+ if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ FillAccessibleStateSet( *pStateSetHelper );
+ }
+ else
+ {
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ }
+
+ return xSet;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Locale AccessibleTabBar::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleComponent
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBar::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xChild;
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XAccessible > xAcc = getAccessibleChild( i );
+ if ( xAcc.is() )
+ {
+ Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
+ if ( xComp.is() )
+ {
+ Rectangle aRect = VCLRectangle( xComp->getBounds() );
+ Point aPos = VCLPoint( rPoint );
+ if ( aRect.IsInside( aPos ) )
+ {
+ xChild = xAcc;
+ break;
+ }
+ }
+ }
+ }
+
+ return xChild;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBar::grabFocus( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( m_pTabBar )
+ m_pTabBar->GrabFocus();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBar::getForeground( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ if ( m_pTabBar )
+ {
+ if ( m_pTabBar->IsControlForeground() )
+ nColor = m_pTabBar->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( m_pTabBar->IsControlFont() )
+ aFont = m_pTabBar->GetControlFont();
+ else
+ aFont = m_pTabBar->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
+ }
+
+ return nColor;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBar::getBackground( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ if ( m_pTabBar )
+ {
+ if ( m_pTabBar->IsControlBackground() )
+ nColor = m_pTabBar->GetControlBackground().GetColor();
+ else
+ nColor = m_pTabBar->GetBackground().GetColor().GetColor();
+ }
+
+ return nColor;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleExtendedComponent
+ // -----------------------------------------------------------------------------
+
+ Reference< awt::XFont > AccessibleTabBar::getFont( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ Reference< awt::XFont > xFont;
+ if ( m_pTabBar )
+ {
+ Reference< awt::XDevice > xDev( m_pTabBar->GetComponentInterface(), UNO_QUERY );
+ if ( xDev.is() )
+ {
+ Font aFont;
+ if ( m_pTabBar->IsControlFont() )
+ aFont = m_pTabBar->GetControlFont();
+ else
+ aFont = m_pTabBar->GetFont();
+ VCLXFont* pVCLXFont = new VCLXFont;
+ pVCLXFont->Init( *xDev.get(), aFont );
+ xFont = pVCLXFont;
+ }
+ }
+
+ return xFont;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBar::getTitledBorderText( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sText;
+ if ( m_pTabBar )
+ sText = m_pTabBar->GetText();
+
+ return sText;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBar::getToolTipText( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sText;
+ if ( m_pTabBar )
+ sText = m_pTabBar->GetQuickHelpText();
+
+ return sText;
+ }
+
+ // -----------------------------------------------------------------------------
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
diff --git a/accessibility/source/extended/accessibletabbarbase.cxx b/accessibility/source/extended/accessibletabbarbase.cxx
new file mode 100644
index 000000000000..5c26185f6b03
--- /dev/null
+++ b/accessibility/source/extended/accessibletabbarbase.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include "accessibility/extended/accessibletabbarbase.hxx"
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABBARPAGELIST
+#include "accessibility/extended/accessibletabbarpagelist.hxx"
+#endif
+#include <toolkit/helper/externallock.hxx>
+#include <svtools/tabbar.hxx>
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+AccessibleTabBarBase::AccessibleTabBarBase( TabBar* pTabBar ) :
+ AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() ),
+ m_pTabBar( 0 )
+{
+ m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
+ SetTabBarPointer( pTabBar );
+}
+
+AccessibleTabBarBase::~AccessibleTabBarBase()
+{
+ ClearTabBarPointer();
+ DELETEZ( m_pExternalLock );
+}
+
+IMPL_LINK( AccessibleTabBarBase, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ VclWindowEvent* pWinEvent = dynamic_cast< VclWindowEvent* >( pEvent );
+ DBG_ASSERT( pWinEvent, "AccessibleTabBarBase::WindowEventListener - unknown window event" );
+ if( pWinEvent )
+ {
+ Window* pEventWindow = pWinEvent->GetWindow();
+ DBG_ASSERT( pEventWindow, "AccessibleTabBarBase::WindowEventListener: no window!" );
+
+ if( ( pWinEvent->GetId() == VCLEVENT_TABBAR_PAGEREMOVED ) &&
+ ( (sal_uInt16)(sal_IntPtr) pWinEvent->GetData() == TabBar::PAGE_NOT_FOUND ) &&
+ ( dynamic_cast< AccessibleTabBarPageList *> (this) != NULL ) )
+ {
+ return 0;
+ }
+
+ if ( !pEventWindow->IsAccessibilityEventsSuppressed() || (pWinEvent->GetId() == VCLEVENT_OBJECT_DYING) )
+ ProcessWindowEvent( *pWinEvent );
+ }
+ return 0;
+}
+
+void AccessibleTabBarBase::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ if( rVclWindowEvent.GetId() == VCLEVENT_OBJECT_DYING )
+ ClearTabBarPointer();
+}
+
+// XComponent
+
+void AccessibleTabBarBase::disposing()
+{
+ AccessibleExtendedComponentHelper_BASE::disposing();
+ ClearTabBarPointer();
+}
+
+// private
+
+void AccessibleTabBarBase::SetTabBarPointer( TabBar* pTabBar )
+{
+ DBG_ASSERT( !m_pTabBar, "AccessibleTabBarBase::SetTabBarPointer - multiple call" );
+ m_pTabBar = pTabBar;
+ if( m_pTabBar )
+ m_pTabBar->AddEventListener( LINK( this, AccessibleTabBarBase, WindowEventListener ) );
+}
+
+void AccessibleTabBarBase::ClearTabBarPointer()
+{
+ if( m_pTabBar )
+ {
+ m_pTabBar->RemoveEventListener( LINK( this, AccessibleTabBarBase, WindowEventListener ) );
+ m_pTabBar = 0;
+ }
+}
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
+
diff --git a/accessibility/source/extended/accessibletabbarpage.cxx b/accessibility/source/extended/accessibletabbarpage.cxx
new file mode 100644
index 000000000000..32dfb591a3ad
--- /dev/null
+++ b/accessibility/source/extended/accessibletabbarpage.cxx
@@ -0,0 +1,511 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/extended/accessibletabbarpage.hxx>
+#include <svtools/tabbar.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/helper/convert.hxx>
+
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+ using namespace ::comphelper;
+
+ // -----------------------------------------------------------------------------
+ // class AccessibleTabBarPage
+ // -----------------------------------------------------------------------------
+
+ AccessibleTabBarPage::AccessibleTabBarPage( TabBar* pTabBar, sal_uInt16 nPageId, const Reference< XAccessible >& rxParent )
+ :AccessibleTabBarBase( pTabBar )
+ ,m_nPageId( nPageId )
+ ,m_xParent( rxParent )
+ {
+ m_bEnabled = IsEnabled();
+ m_bShowing = IsShowing();
+ m_bSelected = IsSelected();
+
+ if ( m_pTabBar )
+ m_sPageText = m_pTabBar->GetPageText( m_nPageId );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ AccessibleTabBarPage::~AccessibleTabBarPage()
+ {
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleTabBarPage::IsEnabled()
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bEnabled = sal_False;
+ if ( m_pTabBar )
+ bEnabled = m_pTabBar->IsPageEnabled( m_nPageId );
+
+ return bEnabled;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleTabBarPage::IsShowing()
+ {
+ sal_Bool bShowing = sal_False;
+
+ if ( m_pTabBar && m_pTabBar->IsVisible() )
+ bShowing = sal_True;
+
+ return bShowing;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleTabBarPage::IsSelected()
+ {
+ sal_Bool bSelected = sal_False;
+
+ if ( m_pTabBar && m_pTabBar->GetCurPageId() == m_nPageId )
+ bSelected = sal_True;
+
+ return bSelected;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPage::SetEnabled( sal_Bool bEnabled )
+ {
+ if ( m_bEnabled != bEnabled )
+ {
+ Any aOldValue[2], aNewValue[2];
+ if ( m_bEnabled )
+ {
+ aOldValue[0] <<= AccessibleStateType::SENSITIVE;
+ aOldValue[1] <<= AccessibleStateType::ENABLED;
+ }
+ else
+ {
+
+ aNewValue[0] <<= AccessibleStateType::ENABLED;
+ aNewValue[1] <<= AccessibleStateType::SENSITIVE;
+ }
+ m_bEnabled = bEnabled;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] );
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPage::SetShowing( sal_Bool bShowing )
+ {
+ if ( m_bShowing != bShowing )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bShowing )
+ aOldValue <<= AccessibleStateType::SHOWING;
+ else
+ aNewValue <<= AccessibleStateType::SHOWING;
+ m_bShowing = bShowing;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPage::SetSelected( sal_Bool bSelected )
+ {
+ if ( m_bSelected != bSelected )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bSelected )
+ aOldValue <<= AccessibleStateType::SELECTED;
+ else
+ aNewValue <<= AccessibleStateType::SELECTED;
+ m_bSelected = bSelected;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPage::SetPageText( const ::rtl::OUString& sPageText )
+ {
+ if ( !m_sPageText.equals( sPageText ) )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= m_sPageText;
+ aNewValue <<= sPageText;
+ m_sPageText = sPageText;
+ NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPage::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+ {
+ if ( IsEnabled() )
+ {
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ }
+
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+
+ if ( IsShowing() )
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+
+ rStateSet.AddState( AccessibleStateType::SELECTABLE );
+
+ if ( IsSelected() )
+ rStateSet.AddState( AccessibleStateType::SELECTED );
+ }
+
+ // -----------------------------------------------------------------------------
+ // OCommonAccessibleComponent
+ // -----------------------------------------------------------------------------
+
+ awt::Rectangle AccessibleTabBarPage::implGetBounds() throw (RuntimeException)
+ {
+ awt::Rectangle aBounds;
+ if ( m_pTabBar )
+ {
+ // get bounding rectangle relative to the AccessibleTabBar
+ aBounds = AWTRectangle( m_pTabBar->GetPageRect( m_nPageId ) );
+
+ // get position of the AccessibleTabBarPageList relative to the AccessibleTabBar
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComponent.is() )
+ {
+ awt::Point aParentLoc = xParentComponent->getLocation();
+
+ // calculate bounding rectangle relative to the AccessibleTabBarPageList
+ aBounds.X -= aParentLoc.X;
+ aBounds.Y -= aParentLoc.Y;
+ }
+ }
+ }
+
+ return aBounds;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XInterface
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBarPage, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPage_BASE )
+
+ // -----------------------------------------------------------------------------
+ // XTypeProvider
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBarPage, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPage_BASE )
+
+ // -----------------------------------------------------------------------------
+ // XComponent
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPage::disposing()
+ {
+ AccessibleTabBarBase::disposing();
+ m_sPageText = ::rtl::OUString();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPage::getImplementationName() throw (RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.svtools.AccessibleTabBarPage" );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleTabBarPage::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Sequence< ::rtl::OUString > AccessibleTabBarPage::getSupportedServiceNames() throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleTabBarPage" );
+ return aNames;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessible
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleContext > AccessibleTabBarPage::getAccessibleContext( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return this;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPage::getAccessibleChildCount() throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return 0;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBarPage::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessible >();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBarPage::getAccessibleParent( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return m_xParent;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPage::getAccessibleIndexInParent( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndexInParent = -1;
+ if ( m_pTabBar )
+ nIndexInParent = m_pTabBar->GetPagePos( m_nPageId );
+
+ return nIndexInParent;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int16 AccessibleTabBarPage::getAccessibleRole( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::PAGE_TAB;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPage::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sDescription;
+ if ( m_pTabBar )
+ sDescription = m_pTabBar->GetHelpText( m_nPageId );
+
+ return sDescription;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPage::getAccessibleName( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return m_sPageText;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleRelationSet > AccessibleTabBarPage::getAccessibleRelationSet( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleStateSet > AccessibleTabBarPage::getAccessibleStateSet( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+
+ if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ FillAccessibleStateSet( *pStateSetHelper );
+ }
+ else
+ {
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ }
+
+ return xSet;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Locale AccessibleTabBarPage::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleComponent
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBarPage::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return Reference< XAccessible >();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPage::grabFocus( ) throw (RuntimeException)
+ {
+ // no focus
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPage::getForeground( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getForeground();
+ }
+
+ return nColor;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPage::getBackground( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getBackground();
+ }
+
+ return nColor;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleExtendedComponent
+ // -----------------------------------------------------------------------------
+
+ Reference< awt::XFont > AccessibleTabBarPage::getFont( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ Reference< awt::XFont > xFont;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ xFont = xParentComp->getFont();
+ }
+
+ return xFont;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPage::getTitledBorderText( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return m_sPageText;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPage::getToolTipText( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+ }
+
+ // -----------------------------------------------------------------------------
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx
new file mode 100644
index 000000000000..a8fce05dcff0
--- /dev/null
+++ b/accessibility/source/extended/accessibletabbarpagelist.cxx
@@ -0,0 +1,805 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/extended/accessibletabbarpagelist.hxx>
+#include <svtools/tabbar.hxx>
+#include <accessibility/extended/accessibletabbarpage.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <toolkit/helper/convert.hxx>
+
+
+//.........................................................................
+namespace accessibility
+{
+//.........................................................................
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+ using namespace ::comphelper;
+
+ DBG_NAME( AccessibleTabBarPageList )
+
+ // -----------------------------------------------------------------------------
+ // class AccessibleTabBarPageList
+ // -----------------------------------------------------------------------------
+
+ AccessibleTabBarPageList::AccessibleTabBarPageList( TabBar* pTabBar, sal_Int32 nIndexInParent )
+ :AccessibleTabBarBase( pTabBar )
+ ,m_nIndexInParent( nIndexInParent )
+ {
+ DBG_CTOR( AccessibleTabBarPageList, NULL );
+ if ( m_pTabBar )
+ m_aAccessibleChildren.assign( m_pTabBar->GetPageCount(), Reference< XAccessible >() );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ AccessibleTabBarPageList::~AccessibleTabBarPageList()
+ {
+ DBG_DTOR( AccessibleTabBarPageList, NULL );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::UpdateEnabled( sal_Int32 i, sal_Bool bEnabled )
+ {
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
+ if ( pAccessibleTabBarPage )
+ pAccessibleTabBarPage->SetEnabled( bEnabled );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::UpdateShowing( sal_Bool bShowing )
+ {
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
+ if ( pAccessibleTabBarPage )
+ pAccessibleTabBarPage->SetShowing( bShowing );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::UpdateSelected( sal_Int32 i, sal_Bool bSelected )
+ {
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
+ if ( pAccessibleTabBarPage )
+ pAccessibleTabBarPage->SetSelected( bSelected );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::UpdatePageText( sal_Int32 i )
+ {
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
+ if ( pAccessibleTabBarPage )
+ {
+ if ( m_pTabBar )
+ {
+ ::rtl::OUString sPageText = m_pTabBar->GetPageText( m_pTabBar->GetPageId( (sal_uInt16)i ) );
+ pAccessibleTabBarPage->SetPageText( sPageText );
+ }
+ }
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::InsertChild( sal_Int32 i )
+ {
+ if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ // insert entry in child list
+ m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
+
+ // send accessible child event
+ Reference< XAccessible > xChild( getAccessibleChild( i ) );
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::RemoveChild( sal_Int32 i )
+ {
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ // get the accessible of the removed page
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+
+ // remove entry in child list
+ m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
+
+ // send accessible child event
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+
+ Reference< XComponent > xComponent( xChild, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::MoveChild( sal_Int32 i, sal_Int32 j )
+ {
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() &&
+ j >= 0 && j <= (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ if ( i < j )
+ --j;
+
+ // get the accessible of the moved page
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+
+ // remove entry in child list at old position
+ m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
+
+ // insert entry in child list at new position
+ m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + j, xChild );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+ {
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_ENABLED:
+ {
+ Any aNewValue;
+ aNewValue <<= AccessibleStateType::SENSITIVE;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue );
+ aNewValue <<= AccessibleStateType::ENABLED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, Any(), aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_DISABLED:
+ {
+ Any aOldValue;
+ aOldValue <<= AccessibleStateType::ENABLED;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() );
+ aOldValue <<= AccessibleStateType::SENSITIVE;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, Any() );
+ }
+ break;
+ case VCLEVENT_WINDOW_SHOW:
+ {
+ Any aOldValue, aNewValue;
+ aNewValue <<= AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ UpdateShowing( sal_True );
+ }
+ break;
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ UpdateShowing( sal_False );
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGEENABLED:
+ {
+ if ( m_pTabBar )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
+ UpdateEnabled( nPagePos, sal_True );
+ }
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGEDISABLED:
+ {
+ if ( m_pTabBar )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
+ UpdateEnabled( nPagePos, sal_False );
+ }
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGESELECTED:
+ {
+ // do nothing
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGEACTIVATED:
+ {
+ if ( m_pTabBar )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
+ UpdateSelected( nPagePos, sal_True );
+ }
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGEDEACTIVATED:
+ {
+ if ( m_pTabBar )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
+ UpdateSelected( nPagePos, sal_False );
+ }
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGEINSERTED:
+ {
+ if ( m_pTabBar )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
+ InsertChild( nPagePos );
+ }
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGEREMOVED:
+ {
+ if ( m_pTabBar )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+
+ if ( nPageId == TabBar::PAGE_NOT_FOUND )
+ {
+ for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i )
+ RemoveChild( i );
+ }
+ else
+ {
+ for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ {
+ Reference< XAccessible > xChild( getAccessibleChild( i ) );
+ if ( xChild.is() )
+ {
+ AccessibleTabBarPage* pAccessibleTabBarPage = static_cast< AccessibleTabBarPage* >( xChild.get() );
+ if ( pAccessibleTabBarPage && pAccessibleTabBarPage->GetPageId() == nPageId )
+ {
+ RemoveChild( i );
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGEMOVED:
+ {
+ Pair* pPair = (Pair*) rVclWindowEvent.GetData();
+ if ( pPair )
+ MoveChild( pPair->A(), pPair->B() );
+ }
+ break;
+ case VCLEVENT_TABBAR_PAGETEXTCHANGED:
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabBar->GetPagePos( nPageId );
+ UpdatePageText( nPagePos );
+ }
+ break;
+ default:
+ {
+ AccessibleTabBarBase::ProcessWindowEvent( rVclWindowEvent );
+ }
+ break;
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+ {
+ if ( m_pTabBar )
+ {
+ if ( m_pTabBar->IsEnabled() )
+ {
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ }
+
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+
+ if ( m_pTabBar->IsVisible() )
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+ // OCommonAccessibleComponent
+ // -----------------------------------------------------------------------------
+
+ awt::Rectangle AccessibleTabBarPageList::implGetBounds() throw (RuntimeException)
+ {
+ awt::Rectangle aBounds;
+ if ( m_pTabBar )
+ aBounds = AWTRectangle( m_pTabBar->GetPageArea() );
+
+ return aBounds;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XInterface
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE )
+
+ // -----------------------------------------------------------------------------
+ // XTypeProvider
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabBarPageList, AccessibleExtendedComponentHelper_BASE, AccessibleTabBarPageList_BASE )
+
+ // -----------------------------------------------------------------------------
+ // XComponent
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::disposing()
+ {
+ AccessibleTabBarBase::disposing();
+
+ // dispose all children
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPageList::getImplementationName() throw (RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.svtools.AccessibleTabBarPageList" );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleTabBarPageList::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Sequence< ::rtl::OUString > AccessibleTabBarPageList::getSupportedServiceNames() throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleTabBarPageList" );
+ return aNames;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessible
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleContext > AccessibleTabBarPageList::getAccessibleContext( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return this;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleContext
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPageList::getAccessibleChildCount() throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return m_aAccessibleChildren.size();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBarPageList::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ if ( !xChild.is() )
+ {
+ if ( m_pTabBar )
+ {
+ sal_uInt16 nPageId = m_pTabBar->GetPageId( (sal_uInt16)i );
+
+ xChild = new AccessibleTabBarPage( m_pTabBar, nPageId, this );
+
+ // insert into child list
+ m_aAccessibleChildren[i] = xChild;
+ }
+ }
+
+ return xChild;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBarPageList::getAccessibleParent( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xParent;
+ if ( m_pTabBar )
+ xParent = m_pTabBar->GetAccessible();
+
+ return xParent;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPageList::getAccessibleIndexInParent( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return m_nIndexInParent;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int16 AccessibleTabBarPageList::getAccessibleRole( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::PAGE_TAB_LIST;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPageList::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPageList::getAccessibleName( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleRelationSet > AccessibleTabBarPageList::getAccessibleRelationSet( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessibleStateSet > AccessibleTabBarPageList::getAccessibleStateSet( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+
+ if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ FillAccessibleStateSet( *pStateSetHelper );
+ }
+ else
+ {
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ }
+
+ return xSet;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Locale AccessibleTabBarPageList::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleComponent
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBarPageList::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xChild;
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XAccessible > xAcc = getAccessibleChild( i );
+ if ( xAcc.is() )
+ {
+ Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
+ if ( xComp.is() )
+ {
+ Rectangle aRect = VCLRectangle( xComp->getBounds() );
+ Point aPos = VCLPoint( rPoint );
+ if ( aRect.IsInside( aPos ) )
+ {
+ xChild = xAcc;
+ break;
+ }
+ }
+ }
+ }
+
+ return xChild;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::grabFocus( ) throw (RuntimeException)
+ {
+ // no focus
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPageList::getForeground( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getForeground();
+ }
+
+ return nColor;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPageList::getBackground( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getBackground();
+ }
+
+ return nColor;
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleExtendedComponent
+ // -----------------------------------------------------------------------------
+
+ Reference< awt::XFont > AccessibleTabBarPageList::getFont( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ Reference< awt::XFont > xFont;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ xFont = xParentComp->getFont();
+ }
+
+ return xFont;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPageList::getTitledBorderText( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+ }
+
+ // -----------------------------------------------------------------------------
+
+ ::rtl::OUString AccessibleTabBarPageList::getToolTipText( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+ }
+
+ // -----------------------------------------------------------------------------
+ // XAccessibleSelection
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ if ( m_pTabBar )
+ {
+ m_pTabBar->SetCurPageId( m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) );
+ m_pTabBar->Update();
+ m_pTabBar->ActivatePage();
+ m_pTabBar->Select();
+ }
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Bool AccessibleTabBarPageList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ sal_Bool bSelected = sal_False;
+ if ( m_pTabBar && m_pTabBar->GetCurPageId() == m_pTabBar->GetPageId( (sal_uInt16)nChildIndex ) )
+ bSelected = sal_True;
+
+ return bSelected;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::clearAccessibleSelection( ) throw (RuntimeException)
+ {
+ // This method makes no sense in a TabBar, and so does nothing.
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::selectAllAccessibleChildren( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ selectAccessibleChild( 0 );
+ }
+
+ // -----------------------------------------------------------------------------
+
+ sal_Int32 AccessibleTabBarPageList::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ return 1;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ Reference< XAccessible > AccessibleTabBarPageList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+
+ for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ )
+ {
+ if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
+ {
+ xChild = getAccessibleChild( i );
+ break;
+ }
+ }
+
+ return xChild;
+ }
+
+ // -----------------------------------------------------------------------------
+
+ void AccessibleTabBarPageList::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ // This method makes no sense in a TabBar, and so does nothing.
+ }
+
+ // -----------------------------------------------------------------------------
+
+//.........................................................................
+} // namespace accessibility
+//.........................................................................
diff --git a/accessibility/source/extended/accessibletablistbox.cxx b/accessibility/source/extended/accessibletablistbox.cxx
new file mode 100644
index 000000000000..aed68e55e482
--- /dev/null
+++ b/accessibility/source/extended/accessibletablistbox.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOX_HXX_
+#include "accessibility/extended/accessibletablistbox.hxx"
+#endif
+#include "accessibility/extended/accessibletablistboxtable.hxx"
+#include <svtools/svtabbx.hxx>
+#include <comphelper/sequence.hxx>
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ // class TLBSolarGuard ---------------------------------------------------------
+
+ /** Aquire the solar mutex. */
+ class TLBSolarGuard : public ::vos::OGuard
+ {
+ public:
+ inline TLBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
+ };
+
+ // class AccessibleTabListBox -----------------------------------------------------
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+
+ DBG_NAME(AccessibleTabListBox)
+
+ // -----------------------------------------------------------------------------
+ // Ctor() and Dtor()
+ // -----------------------------------------------------------------------------
+ AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox )
+ :AccessibleBrowseBox( rxParent, NULL, rBox )
+ ,m_pTabListBox( &rBox )
+
+ {
+ DBG_CTOR( AccessibleTabListBox, NULL );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ setCreator( this );
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ // -----------------------------------------------------------------------------
+ AccessibleTabListBox::~AccessibleTabListBox()
+ {
+ DBG_DTOR( AccessibleTabListBox, NULL );
+
+ if ( isAlive() )
+ {
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+ }
+ // -----------------------------------------------------------------------------
+ AccessibleBrowseBoxTable* AccessibleTabListBox::createAccessibleTable()
+ {
+ return new AccessibleTabListBoxTable( this, *m_pTabListBox );
+ }
+
+ // XInterface -----------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
+
+ // XTypeProvider --------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base )
+
+ // XAccessibleContext ---------------------------------------------------------
+
+ sal_Int32 SAL_CALL AccessibleTabListBox::getAccessibleChildCount()
+ throw ( uno::RuntimeException )
+ {
+ return 2; // header and table
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() throw ( RuntimeException )
+ {
+ return this;
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL
+ AccessibleTabListBox::getAccessibleChild( sal_Int32 nChildIndex )
+ throw ( IndexOutOfBoundsException, RuntimeException )
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+
+ if ( nChildIndex < 0 || nChildIndex > 1 )
+ throw IndexOutOfBoundsException();
+
+ 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();
+
+ return xRet;
+ }
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
diff --git a/accessibility/source/extended/accessibletablistboxtable.cxx b/accessibility/source/extended/accessibletablistboxtable.cxx
new file mode 100644
index 000000000000..a87ba9586098
--- /dev/null
+++ b/accessibility/source/extended/accessibletablistboxtable.cxx
@@ -0,0 +1,383 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+#ifndef ACCESSIBILITY_EXT_ACCESSIBLETABLISTBOXTABLE_HXX_
+#include "accessibility/extended/accessibletablistboxtable.hxx"
+#endif
+#include "accessibility/extended/AccessibleBrowseBoxTableCell.hxx"
+#include "accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx"
+#include <svtools/svtabbx.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ // class TLBSolarGuard ---------------------------------------------------------
+
+ /** Aquire the solar mutex. */
+ class TLBSolarGuard : public ::vos::OGuard
+ {
+ public:
+ inline TLBSolarGuard() : ::vos::OGuard( Application::GetSolarMutex() ) {}
+ };
+
+ // class AccessibleTabListBoxTable ---------------------------------------------
+
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star;
+
+ DBG_NAME(AccessibleTabListBoxTable)
+
+ // -----------------------------------------------------------------------------
+ // Ctor() and Dtor()
+ // -----------------------------------------------------------------------------
+ AccessibleTabListBoxTable::AccessibleTabListBoxTable( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) :
+
+ AccessibleBrowseBoxTable( rxParent, rBox ),
+
+ m_pTabListBox ( &rBox )
+
+ {
+ DBG_CTOR( AccessibleTabListBoxTable, NULL );
+
+ m_pTabListBox->AddEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) );
+ }
+ // -----------------------------------------------------------------------------
+ AccessibleTabListBoxTable::~AccessibleTabListBoxTable()
+ {
+ DBG_DTOR( AccessibleTabListBoxTable, NULL );
+
+ if ( isAlive() )
+ {
+ m_pTabListBox = NULL;
+
+ // increment ref count to prevent double call of Dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+ }
+ // -----------------------------------------------------------------------------
+ void AccessibleTabListBoxTable::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+ {
+ if ( isAlive() )
+ {
+ sal_uLong nEventId = rVclWindowEvent.GetId();
+ switch ( nEventId )
+ {
+ case VCLEVENT_OBJECT_DYING :
+ {
+ m_pTabListBox->RemoveEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) );
+ m_pTabListBox = NULL;
+ break;
+ }
+
+ case VCLEVENT_CONTROL_GETFOCUS :
+ case VCLEVENT_CONTROL_LOSEFOCUS :
+ {
+ uno::Any aOldValue, aNewValue;
+ if ( VCLEVENT_CONTROL_GETFOCUS == nEventId )
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ else
+ aOldValue <<= AccessibleStateType::FOCUSED;
+ commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue );
+ break;
+ }
+
+ case VCLEVENT_LISTBOX_SELECT :
+ {
+ // First send an event that tells the listeners of a
+ // modified selection. The active descendant event is
+ // send after that so that the receiving AT has time to
+ // read the text or name of the active child.
+ commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ if ( m_pTabListBox && m_pTabListBox->HasFocus() )
+ {
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry );
+ sal_uInt16 nCol = m_pTabListBox->GetCurrColumn();
+ Reference< XAccessible > xChild =
+ m_pTabListBox->CreateAccessibleCell( nRow, nCol );
+ uno::Any aOldValue, aNewValue;
+
+ if ( m_pTabListBox->IsTransientChildrenDisabled() )
+ {
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ TriState eState = STATE_DONTKNOW;
+ if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) )
+ {
+ AccessibleCheckBoxCell* pCell =
+ static_cast< AccessibleCheckBoxCell* >( xChild.get() );
+ pCell->commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue );
+ }
+ else
+ {
+ AccessibleBrowseBoxTableCell* pCell =
+ static_cast< AccessibleBrowseBoxTableCell* >( xChild.get() );
+ pCell->commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue );
+ }
+ }
+ else
+ {
+ aNewValue <<= xChild;
+ commitEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aNewValue, aOldValue );
+ }
+ }
+ }
+ break;
+ }
+
+ case VCLEVENT_CHECKBOX_TOGGLE :
+ {
+ if ( m_pTabListBox && m_pTabListBox->HasFocus() )
+ {
+ SvLBoxEntry* pEntry = static_cast< SvLBoxEntry* >( rVclWindowEvent.GetData() );
+ if ( pEntry )
+ {
+ sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry );
+ sal_uInt16 nCol = m_pTabListBox->GetCurrColumn();
+ TriState eState = STATE_DONTKNOW;
+ if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) )
+ {
+ Reference< XAccessible > xChild =
+ m_pTabListBox->CreateAccessibleCell( nRow, nCol );
+ AccessibleCheckBoxCell* pCell =
+ static_cast< AccessibleCheckBoxCell* >( xChild.get() );
+ pCell->SetChecked( m_pTabListBox->IsItemChecked( pEntry, nCol ) );
+ }
+ }
+ }
+ break;
+ }
+
+ case VCLEVENT_TABLECELL_NAMECHANGED :
+ {
+ if ( m_pTabListBox->IsTransientChildrenDisabled() )
+ {
+ commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+ TabListBoxEventData* pData = static_cast< TabListBoxEventData* >( rVclWindowEvent.GetData() );
+ SvLBoxEntry* pEntry = pData != NULL ? pData->m_pEntry : NULL;
+ if ( pEntry )
+ {
+ sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry );
+ sal_uInt16 nCol = pData->m_nColumn;
+ Reference< XAccessible > xChild =
+ m_pTabListBox->CreateAccessibleCell( nRow, nCol );
+ uno::Any aOldValue, aNewValue;
+ aOldValue <<= ::rtl::OUString( pData->m_sOldText );
+ ::rtl::OUString sNewText( m_pTabListBox->GetCellText( nRow, nCol ) );
+ aNewValue <<= sNewText;
+ TriState eState = STATE_DONTKNOW;
+
+ if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) )
+ {
+ AccessibleCheckBoxCell* pCell =
+ static_cast< AccessibleCheckBoxCell* >( xChild.get() );
+ pCell->commitEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
+ }
+ else
+ {
+ AccessibleBrowseBoxTableCell* pCell =
+ static_cast< AccessibleBrowseBoxTableCell* >( xChild.get() );
+ pCell->nameChanged( sNewText, pData->m_sOldText );
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ // -----------------------------------------------------------------------------
+ IMPL_LINK( AccessibleTabListBoxTable, WindowEventListener, VclSimpleEvent*, pEvent )
+ {
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ DBG_ASSERT( ( (VclWindowEvent*)pEvent )->GetWindow() && m_pTabListBox, "no event window" );
+ ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+ }
+ return 0;
+ }
+ // helpers --------------------------------------------------------------------
+
+ void AccessibleTabListBoxTable::ensureValidIndex( sal_Int32 _nIndex ) const
+ SAL_THROW( ( IndexOutOfBoundsException ) )
+ {
+ if ( ( _nIndex < 0 ) || ( _nIndex >= implGetCellCount() ) )
+ throw IndexOutOfBoundsException();
+ }
+
+ sal_Bool AccessibleTabListBoxTable::implIsRowSelected( sal_Int32 _nRow ) const
+ {
+ return m_pTabListBox ? m_pTabListBox->IsSelected( m_pTabListBox->GetEntry( _nRow ) ) : sal_False;
+ }
+
+ void AccessibleTabListBoxTable::implSelectRow( sal_Int32 _nRow, sal_Bool _bSelect )
+ {
+ if ( m_pTabListBox )
+ m_pTabListBox->Select( m_pTabListBox->GetEntry( _nRow ), _bSelect );
+ }
+
+ sal_Int32 AccessibleTabListBoxTable::implGetRowCount() const
+ {
+ return m_pTabListBox ? m_pTabListBox->GetEntryCount() : 0;
+ }
+
+ sal_Int32 AccessibleTabListBoxTable::implGetColumnCount() const
+ {
+ return m_pTabListBox ? m_pTabListBox->GetColumnCount() : 0;
+ }
+
+ sal_Int32 AccessibleTabListBoxTable::implGetSelRowCount() const
+ {
+ return m_pTabListBox ? m_pTabListBox->GetSelectionCount() : 0;
+ }
+
+ sal_Int32 AccessibleTabListBoxTable::implGetSelRow( sal_Int32 nSelRow ) const
+ {
+ if ( m_pTabListBox )
+ {
+ sal_Int32 nRow = 0;
+ SvLBoxEntry* pEntry = m_pTabListBox->FirstSelected();
+ while ( pEntry )
+ {
+ ++nRow;
+ if ( nRow == nSelRow )
+ return m_pTabListBox->GetEntryPos( pEntry );
+ pEntry = m_pTabListBox->NextSelected( pEntry );
+ }
+ }
+
+ return 0;
+ }
+ // -----------------------------------------------------------------------------
+ // XInterface & XTypeProvider
+ // -----------------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper)
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper)
+ // -----------------------------------------------------------------------------
+ // XServiceInfo
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString AccessibleTabListBoxTable::getImplementationName (void) throw (RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.svtools.AccessibleTabListBoxTable");
+ }
+ // -----------------------------------------------------------------------------
+ // XAccessibleSelection
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleTabListBoxTable::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+ ensureValidIndex( nChildIndex );
+
+ implSelectRow( implGetRow( nChildIndex ), sal_True );
+ }
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL AccessibleTabListBoxTable::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+ ensureValidIndex( nChildIndex );
+
+ return implIsRowSelected( implGetRow( nChildIndex ) );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleTabListBoxTable::clearAccessibleSelection( ) throw (RuntimeException)
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+
+ m_pTabListBox->SetNoSelection();
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleTabListBoxTable::selectAllAccessibleChildren( ) throw (RuntimeException)
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+
+ m_pTabListBox->SelectAll();
+ }
+ // -----------------------------------------------------------------------------
+ sal_Int32 SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+
+ return implGetColumnCount() * implGetSelRowCount();
+ }
+ // -----------------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+
+ sal_Int32 nRows = implGetSelRowCount();
+ if ( nRows == 0 )
+ throw IndexOutOfBoundsException();
+
+ sal_Int32 nRow = implGetSelRow( nSelectedChildIndex % nRows );
+ sal_Int32 nColumn = nSelectedChildIndex / nRows;
+ return getAccessibleCellAt( nRow, nColumn );
+ }
+ // -----------------------------------------------------------------------------
+ void SAL_CALL AccessibleTabListBoxTable::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ TLBSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+
+ ensureIsAlive();
+ ensureValidIndex( nSelectedChildIndex );
+
+ implSelectRow( implGetRow( nSelectedChildIndex ), sal_False );
+ }
+
+//........................................................................
+}// namespace accessibility
+//........................................................................
+
diff --git a/accessibility/source/extended/listboxaccessible.cxx b/accessibility/source/extended/listboxaccessible.cxx
new file mode 100644
index 000000000000..8600003c2bff
--- /dev/null
+++ b/accessibility/source/extended/listboxaccessible.cxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/extended/listboxaccessible.hxx>
+#include <svtools/svtreebx.hxx>
+
+//........................................................................
+namespace accessibility
+{
+//........................................................................
+
+ //====================================================================
+ //= ListBoxAccessibleBase
+ //====================================================================
+ //--------------------------------------------------------------------
+ ListBoxAccessibleBase::ListBoxAccessibleBase( SvTreeListBox& _rWindow )
+ :m_pWindow( &_rWindow )
+ {
+ m_pWindow->AddEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
+ }
+
+ //--------------------------------------------------------------------
+ ListBoxAccessibleBase::~ListBoxAccessibleBase( )
+ {
+ if ( m_pWindow )
+ {
+ // cannot call "dispose" here, as it is abstract, so the VTABLE of the derived class
+ // is not intact anymore
+ // so we call our "disposing" only
+ disposing();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ IMPL_LINK( ListBoxAccessibleBase, WindowEventListener, VclSimpleEvent*, pEvent )
+ {
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "ListBoxAccessibleBase::WindowEventListener: unexpected WindowEvent!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ DBG_ASSERT( static_cast< VclWindowEvent* >( pEvent )->GetWindow() , "ListBoxAccessibleBase::WindowEventListener: no event window!" );
+ DBG_ASSERT( static_cast< VclWindowEvent* >( pEvent )->GetWindow() == m_pWindow, "ListBoxAccessibleBase::WindowEventListener: where did this come from?" );
+
+ ProcessWindowEvent( *static_cast< VclWindowEvent* >( pEvent ) );
+ }
+ return 0;
+ }
+
+ // -----------------------------------------------------------------------------
+ void ListBoxAccessibleBase::disposing()
+ {
+ if ( m_pWindow )
+ m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
+ m_pWindow = NULL;
+ }
+
+ // -----------------------------------------------------------------------------
+ void ListBoxAccessibleBase::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+ {
+ if ( isAlive() )
+ {
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_OBJECT_DYING :
+ {
+ if ( m_pWindow )
+ m_pWindow->RemoveEventListener( LINK( this, ListBoxAccessibleBase, WindowEventListener ) );
+ m_pWindow = NULL;
+ dispose();
+ break;
+ }
+ }
+ }
+ }
+
+//........................................................................
+} // namespace accessibility
+//........................................................................
diff --git a/accessibility/source/extended/makefile.mk b/accessibility/source/extended/makefile.mk
new file mode 100755
index 000000000000..27f4403c8210
--- /dev/null
+++ b/accessibility/source/extended/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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=accessibility
+TARGET=extended
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+.IF "$(OS)$(COM)"=="SOLARISI"
+NOOPTFILES=$(SLO)$/accessibletabbarpagelist.obj
+.ENDIF # "$(OS)$(COM)"=="SOLARISI"
+
+SLOFILES=\
+ $(SLO)$/AccessibleBrowseBoxCheckBoxCell.obj \
+ $(SLO)$/AccessibleBrowseBoxBase.obj \
+ $(SLO)$/AccessibleBrowseBox.obj \
+ $(SLO)$/AccessibleBrowseBoxTableCell.obj \
+ $(SLO)$/AccessibleBrowseBoxHeaderCell.obj \
+ $(SLO)$/AccessibleBrowseBoxTableBase.obj \
+ $(SLO)$/AccessibleBrowseBoxTable.obj \
+ $(SLO)$/AccessibleBrowseBoxHeaderBar.obj \
+ $(SLO)$/accessibleiconchoicectrl.obj \
+ $(SLO)$/accessibleiconchoicectrlentry.obj \
+ $(SLO)$/accessiblelistbox.obj \
+ $(SLO)$/accessiblelistboxentry.obj \
+ $(SLO)$/accessibletabbarbase.obj \
+ $(SLO)$/accessibletabbar.obj \
+ $(SLO)$/accessibletabbarpage.obj \
+ $(SLO)$/accessibletabbarpagelist.obj \
+ $(SLO)$/accessibletablistbox.obj \
+ $(SLO)$/accessibletablistboxtable.obj \
+ $(SLO)$/listboxaccessible.obj \
+ $(SLO)$/accessiblebrowseboxcell.obj \
+ $(SLO)$/accessibleeditbrowseboxcell.obj \
+ $(SLO)$/textwindowaccessibility.obj \
+ $(SLO)$/AccessibleGridControlBase.obj \
+ $(SLO)$/AccessibleGridControl.obj \
+ $(SLO)$/AccessibleGridControlTableBase.obj \
+ $(SLO)$/AccessibleGridControlHeader.obj \
+ $(SLO)$/AccessibleGridControlTableCell.obj \
+ $(SLO)$/AccessibleGridControlHeaderCell.obj \
+ $(SLO)$/AccessibleGridControlTable.obj \
+ $(SLO)$/AccessibleToolPanelDeck.obj \
+ $(SLO)$/AccessibleToolPanelDeckTabBar.obj \
+ $(SLO)$/AccessibleToolPanelDeckTabBarItem.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
new file mode 100644
index 000000000000..5b669033fcfd
--- /dev/null
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -0,0 +1,2254 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+#include <accessibility/extended/textwindowaccessibility.hxx>
+#endif
+#include "comphelper/accessibleeventnotifier.hxx"
+#include "unotools/accessiblerelationsethelper.hxx"
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/window.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <algorithm>
+#include <vector>
+#include <hash_map>
+
+namespace css = ::com::sun::star;
+
+namespace accessibility
+{
+
+// Both ::osl::Mutex and ParagraphBase implement acquire and release, and thus
+// ::rtl::Reference< Paragraph > does not work. So ParagraphImpl was factored
+// out and ::rtl::Reference< ParagraphImpl > is used instead.
+class Paragraph: private ::osl::Mutex, public ParagraphImpl
+{
+public:
+ inline Paragraph(::rtl::Reference< Document > const & rDocument,
+ Paragraphs::size_type nNumber):
+ ParagraphImpl(rDocument, nNumber, *this) {}
+};
+
+void SfxListenerGuard::startListening(::SfxBroadcaster & rNotifier)
+{
+ OSL_ENSURE(m_pNotifier == 0, "called more than once");
+ m_pNotifier = &rNotifier;
+ m_rListener.StartListening(*m_pNotifier, true);
+}
+
+void SfxListenerGuard::endListening()
+{
+ if (m_pNotifier != 0)
+ {
+ m_rListener.EndListening(*m_pNotifier);
+ m_pNotifier = 0;
+ }
+}
+
+void WindowListenerGuard::startListening(::Window & rNotifier)
+{
+ OSL_ENSURE(m_pNotifier == 0, "called more than once");
+ m_pNotifier = &rNotifier;
+ m_pNotifier->AddEventListener(m_aListener);
+}
+
+void WindowListenerGuard::endListening()
+{
+ if (m_pNotifier != 0)
+ {
+ m_pNotifier->RemoveEventListener(m_aListener);
+ m_pNotifier = 0;
+ }
+}
+
+ParagraphImpl::ParagraphImpl(::rtl::Reference< Document > const & rDocument,
+ Paragraphs::size_type nNumber,
+ ::osl::Mutex & rMutex):
+ ParagraphBase(rMutex),
+ m_xDocument(rDocument),
+ m_nNumber(nNumber),
+ m_nClientId(0)
+{
+ m_aParagraphText = m_xDocument->retrieveParagraphText(this);
+}
+
+void
+ParagraphImpl::numberChanged(bool bIncremented)
+{
+ if (bIncremented)
+ ++m_nNumber;
+ else
+ --m_nNumber;
+}
+
+void ParagraphImpl::textChanged()
+{
+ ::rtl::OUString aParagraphText = implGetText();
+ ::css::uno::Any aOldValue, aNewValue;
+ if ( implInitTextChangedEvent( m_aParagraphText, aParagraphText, aOldValue, aNewValue ) )
+ {
+ m_aParagraphText = aParagraphText;
+ notifyEvent(::css::accessibility::AccessibleEventId::
+ TEXT_CHANGED,
+ aOldValue, aNewValue);
+ }
+}
+
+void ParagraphImpl::notifyEvent(::sal_Int16 nEventId,
+ ::css::uno::Any const & rOldValue,
+ ::css::uno::Any const & rNewValue)
+{
+ if (m_nClientId)
+ comphelper::AccessibleEventNotifier::addEvent( m_nClientId, ::css::accessibility::AccessibleEventObject(
+ static_cast< ::cppu::OWeakObject * >(this),
+ nEventId, rNewValue, rOldValue) );
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessibleContext > SAL_CALL
+ParagraphImpl::getAccessibleContext() throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return this;
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getAccessibleChildCount()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return 0;
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+ParagraphImpl::getAccessibleChild(::sal_Int32)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " ParagraphImpl::getAccessibleChild")),
+ static_cast< ::css::uno::XWeak * >(this));
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+ParagraphImpl::getAccessibleParent()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->getAccessible();
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getAccessibleIndexInParent()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveParagraphIndex(this);
+}
+
+// virtual
+::sal_Int16 SAL_CALL ParagraphImpl::getAccessibleRole()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return ::css::accessibility::AccessibleRole::PARAGRAPH;
+}
+
+// virtual
+::rtl::OUString SAL_CALL ParagraphImpl::getAccessibleDescription()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return ::rtl::OUString();
+}
+
+// virtual
+::rtl::OUString SAL_CALL ParagraphImpl::getAccessibleName()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return ::rtl::OUString();
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet >
+SAL_CALL ParagraphImpl::getAccessibleRelationSet()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveParagraphRelationSet( this );
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessibleStateSet >
+SAL_CALL ParagraphImpl::getAccessibleStateSet()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+
+ // FIXME Notification of changes (STATE_CHANGED) missing when
+ // m_rView.IsReadOnly() changes:
+ return new ::utl::AccessibleStateSetHelper(
+ m_xDocument->retrieveParagraphState(this));
+}
+
+// virtual
+::css::lang::Locale SAL_CALL ParagraphImpl::getLocale()
+ throw (::css::accessibility::IllegalAccessibleComponentStateException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveLocale();
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::containsPoint(::css::awt::Point const & rPoint)
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this,
+ false));
+ return rPoint.X >= 0 && rPoint.X < aRect.Width
+ && rPoint.Y >= 0 && rPoint.Y < aRect.Height;
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+ParagraphImpl::getAccessibleAtPoint(::css::awt::Point const &)
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return 0;
+}
+
+// virtual
+::css::awt::Rectangle SAL_CALL ParagraphImpl::getBounds()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveParagraphBounds(this, false);
+}
+
+// virtual
+::css::awt::Point SAL_CALL ParagraphImpl::getLocation()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this,
+ false));
+ return ::css::awt::Point(aRect.X, aRect.Y);
+}
+
+// virtual
+::css::awt::Point SAL_CALL ParagraphImpl::getLocationOnScreen()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this,
+ true));
+ return ::css::awt::Point(aRect.X, aRect.Y);
+}
+
+// virtual
+::css::awt::Size SAL_CALL ParagraphImpl::getSize()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ ::css::awt::Rectangle aRect(m_xDocument->retrieveParagraphBounds(this,
+ false));
+ return ::css::awt::Size(aRect.Width, aRect.Height);
+}
+
+// virtual
+void SAL_CALL ParagraphImpl::grabFocus() throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ Window* pWindow = m_xDocument->GetWindow();
+ if ( pWindow )
+ {
+ pWindow->GrabFocus();
+ }
+ try
+ {
+ m_xDocument->changeParagraphSelection(this, 0, 0);
+ }
+ catch (::css::lang::IndexOutOfBoundsException & rEx)
+ {
+ OSL_TRACE(
+ "textwindowaccessibility.cxx: ParagraphImpl::grabFocus:"
+ " caught unexpected %s\n",
+ ::rtl::OUStringToOString(rEx.Message, RTL_TEXTENCODING_UTF8).
+ getStr());
+ }
+}
+
+// virtual
+::css::uno::Any SAL_CALL ParagraphImpl::getAccessibleKeyBinding()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return ::css::uno::Any();
+}
+
+// virtual
+::css::util::Color SAL_CALL ParagraphImpl::getForeground()
+ throw (::css::uno::RuntimeException)
+{
+ return 0; // TODO
+}
+
+// virtual
+::css::util::Color SAL_CALL ParagraphImpl::getBackground()
+ throw (::css::uno::RuntimeException)
+{
+ return 0; // TODO
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getCaretPosition()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveParagraphCaretPosition(this);
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::setCaretPosition(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphSelection(this, nIndex, nIndex);
+ return true;
+}
+
+// virtual
+::sal_Unicode SAL_CALL ParagraphImpl::getCharacter(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getCharacter(nIndex);
+}
+
+// virtual
+::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
+ParagraphImpl::getCharacterAttributes(::sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveCharacterAttributes( this, nIndex, aRequestedAttributes );
+}
+
+// virtual
+::css::awt::Rectangle SAL_CALL
+ParagraphImpl::getCharacterBounds(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ ::css::awt::Rectangle aBounds(m_xDocument->retrieveCharacterBounds(this, nIndex));
+ ::css::awt::Rectangle aParaBounds(m_xDocument->retrieveParagraphBounds(this, false));
+ aBounds.X -= aParaBounds.X;
+ aBounds.Y -= aParaBounds.Y;
+ return aBounds;
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getCharacterCount()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getCharacterCount();
+}
+
+// virtual
+::sal_Int32 SAL_CALL
+ParagraphImpl::getIndexAtPoint(::css::awt::Point const & rPoint)
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ ::css::awt::Point aPoint(rPoint);
+ ::css::awt::Rectangle aParaBounds(m_xDocument->retrieveParagraphBounds(this, false));
+ aPoint.X += aParaBounds.X;
+ aPoint.Y += aParaBounds.Y;
+ return m_xDocument->retrieveCharacterIndex(this, aPoint);
+}
+
+// virtual
+::rtl::OUString SAL_CALL ParagraphImpl::getSelectedText()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+
+ return OCommonAccessibleText::getSelectedText();
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getSelectionStart()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getSelectionStart();
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getSelectionEnd()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getSelectionEnd();
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::setSelection(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphSelection(this, nStartIndex, nEndIndex);
+ return true;
+}
+
+// virtual
+::rtl::OUString SAL_CALL ParagraphImpl::getText()
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getText();
+}
+
+// virtual
+::rtl::OUString SAL_CALL ParagraphImpl::getTextRange(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getTextRange(nStartIndex, nEndIndex);
+}
+
+// virtual
+::com::sun::star::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getTextAtIndex(nIndex, aTextType);
+}
+
+// virtual
+::com::sun::star::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getTextBeforeIndex(nIndex, aTextType);
+}
+
+// virtual
+::com::sun::star::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ checkDisposed();
+ return OCommonAccessibleText::getTextBehindIndex(nIndex, aTextType);
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::copyText(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->copyParagraphText(this, nStartIndex, nEndIndex);
+ return true;
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::cutText(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphText(this, nStartIndex, nEndIndex, true, false,
+ ::rtl::OUString());
+ return true;
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::pasteText(::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphText(this, nIndex, nIndex, false, true,
+ ::rtl::OUString());
+ return true;
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::deleteText(::sal_Int32 nStartIndex,
+ ::sal_Int32 nEndIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphText(this, nStartIndex, nEndIndex, false, false,
+ ::rtl::OUString());
+ return true;
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::insertText(::rtl::OUString const & rText,
+ ::sal_Int32 nIndex)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphText(this, nIndex, nIndex, false, false, rText);
+ return true;
+}
+
+// virtual
+::sal_Bool SAL_CALL
+ParagraphImpl::replaceText(::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex,
+ ::rtl::OUString const & rReplacement)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphText(this, nStartIndex, nEndIndex, false, false,
+ rReplacement);
+ return true;
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::setAttributes(
+ ::sal_Int32 nStartIndex, ::sal_Int32 nEndIndex,
+ ::css::uno::Sequence< ::css::beans::PropertyValue > const & rAttributeSet)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphAttributes(this, nStartIndex, nEndIndex,
+ rAttributeSet);
+ return true;
+}
+
+// virtual
+::sal_Bool SAL_CALL ParagraphImpl::setText(::rtl::OUString const & rText)
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ m_xDocument->changeParagraphText(this, rText);
+ return true;
+}
+
+// virtual
+::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
+ParagraphImpl::getDefaultAttributes(const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveDefaultAttributes( this, RequestedAttributes );
+}
+
+// virtual
+::css::uno::Sequence< ::css::beans::PropertyValue > SAL_CALL
+ParagraphImpl::getRunAttributes(::sal_Int32 Index, const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveRunAttributes( this, Index, RequestedAttributes );
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getLineNumberAtIndex( ::sal_Int32 nIndex )
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+
+ ::sal_Int32 nLineNo = -1;
+ ::css::i18n::Boundary aBoundary =
+ m_xDocument->retrieveParagraphLineBoundary( this, nIndex, &nLineNo );
+
+ return nLineNo;
+}
+
+// virtual
+::css::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextAtLineNumber( ::sal_Int32 nLineNo )
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ checkDisposed();
+
+ ::css::i18n::Boundary aBoundary =
+ m_xDocument->retrieveParagraphBoundaryOfLine( this, nLineNo );
+
+ return ::css::accessibility::TextSegment( getTextRange(aBoundary.startPos, aBoundary.endPos),
+ aBoundary.startPos, aBoundary.endPos);
+}
+
+// virtual
+::css::accessibility::TextSegment SAL_CALL ParagraphImpl::getTextAtLineWithCaret( )
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+
+ sal_Int32 nLineNo = getNumberOfLineWithCaret();
+
+ try {
+ return ( nLineNo >= 0 ) ?
+ getTextAtLineNumber( nLineNo ) :
+ ::css::accessibility::TextSegment();
+ } catch (const ::css::lang::IndexOutOfBoundsException&) {
+ throw ::css::uno::RuntimeException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " ParagraphImpl::getTextAtLineWithCaret") ),
+ static_cast< ::css::uno::XWeak * >( this ) );
+ }
+}
+
+// virtual
+::sal_Int32 SAL_CALL ParagraphImpl::getNumberOfLineWithCaret( )
+ throw (::css::uno::RuntimeException)
+{
+ checkDisposed();
+ return m_xDocument->retrieveParagraphLineWithCursor(this);
+}
+
+
+// virtual
+void SAL_CALL ParagraphImpl::addEventListener(
+ ::css::uno::Reference<
+ ::css::accessibility::XAccessibleEventListener > const & rListener)
+ throw (::css::uno::RuntimeException)
+{
+ if (rListener.is())
+ {
+ ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ aGuard.clear();
+ rListener->disposing(::css::lang::EventObject(
+ static_cast< ::cppu::OWeakObject * >(this)));
+ }
+ else
+ {
+ if (!m_nClientId)
+ m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, rListener );
+ }
+ }
+}
+
+// virtual
+void SAL_CALL ParagraphImpl::removeEventListener(
+ ::css::uno::Reference<
+ ::css::accessibility::XAccessibleEventListener > const & rListener)
+ throw (::css::uno::RuntimeException)
+{
+ comphelper::AccessibleEventNotifier::TClientId nId = 0;
+ {
+ ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
+ if (rListener.is() && m_nClientId != 0
+ && comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, rListener ) == 0)
+ {
+ nId = m_nClientId;
+ m_nClientId = 0;
+ }
+ }
+ if (nId != 0)
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient(nId);
+ }
+}
+
+// virtual
+void SAL_CALL ParagraphImpl::disposing()
+{
+ comphelper::AccessibleEventNotifier::TClientId nId = 0;
+ {
+ ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
+ nId = m_nClientId;
+ m_nClientId = 0;
+ }
+ if (nId != 0)
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing(nId, *this);
+}
+
+// virtual
+::rtl::OUString ParagraphImpl::implGetText()
+{
+ return m_xDocument->retrieveParagraphText(this);
+}
+
+// virtual
+::css::lang::Locale ParagraphImpl::implGetLocale()
+{
+ return m_xDocument->retrieveLocale();
+}
+
+// virtual
+void ParagraphImpl::implGetSelection(::sal_Int32 & rStartIndex,
+ ::sal_Int32 & rEndIndex)
+{
+ m_xDocument->retrieveParagraphSelection(this, &rStartIndex, &rEndIndex);
+}
+
+// virtual
+void ParagraphImpl::implGetParagraphBoundary( ::css::i18n::Boundary& rBoundary,
+ ::sal_Int32 nIndex )
+{
+ ::rtl::OUString sText( implGetText() );
+ ::sal_Int32 nLength = sText.getLength();
+
+ if ( implIsValidIndex( nIndex, nLength ) )
+ {
+ rBoundary.startPos = 0;
+ rBoundary.endPos = nLength;
+ }
+ else
+ {
+ rBoundary.startPos = nIndex;
+ rBoundary.endPos = nIndex;
+ }
+}
+
+// virtual
+void ParagraphImpl::implGetLineBoundary( ::css::i18n::Boundary& rBoundary,
+ ::sal_Int32 nIndex )
+{
+ ::rtl::OUString sText( implGetText() );
+ ::sal_Int32 nLength = sText.getLength();
+
+ if ( implIsValidIndex( nIndex, nLength ) || nIndex == nLength )
+ {
+ ::css::i18n::Boundary aBoundary =
+ m_xDocument->retrieveParagraphLineBoundary( this, nIndex );
+ rBoundary.startPos = aBoundary.startPos;
+ rBoundary.endPos = aBoundary.endPos;
+ }
+ else
+ {
+ rBoundary.startPos = nIndex;
+ rBoundary.endPos = nIndex;
+ }
+}
+
+
+void ParagraphImpl::checkDisposed()
+{
+ ::osl::MutexGuard aGuard(rBHelper.rMutex);
+ if (!(rBHelper.bDisposed || rBHelper.bInDispose))
+ return;
+ throw ::css::lang::DisposedException(
+ ::rtl::OUString(), static_cast< ::css::uno::XWeak * >(this));
+}
+
+Document::Document(::VCLXWindow * pVclXWindow, ::TextEngine & rEngine,
+ ::TextView & rView, bool bCompoundControlChild):
+ VCLXAccessibleComponent(pVclXWindow),
+ m_xAccessible(pVclXWindow),
+ m_rEngine(rEngine),
+ m_rView(rView),
+ m_aEngineListener(*this),
+ m_aViewListener(LINK(this, Document, WindowEventHandler)),
+ m_bCompoundControlChild(bCompoundControlChild)
+{}
+
+::css::lang::Locale Document::retrieveLocale()
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ return m_rEngine.GetLocale();
+}
+
+::sal_Int32 Document::retrieveParagraphIndex(ParagraphImpl const * pParagraph)
+{
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+
+ // If a client holds on to a Paragraph that is no longer visible, it can
+ // happen that this Paragraph lies outside the range from m_aVisibleBegin
+ // to m_aVisibleEnd. In that case, return -1 instead of a valid index:
+ Paragraphs::iterator aPara(m_xParagraphs->begin()
+ + pParagraph->getNumber());
+ return aPara < m_aVisibleBegin || aPara >= m_aVisibleEnd
+ ? -1 : static_cast< ::sal_Int32 >(aPara - m_aVisibleBegin);
+ // XXX numeric overflow
+}
+
+::sal_Int64 Document::retrieveParagraphState(ParagraphImpl const * pParagraph)
+{
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+
+ // If a client holds on to a Paragraph that is no longer visible, it can
+ // happen that this Paragraph lies outside the range from m_aVisibleBegin
+ // to m_aVisibleEnd. In that case, it is neither VISIBLE nor SHOWING:
+ ::sal_Int64 nState
+ = (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::ENABLED)
+ | (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::SENSITIVE)
+ | (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::FOCUSABLE)
+ | (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::MULTI_LINE);
+ if (!m_rView.IsReadOnly())
+ nState |= (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::EDITABLE);
+ Paragraphs::iterator aPara(m_xParagraphs->begin()
+ + pParagraph->getNumber());
+ if (aPara >= m_aVisibleBegin && aPara < m_aVisibleEnd)
+ {
+ nState
+ |= (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::VISIBLE)
+ | (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::SHOWING);
+ if (aPara == m_aFocused)
+ nState |= (static_cast< ::sal_Int64 >(1)
+ << ::css::accessibility::AccessibleStateType::FOCUSED);
+ }
+ return nState;
+};
+
+::css::awt::Rectangle
+Document::retrieveParagraphBounds(ParagraphImpl const * pParagraph,
+ bool bAbsolute)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+
+ // If a client holds on to a Paragraph that is no longer visible (as it
+ // scrolled out the top of the view), it can happen that this Paragraph
+ // lies before m_aVisibleBegin. In that case, calculate the vertical
+ // position of the Paragraph starting at paragraph 0, otherwise optimize
+ // and start at m_aVisibleBegin:
+ Paragraphs::iterator aPara(m_xParagraphs->begin()
+ + pParagraph->getNumber());
+ ::sal_Int32 nPos;
+ Paragraphs::iterator aIt;
+ if (aPara < m_aVisibleBegin)
+ {
+ nPos = 0;
+ aIt = m_xParagraphs->begin();
+ }
+ else
+ {
+ nPos = m_nViewOffset - m_nVisibleBeginOffset;
+ aIt = m_aVisibleBegin;
+ }
+ for (; aIt != aPara; ++aIt)
+ nPos += aIt->getHeight();
+
+ Point aOrig(0, 0);
+ if (bAbsolute)
+ aOrig = m_rView.GetWindow()->OutputToAbsoluteScreenPixel(aOrig);
+
+ return ::css::awt::Rectangle(
+ static_cast< ::sal_Int32 >(aOrig.X()),
+ static_cast< ::sal_Int32 >(aOrig.Y()) + nPos - m_nViewOffset,
+ m_rView.GetWindow()->GetOutputSizePixel().Width(), aPara->getHeight());
+ // XXX numeric overflow (3x)
+}
+
+::rtl::OUString
+Document::retrieveParagraphText(ParagraphImpl const * pParagraph)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ return m_rEngine.GetText(static_cast< ::sal_uLong >(pParagraph->getNumber()));
+ // numeric overflow cannot happen here
+}
+
+void Document::retrieveParagraphSelection(ParagraphImpl const * pParagraph,
+ ::sal_Int32 * pBegin,
+ ::sal_Int32 * pEnd)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::TextSelection const & rSelection = m_rView.GetSelection();
+ Paragraphs::size_type nNumber = pParagraph->getNumber();
+ TextPaM aStartPaM( rSelection.GetStart() );
+ TextPaM aEndPaM( rSelection.GetEnd() );
+ TextPaM aMinPaM( ::std::min( aStartPaM, aEndPaM ) );
+ TextPaM aMaxPaM( ::std::max( aStartPaM, aEndPaM ) );
+
+ if ( nNumber >= aMinPaM.GetPara() && nNumber <= aMaxPaM.GetPara() )
+ {
+ *pBegin = nNumber > aMinPaM.GetPara()
+ ? 0
+ : static_cast< ::sal_Int32 >( aMinPaM.GetIndex() );
+ // XXX numeric overflow
+ *pEnd = nNumber < aMaxPaM.GetPara()
+ ? static_cast< ::sal_Int32 >( m_rEngine.GetText(static_cast< ::sal_uLong >(nNumber)).Len() )
+ : static_cast< ::sal_Int32 >( aMaxPaM.GetIndex() );
+ // XXX numeric overflow (3x)
+
+ if ( aStartPaM > aEndPaM )
+ ::std::swap( *pBegin, *pEnd );
+ }
+ else
+ {
+ *pBegin = 0;
+ *pEnd = 0;
+ }
+}
+
+::sal_Int32 Document::retrieveParagraphCaretPosition(ParagraphImpl const * pParagraph)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::TextSelection const & rSelection = m_rView.GetSelection();
+ Paragraphs::size_type nNumber = pParagraph->getNumber();
+ TextPaM aEndPaM( rSelection.GetEnd() );
+
+ return aEndPaM.GetPara() == nNumber
+ ? static_cast< ::sal_Int32 >(aEndPaM.GetIndex()) : -1;
+}
+
+::css::awt::Rectangle
+Document::retrieveCharacterBounds(ParagraphImpl const * pParagraph,
+ ::sal_Int32 nIndex)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ sal_Int32 nLength = m_rEngine.GetText(nNumber).Len();
+ // XXX numeric overflow
+ if (nIndex < 0 || nIndex > nLength)
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::retrieveCharacterAttributes")),
+ static_cast< ::css::uno::XWeak * >(this));
+ ::css::awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( nIndex == nLength )
+ {
+ aBounds = AWTRectangle(
+ m_rEngine.PaMtoEditCursor(::TextPaM(nNumber,
+ static_cast< ::sal_uInt16 >(nIndex))));
+ }
+ else
+ {
+ ::Rectangle aLeft(
+ m_rEngine.PaMtoEditCursor(::TextPaM(nNumber,
+ static_cast< ::sal_uInt16 >(nIndex))));
+ // XXX numeric overflow
+ ::Rectangle aRight(
+ m_rEngine.PaMtoEditCursor(::TextPaM(nNumber,
+ static_cast< ::sal_uInt16 >(nIndex)
+ + 1)));
+ // XXX numeric overflow (2x)
+ // FIXME If the vertical extends of the two cursors do not match, assume
+ // nIndex is the last character on the line; the bounding box will then
+ // extend to m_rEnginge.GetMaxTextWidth():
+ ::sal_Int32 nWidth = (aLeft.Top() == aRight.Top()
+ && aLeft.Bottom() == aRight.Bottom())
+ ? static_cast< ::sal_Int32 >(aRight.Left() - aLeft.Left())
+ : static_cast< ::sal_Int32 >(m_rEngine.GetMaxTextWidth()
+ - aLeft.Left());
+ // XXX numeric overflow (4x)
+ aBounds = ::css::awt::Rectangle(static_cast< ::sal_Int32 >(aLeft.Left()),
+ static_cast< ::sal_Int32 >(aLeft.Top() - m_nViewOffset),
+ nWidth,
+ static_cast< ::sal_Int32 >(aLeft.Bottom()
+ - aLeft.Top()));
+ // XXX numeric overflow (4x)
+ }
+ return aBounds;
+}
+
+::sal_Int32 Document::retrieveCharacterIndex(ParagraphImpl const * pParagraph,
+ ::css::awt::Point const & rPoint)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ // XXX numeric overflow
+ ::TextPaM aPaM(m_rEngine.GetPaM(::Point(static_cast< long >(rPoint.X),
+ static_cast< long >(rPoint.Y))));
+ // XXX numeric overflow (2x)
+ return aPaM.GetPara() == nNumber
+ ? static_cast< ::sal_Int32 >(aPaM.GetIndex()) : -1;
+ // XXX numeric overflow
+}
+
+::css::uno::Sequence< ::css::beans::PropertyValue >
+Document::retrieveCharacterAttributes(
+ ParagraphImpl const * pParagraph, ::sal_Int32 nIndex,
+ const ::css::uno::Sequence< ::rtl::OUString >& aRequestedAttributes)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ // XXX numeric overflow
+ if (nIndex < 0 || nIndex >= m_rEngine.GetText(nNumber).Len())
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::retrieveCharacterAttributes")),
+ static_cast< ::css::uno::XWeak * >(this));
+
+ // retrieve default attributes
+ tPropValMap aCharAttrSeq;
+ retrieveDefaultAttributesImpl( pParagraph, aRequestedAttributes, aCharAttrSeq );
+
+ // retrieve run attributes
+ tPropValMap aRunAttrSeq;
+ retrieveRunAttributesImpl( pParagraph, nIndex, aRequestedAttributes, aRunAttrSeq );
+
+ // merge default and run attributes
+ for ( tPropValMap::const_iterator aRunIter = aRunAttrSeq.begin();
+ aRunIter != aRunAttrSeq.end();
+ ++aRunIter )
+ {
+ aCharAttrSeq[ aRunIter->first ] = aRunIter->second;
+ }
+
+ return convertHashMapToSequence( aCharAttrSeq );
+}
+
+void Document::retrieveDefaultAttributesImpl(
+ ParagraphImpl const * pParagraph,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes,
+ tPropValMap& rDefAttrSeq)
+{
+ // default attributes are not supported by text engine
+ (void) pParagraph;
+ (void) RequestedAttributes;
+ (void) rDefAttrSeq;
+}
+
+::css::uno::Sequence< ::css::beans::PropertyValue >
+Document::retrieveDefaultAttributes(
+ ParagraphImpl const * pParagraph,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() );
+ ::osl::MutexGuard aInternalGuard( GetMutex() );
+
+ tPropValMap aDefAttrSeq;
+ retrieveDefaultAttributesImpl( pParagraph, RequestedAttributes, aDefAttrSeq );
+ return convertHashMapToSequence( aDefAttrSeq );
+}
+
+// static
+::css::uno::Sequence< ::css::beans::PropertyValue >
+Document::convertHashMapToSequence(tPropValMap& rAttrSeq)
+{
+ ::css::uno::Sequence< ::css::beans::PropertyValue > aValues( rAttrSeq.size() );
+ ::css::beans::PropertyValue* pValues = aValues.getArray();
+ ::sal_Int32 i = 0;
+ for ( tPropValMap::const_iterator aIter = rAttrSeq.begin();
+ aIter != rAttrSeq.end();
+ ++aIter )
+ {
+ pValues[i] = aIter->second;
+ ++i;
+ }
+ return aValues;
+}
+
+void Document::retrieveRunAttributesImpl(
+ ParagraphImpl const * pParagraph, ::sal_Int32 Index,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes,
+ tPropValMap& rRunAttrSeq)
+{
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() );
+ ::TextPaM aPaM( nNumber, static_cast< ::sal_uInt16 >( Index ) );
+ // XXX numeric overflow
+ // FIXME TEXTATTR_HYPERLINK ignored:
+ ::TextAttribFontColor const * pColor
+ = static_cast< ::TextAttribFontColor const * >(
+ m_rEngine.FindAttrib( aPaM, TEXTATTR_FONTCOLOR ) );
+ ::TextAttribFontWeight const * pWeight
+ = static_cast< ::TextAttribFontWeight const * >(
+ m_rEngine.FindAttrib( aPaM, TEXTATTR_FONTWEIGHT ) );
+ tPropValMap aRunAttrSeq;
+ if ( pColor )
+ {
+ ::css::beans::PropertyValue aPropVal;
+ aPropVal.Name =
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharColor" ) );
+ aPropVal.Handle = -1;
+ aPropVal.Value = mapFontColor( pColor->GetColor() );
+ aPropVal.State = ::css::beans::PropertyState_DIRECT_VALUE;
+ aRunAttrSeq[ aPropVal.Name ] = aPropVal;
+ }
+ if ( pWeight )
+ {
+ ::css::beans::PropertyValue aPropVal;
+ aPropVal.Name =
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) );
+ aPropVal.Handle = -1;
+ aPropVal.Value = mapFontWeight( pWeight->getFontWeight() );
+ aPropVal.State = ::css::beans::PropertyState_DIRECT_VALUE;
+ aRunAttrSeq[ aPropVal.Name ] = aPropVal;
+ }
+ if ( RequestedAttributes.getLength() == 0 )
+ {
+ rRunAttrSeq = aRunAttrSeq;
+ }
+ else
+ {
+ const ::rtl::OUString* pReqAttrs = RequestedAttributes.getConstArray();
+ const ::sal_Int32 nLength = RequestedAttributes.getLength();
+ for ( ::sal_Int32 i = 0; i < nLength; ++i )
+ {
+ tPropValMap::iterator aIter = aRunAttrSeq.find( pReqAttrs[i] );
+ if ( aIter != aRunAttrSeq.end() )
+ {
+ rRunAttrSeq[ (*aIter).first ] = (*aIter).second;
+ }
+ }
+ }
+}
+
+::css::uno::Sequence< ::css::beans::PropertyValue >
+Document::retrieveRunAttributes(
+ ParagraphImpl const * pParagraph, ::sal_Int32 Index,
+ const ::css::uno::Sequence< ::rtl::OUString >& RequestedAttributes)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() );
+ ::osl::MutexGuard aInternalGuard( GetMutex() );
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() );
+ // XXX numeric overflow
+ if ( Index < 0 || Index >= m_rEngine.GetText(nNumber).Len() )
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::retrieveRunAttributes") ),
+ static_cast< ::css::uno::XWeak * >( this ) );
+
+ tPropValMap aRunAttrSeq;
+ retrieveRunAttributesImpl( pParagraph, Index, RequestedAttributes, aRunAttrSeq );
+ return convertHashMapToSequence( aRunAttrSeq );
+}
+
+void Document::changeParagraphText(ParagraphImpl * pParagraph,
+ ::rtl::OUString const & rText)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ // XXX numeric overflow
+ changeParagraphText(nNumber, 0, m_rEngine.GetTextLen(nNumber), false,
+ false, rText);
+ }
+}
+
+void Document::changeParagraphText(ParagraphImpl * pParagraph,
+ ::sal_Int32 nBegin, ::sal_Int32 nEnd,
+ bool bCut, bool bPaste,
+ ::rtl::OUString const & rText)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ // XXX numeric overflow
+ if (nBegin < 0 || nBegin > nEnd
+ || nEnd > m_rEngine.GetText(nNumber).Len())
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::changeParagraphText")),
+ static_cast< ::css::uno::XWeak * >(this));
+ changeParagraphText(nNumber, static_cast< ::sal_uInt16 >(nBegin),
+ static_cast< ::sal_uInt16 >(nEnd), bCut, bPaste, rText);
+ // XXX numeric overflow (2x)
+ }
+}
+
+void Document::copyParagraphText(ParagraphImpl const * pParagraph,
+ ::sal_Int32 nBegin, ::sal_Int32 nEnd)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ // XXX numeric overflow
+ if (nBegin < 0 || nBegin > nEnd
+ || nEnd > m_rEngine.GetText(nNumber).Len())
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::copyParagraphText")),
+ static_cast< ::css::uno::XWeak * >(this));
+ m_rView.SetSelection(
+ ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)),
+ ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd))));
+ // XXX numeric overflow (2x)
+ m_rView.Copy();
+ }
+}
+
+void Document::changeParagraphAttributes(
+ ParagraphImpl * pParagraph, ::sal_Int32 nBegin, ::sal_Int32 nEnd,
+ ::css::uno::Sequence< ::css::beans::PropertyValue > const & rAttributeSet)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ // XXX numeric overflow
+ if (nBegin < 0 || nBegin > nEnd
+ || nEnd > m_rEngine.GetText(nNumber).Len())
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::changeParagraphAttributes")),
+ static_cast< ::css::uno::XWeak * >(this));
+
+ // FIXME The new attributes are added to any attributes already set,
+ // they do not replace the old attributes as required by
+ // XAccessibleEditableText.setAttributes:
+ for (::sal_Int32 i = 0; i < rAttributeSet.getLength(); ++i)
+ if (rAttributeSet[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("CharColor")))
+ m_rEngine.SetAttrib(::TextAttribFontColor(
+ mapFontColor(rAttributeSet[i].Value)),
+ nNumber, static_cast< ::sal_uInt16 >(nBegin),
+ static_cast< ::sal_uInt16 >(nEnd));
+ // XXX numeric overflow (2x)
+ else if (rAttributeSet[i].Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("CharWeight")))
+ m_rEngine.SetAttrib(::TextAttribFontWeight(
+ mapFontWeight(rAttributeSet[i].Value)),
+ nNumber, static_cast< ::sal_uInt16 >(nBegin),
+ static_cast< ::sal_uInt16 >(nEnd));
+ // XXX numeric overflow (2x)
+ }
+}
+
+void Document::changeParagraphSelection(ParagraphImpl * pParagraph,
+ ::sal_Int32 nBegin, ::sal_Int32 nEnd)
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >(pParagraph->getNumber());
+ // XXX numeric overflow
+ if (nBegin < 0 || nBegin > nEnd
+ || nEnd > m_rEngine.GetText(nNumber).Len())
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::changeParagraphSelection")),
+ static_cast< ::css::uno::XWeak * >(this));
+ m_rView.SetSelection(
+ ::TextSelection(::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nBegin)),
+ ::TextPaM(nNumber, static_cast< ::sal_uInt16 >(nEnd))));
+ // XXX numeric overflow (2x)
+ }
+}
+
+::css::i18n::Boundary
+Document::retrieveParagraphLineBoundary( ParagraphImpl const * pParagraph,
+ ::sal_Int32 nIndex, ::sal_Int32 *pLineNo )
+{
+ ::css::i18n::Boundary aBoundary;
+ aBoundary.startPos = nIndex;
+ aBoundary.endPos = nIndex;
+
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() );
+ {
+ ::osl::MutexGuard aInternalGuard( GetMutex() );
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() );
+ if ( nIndex < 0 || nIndex > m_rEngine.GetText( nNumber ).Len() )
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::retrieveParagraphLineBoundary" ) ),
+ static_cast< ::css::uno::XWeak * >( this ) );
+ ::sal_Int32 nLineStart = 0;
+ ::sal_Int32 nLineEnd = 0;
+ ::sal_uInt16 nLineCount = m_rEngine.GetLineCount( nNumber );
+ for ( ::sal_uInt16 nLine = 0; nLine < nLineCount; ++nLine )
+ {
+ ::sal_Int32 nLineLength = static_cast< ::sal_Int32 >(
+ m_rEngine.GetLineLen( nNumber, nLine ) );
+ nLineStart = nLineEnd;
+ nLineEnd += nLineLength;
+ if ( nIndex >= nLineStart && ( ( nLine == nLineCount - 1 ) ? nIndex <= nLineEnd : nIndex < nLineEnd ) )
+ {
+ aBoundary.startPos = nLineStart;
+ aBoundary.endPos = nLineEnd;
+ if( pLineNo )
+ pLineNo[0] = nLine;
+ break;
+ }
+ }
+ }
+
+ return aBoundary;
+}
+
+::css::i18n::Boundary
+Document::retrieveParagraphBoundaryOfLine( ParagraphImpl const * pParagraph,
+ ::sal_Int32 nLineNo )
+{
+ ::css::i18n::Boundary aBoundary;
+ aBoundary.startPos = 0;
+ aBoundary.endPos = 0;
+
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard( getExternalLock() );
+ {
+ ::osl::MutexGuard aInternalGuard( GetMutex() );
+ ::sal_uLong nNumber = static_cast< ::sal_uLong >( pParagraph->getNumber() );
+ if ( nLineNo >= m_rEngine.GetLineCount( nNumber ) )
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::retrieveParagraphBoundaryOfLine" ) ),
+ static_cast< ::css::uno::XWeak * >( this ) );
+ ::sal_Int32 nLineStart = 0;
+ ::sal_Int32 nLineEnd = 0;
+ for ( ::sal_uInt16 nLine = 0; nLine <= nLineNo; ++nLine )
+ {
+ ::sal_Int32 nLineLength = static_cast< ::sal_Int32 >(
+ m_rEngine.GetLineLen( nNumber, nLine ) );
+ nLineStart = nLineEnd;
+ nLineEnd += nLineLength;
+ }
+
+ aBoundary.startPos = nLineStart;
+ aBoundary.endPos = nLineEnd;
+ }
+
+ return aBoundary;
+}
+
+sal_Int32 Document::retrieveParagraphLineWithCursor( ParagraphImpl const * pParagraph )
+{
+ ::osl::Guard< ::comphelper::IMutex > aExternalGuard(getExternalLock());
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ ::TextSelection const & rSelection = m_rView.GetSelection();
+ Paragraphs::size_type nNumber = pParagraph->getNumber();
+ TextPaM aEndPaM( rSelection.GetEnd() );
+
+ return aEndPaM.GetPara() == nNumber
+ ? m_rView.GetLineNumberOfCursorInSelection() : -1;
+}
+
+
+::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet >
+Document::retrieveParagraphRelationSet( ParagraphImpl const * pParagraph )
+{
+ ::osl::MutexGuard aInternalGuard( GetMutex() );
+
+ ::utl::AccessibleRelationSetHelper* pRelationSetHelper = new ::utl::AccessibleRelationSetHelper();
+ ::css::uno::Reference< ::css::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+
+ Paragraphs::iterator aPara( m_xParagraphs->begin() + pParagraph->getNumber() );
+
+ if ( aPara > m_aVisibleBegin && aPara < m_aVisibleEnd )
+ {
+ ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > aSequence(1);
+ aSequence[0] = getAccessibleChild( aPara - 1 );
+ ::css::accessibility::AccessibleRelation aRelation( ::css::accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM, aSequence );
+ pRelationSetHelper->AddRelation( aRelation );
+ }
+
+ if ( aPara >= m_aVisibleBegin && aPara < m_aVisibleEnd -1 )
+ {
+ ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > > aSequence(1);
+ aSequence[0] = getAccessibleChild( aPara + 1 );
+ ::css::accessibility::AccessibleRelation aRelation( ::css::accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence );
+ pRelationSetHelper->AddRelation( aRelation );
+ }
+
+ return xSet;
+}
+
+void Document::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ // #107179# if our parent is a compound control (e.g. MultiLineEdit),
+ // suppress the window focus events here
+ if ( !m_bCompoundControlChild )
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+ break;
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// virtual
+::sal_Int32 SAL_CALL Document::getAccessibleChildCount()
+ throw (::css::uno::RuntimeException)
+{
+ ::comphelper::OExternalLockGuard aGuard(this);
+ init();
+ return m_aVisibleEnd - m_aVisibleBegin;
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+Document::getAccessibleChild(::sal_Int32 i)
+ throw (::css::lang::IndexOutOfBoundsException,
+ ::css::uno::RuntimeException)
+{
+ ::comphelper::OExternalLockGuard aGuard(this);
+ init();
+ if (i < 0 || i >= m_aVisibleEnd - m_aVisibleBegin)
+ throw ::css::lang::IndexOutOfBoundsException(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "textwindowaccessibility.cxx:"
+ " Document::getAccessibleChild")),
+ static_cast< ::css::uno::XWeak * >(this));
+ return getAccessibleChild(m_aVisibleBegin
+ + static_cast< Paragraphs::size_type >(i));
+}
+
+// virtual
+::sal_Int16 SAL_CALL Document::getAccessibleRole()
+ throw (::css::uno::RuntimeException)
+{
+ return ::css::accessibility::AccessibleRole::TEXT_FRAME;
+}
+
+// virtual
+::css::uno::Reference< ::css::accessibility::XAccessible > SAL_CALL
+Document::getAccessibleAtPoint(::css::awt::Point const & rPoint)
+ throw (::css::uno::RuntimeException)
+{
+ ::comphelper::OExternalLockGuard aGuard(this);
+ init();
+ if (rPoint.X >= 0
+ && rPoint.X < m_rView.GetWindow()->GetOutputSizePixel().Width()
+ && rPoint.Y >= 0 && rPoint.Y < m_nViewHeight)
+ {
+ ::sal_Int32 nOffset = m_nViewOffset + rPoint.Y; // XXX numeric overflow
+ ::sal_Int32 nPos = m_nViewOffset - m_nVisibleBeginOffset;
+ for (Paragraphs::iterator aIt(m_aVisibleBegin); aIt != m_aVisibleEnd;
+ ++aIt)
+ {
+ nPos += aIt->getHeight(); // XXX numeric overflow
+ if (nOffset < nPos)
+ return getAccessibleChild(aIt);
+ }
+ }
+ return 0;
+}
+
+// virtual
+void SAL_CALL Document::disposing()
+{
+ m_aEngineListener.endListening();
+ m_aViewListener.endListening();
+ if (m_xParagraphs.get() != 0)
+ disposeParagraphs();
+ VCLXAccessibleComponent::disposing();
+}
+
+// virtual
+void Document::Notify(::SfxBroadcaster &, ::SfxHint const & rHint)
+{
+ if (rHint.ISA(::TextHint))
+ {
+ ::TextHint const & rTextHint
+ = static_cast< ::TextHint const & >(rHint);
+ switch (rTextHint.GetId())
+ {
+ case TEXT_HINT_PARAINSERTED:
+ case TEXT_HINT_PARAREMOVED:
+ // TEXT_HINT_PARAINSERTED and TEXT_HINT_PARAREMOVED are sent at
+ // "unsafe" times (when the text engine has not yet re-formatted its
+ // content), so that for example calling ::TextEngine::GetTextHeight
+ // from within the code that handles TEXT_HINT_PARAINSERTED causes
+ // trouble within the text engine. Therefore, these hints are just
+ // buffered until a following ::TextEngine::FormatDoc causes a
+ // TEXT_HINT_TEXTFORMATTED to come in:
+ case TEXT_HINT_FORMATPARA:
+ // ::TextEngine::FormatDoc sends a sequence of
+ // TEXT_HINT_FORMATPARAs, followed by an optional
+ // TEXT_HINT_TEXTHEIGHTCHANGED, followed in all cases by one
+ // TEXT_HINT_TEXTFORMATTED. Only the TEXT_HINT_FORMATPARAs contain
+ // the the numbers of the affected paragraphs, but they are sent
+ // before the changes are applied. Therefore, TEXT_HINT_FORMATPARAs
+ // are just buffered until another hint comes in:
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ if (!isAlive())
+ break;
+
+ m_aParagraphNotifications.push(rTextHint);
+ break;
+ }
+ case TEXT_HINT_TEXTFORMATTED:
+ case TEXT_HINT_TEXTHEIGHTCHANGED:
+ case TEXT_HINT_MODIFIED:
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ if (!isAlive())
+ break;
+ handleParagraphNotifications();
+ break;
+ }
+ case TEXT_HINT_VIEWSCROLLED:
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ if (!isAlive())
+ break;
+ handleParagraphNotifications();
+
+ ::sal_Int32 nOffset = static_cast< ::sal_Int32 >(
+ m_rView.GetStartDocPos().Y());
+ // XXX numeric overflow
+ if (nOffset != m_nViewOffset)
+ {
+ m_nViewOffset = nOffset;
+
+ Paragraphs::iterator aOldVisibleBegin(
+ m_aVisibleBegin);
+ Paragraphs::iterator aOldVisibleEnd(m_aVisibleEnd);
+
+ determineVisibleRange();
+
+ notifyVisibleRangeChanges(aOldVisibleBegin,
+ aOldVisibleEnd,
+ m_xParagraphs->end());
+ }
+ break;
+ }
+ case TEXT_HINT_VIEWSELECTIONCHANGED:
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ if (!isAlive())
+ break;
+
+ if (m_aParagraphNotifications.empty())
+ {
+ handleSelectionChangeNotification();
+ }
+ else
+ {
+ // TEXT_HINT_VIEWSELECTIONCHANGED is sometimes sent at
+ // "unsafe" times (when the text engine has not yet re-
+ // formatted its content), so that for example calling
+ // ::TextEngine::GetTextHeight from within the code that
+ // handles a previous TEXT_HINT_PARAINSERTED causes
+ // trouble within the text engine. Therefore, these
+ // hints are just buffered (along with
+ // TEXT_HINT_PARAINSERTED/REMOVED/FORMATPARA) until a
+ // following ::TextEngine::FormatDoc causes a
+ // TEXT_HINT_TEXTFORMATTED to come in:
+ m_bSelectionChangedNotification = true;
+ }
+ break;
+ }
+ }
+ }
+}
+
+IMPL_LINK(Document, WindowEventHandler, ::VclSimpleEvent *, pEvent)
+{
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_RESIZE:
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ if (!isAlive())
+ break;
+
+ ::sal_Int32 nHeight = static_cast< ::sal_Int32 >(
+ m_rView.GetWindow()->GetOutputSizePixel().Height());
+ // XXX numeric overflow
+ if (nHeight != m_nViewHeight)
+ {
+ m_nViewHeight = nHeight;
+
+ Paragraphs::iterator aOldVisibleBegin(m_aVisibleBegin);
+ Paragraphs::iterator aOldVisibleEnd(m_aVisibleEnd);
+
+ determineVisibleRange();
+
+ notifyVisibleRangeChanges(aOldVisibleBegin, aOldVisibleEnd,
+ m_xParagraphs->end());
+ }
+ break;
+ }
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ if (!isAlive())
+ break;
+
+ if (m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd)
+ {
+ ::rtl::Reference< ParagraphImpl > xParagraph(
+ getParagraph(m_aFocused));
+ if (xParagraph.is())
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::
+ STATE_CHANGED,
+ ::css::uno::Any(),
+ ::css::uno::makeAny(
+ ::css::accessibility::AccessibleStateType::
+ FOCUSED));
+ }
+ break;
+ }
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ ::osl::MutexGuard aInternalGuard(GetMutex());
+ if (!isAlive())
+ break;
+
+ if (m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd)
+ {
+ ::rtl::Reference< ParagraphImpl > xParagraph(
+ getParagraph(m_aFocused));
+ if (xParagraph.is())
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::
+ STATE_CHANGED,
+ ::css::uno::makeAny(
+ ::css::accessibility::AccessibleStateType::
+ FOCUSED),
+ ::css::uno::Any());
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+void Document::init()
+{
+ if (m_xParagraphs.get() == 0)
+ {
+ ::sal_uLong nCount = m_rEngine.GetParagraphCount();
+ ::std::auto_ptr< Paragraphs > p(new Paragraphs);
+ p->reserve(static_cast< Paragraphs::size_type >(nCount));
+ // numeric overflow is harmless here
+ for (::sal_uLong i = 0; i < nCount; ++i)
+ p->push_back(ParagraphInfo(static_cast< ::sal_Int32 >(
+ m_rEngine.GetTextHeight(i))));
+ // XXX numeric overflow
+ m_nViewOffset = static_cast< ::sal_Int32 >(
+ m_rView.GetStartDocPos().Y()); // XXX numeric overflow
+ m_nViewHeight = static_cast< ::sal_Int32 >(
+ m_rView.GetWindow()->GetOutputSizePixel().Height());
+ // XXX numeric overflow
+ m_xParagraphs = p;
+ determineVisibleRange();
+ m_nSelectionFirstPara = -1;
+ m_nSelectionFirstPos = -1;
+ m_nSelectionLastPara = -1;
+ m_nSelectionLastPos = -1;
+ m_aFocused = m_xParagraphs->end();
+ m_bSelectionChangedNotification = false;
+ m_aEngineListener.startListening(m_rEngine);
+ m_aViewListener.startListening(*m_rView.GetWindow());
+ }
+}
+
+::rtl::Reference< ParagraphImpl >
+Document::getParagraph(Paragraphs::iterator const & rIt)
+{
+ return static_cast< ParagraphImpl * >(
+ ::css::uno::Reference< ::css::accessibility::XAccessible >(
+ rIt->getParagraph()).get());
+}
+
+::css::uno::Reference< ::css::accessibility::XAccessible >
+Document::getAccessibleChild(Paragraphs::iterator const & rIt)
+{
+ ::css::uno::Reference< ::css::accessibility::XAccessible > xParagraph(
+ rIt->getParagraph());
+ if (!xParagraph.is())
+ {
+ xParagraph = new Paragraph(this, rIt - m_xParagraphs->begin());
+ rIt->setParagraph(xParagraph);
+ }
+ return xParagraph;
+}
+
+void Document::determineVisibleRange()
+{
+ m_aVisibleBegin = m_xParagraphs->end();
+ m_aVisibleEnd = m_aVisibleBegin;
+ ::sal_Int32 nPos = 0;
+ for (Paragraphs::iterator aIt = m_xParagraphs->begin();;)
+ {
+ if (aIt == m_xParagraphs->end())
+ {
+ m_nVisibleBeginOffset = 0;
+ break;
+ }
+ ::sal_Int32 nOldPos = nPos;
+ nPos += aIt->getHeight(); // XXX numeric overflow
+ if (m_aVisibleBegin == m_xParagraphs->end() && nPos >= m_nViewOffset)
+ {
+ m_aVisibleBegin = aIt;
+ m_nVisibleBeginOffset = m_nViewOffset - nOldPos;
+ }
+ ++aIt;
+ if (m_aVisibleBegin != m_xParagraphs->end()
+ && (aIt == m_xParagraphs->end()
+ || nPos >= m_nViewOffset + m_nViewHeight))
+ // XXX numeric overflow
+ {
+ m_aVisibleEnd = aIt;
+ break;
+ }
+ }
+}
+
+void Document::notifyVisibleRangeChanges(
+ Paragraphs::iterator const & rOldVisibleBegin,
+ Paragraphs::iterator const & rOldVisibleEnd,
+ Paragraphs::iterator const & rInserted)
+{
+ // XXX Replace this code that determines which paragraphs have changed from
+ // invisible to visible or vice versa with a better algorithm.
+ {for (Paragraphs::iterator aIt(rOldVisibleBegin); aIt != rOldVisibleEnd;
+ ++aIt)
+ if (aIt != rInserted
+ && (aIt < m_aVisibleBegin || aIt >= m_aVisibleEnd))
+ NotifyAccessibleEvent(
+ ::css::accessibility::AccessibleEventId::
+ CHILD,
+ ::css::uno::makeAny(getAccessibleChild(aIt)),
+ ::css::uno::Any());
+ }
+ {for (Paragraphs::iterator aIt(m_aVisibleBegin); aIt != m_aVisibleEnd;
+ ++aIt)
+ if (aIt == rInserted
+ || aIt < rOldVisibleBegin || aIt >= rOldVisibleEnd)
+ NotifyAccessibleEvent(
+ ::css::accessibility::AccessibleEventId::
+ CHILD,
+ ::css::uno::Any(),
+ ::css::uno::makeAny(getAccessibleChild(aIt)));
+ }
+}
+
+void
+Document::changeParagraphText(::sal_uLong nNumber, ::sal_uInt16 nBegin, ::sal_uInt16 nEnd,
+ bool bCut, bool bPaste,
+ ::rtl::OUString const & rText)
+{
+ m_rView.SetSelection(::TextSelection(::TextPaM(nNumber, nBegin),
+ ::TextPaM(nNumber, nEnd)));
+ if (bCut)
+ m_rView.Cut();
+ else if (nBegin != nEnd)
+ m_rView.DeleteSelected();
+ if (bPaste)
+ m_rView.Paste();
+ else if (rText.getLength() != 0)
+ m_rView.InsertText(rText);
+}
+
+void Document::handleParagraphNotifications()
+{
+ while (!m_aParagraphNotifications.empty())
+ {
+ ::TextHint aHint(m_aParagraphNotifications.front());
+ m_aParagraphNotifications.pop();
+ switch (aHint.GetId())
+ {
+ case TEXT_HINT_PARAINSERTED:
+ {
+ ::sal_uLong n = aHint.GetValue();
+ OSL_ENSURE(n <= m_xParagraphs->size(),
+ "bad TEXT_HINT_PARAINSERTED event");
+
+ // Save the values of old iterators (the iterators themselves
+ // will get invalidated), and adjust the old values so that they
+ // reflect the insertion of the new paragraph:
+ Paragraphs::size_type nOldVisibleBegin
+ = m_aVisibleBegin - m_xParagraphs->begin();
+ Paragraphs::size_type nOldVisibleEnd
+ = m_aVisibleEnd - m_xParagraphs->begin();
+ Paragraphs::size_type nOldFocused
+ = m_aFocused - m_xParagraphs->begin();
+ if (n <= nOldVisibleBegin)
+ ++nOldVisibleBegin; // XXX numeric overflow
+ if (n <= nOldVisibleEnd)
+ ++nOldVisibleEnd; // XXX numeric overflow
+ if (n <= nOldFocused)
+ ++nOldFocused; // XXX numeric overflow
+ if (sal::static_int_cast<sal_Int32>(n) <= m_nSelectionFirstPara)
+ ++m_nSelectionFirstPara; // XXX numeric overflow
+ if (sal::static_int_cast<sal_Int32>(n) <= m_nSelectionLastPara)
+ ++m_nSelectionLastPara; // XXX numeric overflow
+
+ Paragraphs::iterator aIns(
+ m_xParagraphs->insert(
+ m_xParagraphs->begin() + n,
+ ParagraphInfo(static_cast< ::sal_Int32 >(
+ m_rEngine.GetTextHeight(n)))));
+ // XXX numeric overflow (2x)
+
+ determineVisibleRange();
+ m_aFocused = m_xParagraphs->begin() + nOldFocused;
+
+ for (Paragraphs::iterator aIt(aIns);;)
+ {
+ ++aIt;
+ if (aIt == m_xParagraphs->end())
+ break;
+ ::rtl::Reference< ParagraphImpl > xParagraph(
+ getParagraph(aIt));
+ if (xParagraph.is())
+ xParagraph->numberChanged(true);
+ }
+
+ notifyVisibleRangeChanges(
+ m_xParagraphs->begin() + nOldVisibleBegin,
+ m_xParagraphs->begin() + nOldVisibleEnd, aIns);
+ break;
+ }
+ case TEXT_HINT_PARAREMOVED:
+ {
+ ::sal_uLong n = aHint.GetValue();
+ if (n == TEXT_PARA_ALL)
+ {
+ {for (Paragraphs::iterator aIt(m_aVisibleBegin);
+ aIt != m_aVisibleEnd; ++aIt)
+ NotifyAccessibleEvent(
+ ::css::accessibility::AccessibleEventId::
+ CHILD,
+ ::css::uno::makeAny(getAccessibleChild(aIt)),
+ ::css::uno::Any());
+ }
+ disposeParagraphs();
+ m_xParagraphs->clear();
+ determineVisibleRange();
+ m_nSelectionFirstPara = -1;
+ m_nSelectionFirstPos = -1;
+ m_nSelectionLastPara = -1;
+ m_nSelectionLastPos = -1;
+ m_aFocused = m_xParagraphs->end();
+ }
+ else
+ {
+ OSL_ENSURE(n < m_xParagraphs->size(),
+ "Bad TEXT_HINT_PARAREMOVED event");
+
+ Paragraphs::iterator aIt(m_xParagraphs->begin() + n);
+ // numeric overflow cannot occur
+
+ // Save the values of old iterators (the iterators
+ // themselves will get invalidated), and adjust the old
+ // values so that they reflect the removal of the paragraph:
+ Paragraphs::size_type nOldVisibleBegin
+ = m_aVisibleBegin - m_xParagraphs->begin();
+ Paragraphs::size_type nOldVisibleEnd
+ = m_aVisibleEnd - m_xParagraphs->begin();
+ bool bWasVisible
+ = nOldVisibleBegin <= n && n < nOldVisibleEnd;
+ Paragraphs::size_type nOldFocused
+ = m_aFocused - m_xParagraphs->begin();
+ bool bWasFocused = aIt == m_aFocused;
+ if (n < nOldVisibleBegin)
+ --nOldVisibleBegin;
+ if (n < nOldVisibleEnd)
+ --nOldVisibleEnd;
+ if (n < nOldFocused)
+ --nOldFocused;
+ if (sal::static_int_cast<sal_Int32>(n) < m_nSelectionFirstPara)
+ --m_nSelectionFirstPara;
+ else if (sal::static_int_cast<sal_Int32>(n) == m_nSelectionFirstPara)
+ {
+ if (m_nSelectionFirstPara == m_nSelectionLastPara)
+ {
+ m_nSelectionFirstPara = -1;
+ m_nSelectionFirstPos = -1;
+ m_nSelectionLastPara = -1;
+ m_nSelectionLastPos = -1;
+ }
+ else
+ {
+ ++m_nSelectionFirstPara;
+ m_nSelectionFirstPos = 0;
+ }
+ }
+ if (sal::static_int_cast<sal_Int32>(n) < m_nSelectionLastPara)
+ --m_nSelectionLastPara;
+ else if (sal::static_int_cast<sal_Int32>(n) == m_nSelectionLastPara)
+ {
+ OSL_ENSURE(m_nSelectionFirstPara < m_nSelectionLastPara,
+ "logic error");
+ --m_nSelectionLastPara;
+ m_nSelectionLastPos = 0x7FFFFFFF;
+ }
+
+ ::css::uno::Reference< ::css::accessibility::XAccessible >
+ xStrong;
+ if (bWasVisible)
+ xStrong = getAccessibleChild(aIt);
+ ::css::uno::WeakReference<
+ ::css::accessibility::XAccessible > xWeak(
+ aIt->getParagraph());
+ aIt = m_xParagraphs->erase(aIt);
+
+ determineVisibleRange();
+ m_aFocused = bWasFocused ? m_xParagraphs->end()
+ : m_xParagraphs->begin() + nOldFocused;
+
+ for (; aIt != m_xParagraphs->end(); ++aIt)
+ {
+ ::rtl::Reference< ParagraphImpl > xParagraph(
+ getParagraph(aIt));
+ if (xParagraph.is())
+ xParagraph->numberChanged(false);
+ }
+
+ if (bWasVisible)
+ NotifyAccessibleEvent(
+ ::css::accessibility::AccessibleEventId::
+ CHILD,
+ ::css::uno::makeAny(getAccessibleChild(aIt)),
+ ::css::uno::Any());
+
+ ::css::uno::Reference< ::css::lang::XComponent > xComponent(
+ xWeak.get(), ::css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+
+ notifyVisibleRangeChanges(
+ m_xParagraphs->begin() + nOldVisibleBegin,
+ m_xParagraphs->begin() + nOldVisibleEnd,
+ m_xParagraphs->end());
+ }
+ break;
+ }
+ case TEXT_HINT_FORMATPARA:
+ {
+ ::sal_uLong n = aHint.GetValue();
+ OSL_ENSURE(n < m_xParagraphs->size(),
+ "Bad TEXT_HINT_FORMATPARA event");
+
+ (*m_xParagraphs)[static_cast< Paragraphs::size_type >(n)].
+ changeHeight(static_cast< ::sal_Int32 >(
+ m_rEngine.GetTextHeight(n)));
+ // XXX numeric overflow
+ Paragraphs::iterator aOldVisibleBegin(m_aVisibleBegin);
+ Paragraphs::iterator aOldVisibleEnd(m_aVisibleEnd);
+ determineVisibleRange();
+ notifyVisibleRangeChanges(aOldVisibleBegin, aOldVisibleEnd,
+ m_xParagraphs->end());
+
+ if (n < m_xParagraphs->size())
+ {
+ Paragraphs::iterator aIt(m_xParagraphs->begin() + n);
+ ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt));
+ if (xParagraph.is())
+ xParagraph->textChanged();
+ }
+ break;
+ }
+ default:
+ OSL_ENSURE(false, "bad buffered hint");
+ break;
+ }
+ }
+ if (m_bSelectionChangedNotification)
+ {
+ m_bSelectionChangedNotification = false;
+ handleSelectionChangeNotification();
+ }
+}
+
+void Document::handleSelectionChangeNotification()
+{
+ ::TextSelection const & rSelection = m_rView.GetSelection();
+ OSL_ENSURE(rSelection.GetStart().GetPara() < m_xParagraphs->size()
+ && rSelection.GetEnd().GetPara() < m_xParagraphs->size(),
+ "bad TEXT_HINT_VIEWSELECTIONCHANGED event");
+ ::sal_Int32 nNewFirstPara
+ = static_cast< ::sal_Int32 >(rSelection.GetStart().GetPara());
+ ::sal_Int32 nNewFirstPos
+ = static_cast< ::sal_Int32 >(rSelection.GetStart().GetIndex());
+ // XXX numeric overflow
+ ::sal_Int32 nNewLastPara
+ = static_cast< ::sal_Int32 >(rSelection.GetEnd().GetPara());
+ ::sal_Int32 nNewLastPos
+ = static_cast< ::sal_Int32 >(rSelection.GetEnd().GetIndex());
+ // XXX numeric overflow
+
+ // Lose focus:
+ Paragraphs::iterator aIt(m_xParagraphs->begin() + nNewLastPara);
+ if (m_aFocused != m_xParagraphs->end() && m_aFocused != aIt
+ && m_aFocused >= m_aVisibleBegin && m_aFocused < m_aVisibleEnd)
+ {
+ ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(m_aFocused));
+ if (xParagraph.is())
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::
+ STATE_CHANGED,
+ ::css::uno::makeAny(
+ ::css::accessibility::AccessibleStateType::FOCUSED),
+ ::css::uno::Any());
+ }
+
+ // Gain focus and update cursor position:
+ if (aIt >= m_aVisibleBegin && aIt < m_aVisibleEnd
+ && (aIt != m_aFocused
+ || nNewLastPara != m_nSelectionLastPara
+ || nNewLastPos != m_nSelectionLastPos))
+ {
+ ::rtl::Reference< ParagraphImpl > xParagraph(getParagraph(aIt));
+ if (xParagraph.is())
+ {
+ if (aIt != m_aFocused)
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::
+ STATE_CHANGED,
+ ::css::uno::Any(),
+ ::css::uno::makeAny(
+ ::css::accessibility::AccessibleStateType::FOCUSED));
+ if (nNewLastPara != m_nSelectionLastPara
+ || nNewLastPos != m_nSelectionLastPos)
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::
+ CARET_CHANGED,
+ ::css::uno::makeAny< ::sal_Int32 >(
+ nNewLastPara == m_nSelectionLastPara
+ ? m_nSelectionLastPos : 0),
+ ::css::uno::makeAny(nNewLastPos));
+ }
+ }
+ m_aFocused = aIt;
+
+ // Update both old and new selection. (Regardless of how the two selections
+ // look like, there will always be two ranges to the left and right of the
+ // overlap---the overlap and/or the range to the right of it possibly being
+ // empty. Only for these two ranges notifications have to be sent.)
+
+ TextPaM aOldTextStart( static_cast< sal_uLong >( m_nSelectionFirstPara ), static_cast< sal_uInt16 >( m_nSelectionFirstPos ) );
+ TextPaM aOldTextEnd( static_cast< sal_uLong >( m_nSelectionLastPara ), static_cast< sal_uInt16 >( m_nSelectionLastPos ) );
+ TextPaM aNewTextStart( static_cast< sal_uLong >( nNewFirstPara ), static_cast< sal_uInt16 >( nNewFirstPos ) );
+ TextPaM aNewTextEnd( static_cast< sal_uLong >( nNewLastPara ), static_cast< sal_uInt16 >( nNewLastPos ) );
+
+ // justify selections
+ justifySelection( aOldTextStart, aOldTextEnd );
+ justifySelection( aNewTextStart, aNewTextEnd );
+
+ sal_Int32 nFirst1;
+ sal_Int32 nLast1;
+ sal_Int32 nFirst2;
+ sal_Int32 nLast2;
+
+ if ( m_nSelectionFirstPara == -1 )
+ {
+ // old selection not initialized yet => notify events only for new selection (if not empty)
+ nFirst1 = aNewTextStart.GetPara();
+ nLast1 = aNewTextEnd.GetPara() + ( aNewTextStart != aNewTextEnd ? 1 : 0 );
+ nFirst2 = 0;
+ nLast2 = 0;
+ }
+ else if ( aOldTextStart == aOldTextEnd && aNewTextStart == aNewTextEnd )
+ {
+ // old an new selection empty => no events
+ nFirst1 = 0;
+ nLast1 = 0;
+ nFirst2 = 0;
+ nLast2 = 0;
+ }
+ else if ( aOldTextStart != aOldTextEnd && aNewTextStart == aNewTextEnd )
+ {
+ // old selection not empty + new selection empty => notify events only for old selection
+ nFirst1 = aOldTextStart.GetPara();
+ nLast1 = aOldTextEnd.GetPara() + 1;
+ nFirst2 = 0;
+ nLast2 = 0;
+ }
+ else if ( aOldTextStart == aOldTextEnd && aNewTextStart != aNewTextEnd )
+ {
+ // old selection empty + new selection not empty => notify events only for new selection
+ nFirst1 = aNewTextStart.GetPara();
+ nLast1 = aNewTextEnd.GetPara() + 1;
+ nFirst2 = 0;
+ nLast2 = 0;
+ }
+ else
+ {
+ // old and new selection not empty => notify events for the two ranges left and right of the overlap
+ ::std::vector< TextPaM > aTextPaMs(4);
+ aTextPaMs[0] = aOldTextStart;
+ aTextPaMs[1] = aOldTextEnd;
+ aTextPaMs[2] = aNewTextStart;
+ aTextPaMs[3] = aNewTextEnd;
+ ::std::sort( aTextPaMs.begin(), aTextPaMs.end() );
+
+ nFirst1 = aTextPaMs[0].GetPara();
+ nLast1 = aTextPaMs[1].GetPara() + ( aTextPaMs[0] != aTextPaMs[1] ? 1 : 0 );
+
+ nFirst2 = aTextPaMs[2].GetPara();
+ nLast2 = aTextPaMs[3].GetPara() + ( aTextPaMs[2] != aTextPaMs[3] ? 1 : 0 );
+
+ // adjust overlapping ranges
+ if ( nLast1 > nFirst2 )
+ nLast1 = nFirst2;
+ }
+
+ // notify selection changes
+ notifySelectionChange( nFirst1, nLast1 );
+ notifySelectionChange( nFirst2, nLast2 );
+
+ m_nSelectionFirstPara = nNewFirstPara;
+ m_nSelectionFirstPos = nNewFirstPos;
+ m_nSelectionLastPara = nNewLastPara;
+ m_nSelectionLastPos = nNewLastPos;
+}
+
+void Document::notifySelectionChange( sal_Int32 nFirst, sal_Int32 nLast )
+{
+ if ( nFirst < nLast )
+ {
+ Paragraphs::iterator aEnd( ::std::min( m_xParagraphs->begin() + nLast, m_aVisibleEnd ) );
+ for ( Paragraphs::iterator aIt = ::std::max( m_xParagraphs->begin() + nFirst, m_aVisibleBegin ); aIt < aEnd; ++aIt )
+ {
+ ::rtl::Reference< ParagraphImpl > xParagraph( getParagraph( aIt ) );
+ if ( xParagraph.is() )
+ {
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::SELECTION_CHANGED,
+ ::css::uno::Any(), ::css::uno::Any() );
+ xParagraph->notifyEvent(
+ ::css::accessibility::AccessibleEventId::TEXT_SELECTION_CHANGED,
+ ::css::uno::Any(), ::css::uno::Any() );
+ }
+ }
+ }
+}
+
+void Document::justifySelection( TextPaM& rTextStart, TextPaM& rTextEnd )
+{
+ if ( rTextStart > rTextEnd )
+ {
+ TextPaM aTextPaM( rTextStart );
+ rTextStart = rTextEnd;
+ rTextEnd = aTextPaM;
+ }
+}
+
+void Document::disposeParagraphs()
+{
+ for (Paragraphs::iterator aIt(m_xParagraphs->begin());
+ aIt != m_xParagraphs->end(); ++aIt)
+ {
+ ::css::uno::Reference< ::css::lang::XComponent > xComponent(
+ aIt->getParagraph().get(), ::css::uno::UNO_QUERY);
+ if (xComponent.is())
+ xComponent->dispose();
+ }
+}
+
+// static
+::css::uno::Any Document::mapFontColor(::Color const & rColor)
+{
+ return ::css::uno::makeAny(
+ static_cast< ::sal_Int32 >(COLORDATA_RGB(rColor.GetColor())));
+ // FIXME keep transparency?
+}
+
+// static
+::Color Document::mapFontColor(::css::uno::Any const & rColor)
+{
+ ::sal_Int32 nColor = 0;
+ rColor >>= nColor;
+ return ::Color(static_cast< ::ColorData >(nColor));
+}
+
+// static
+::css::uno::Any Document::mapFontWeight(::FontWeight nWeight)
+{
+ // Map from ::FontWeight to ::css:awt::FontWeight, depends on order of
+ // elements in ::FontWeight (vcl/vclenum.hxx):
+ static float const aWeight[]
+ = { ::css::awt::FontWeight::DONTKNOW, // WEIGHT_DONTKNOW
+ ::css::awt::FontWeight::THIN, // WEIGHT_THIN
+ ::css::awt::FontWeight::ULTRALIGHT, // WEIGHT_ULTRALIGHT
+ ::css::awt::FontWeight::LIGHT, // WEIGHT_LIGHT
+ ::css::awt::FontWeight::SEMILIGHT, // WEIGHT_SEMILIGHT
+ ::css::awt::FontWeight::NORMAL, // WEIGHT_NORMAL
+ ::css::awt::FontWeight::NORMAL, // WEIGHT_MEDIUM
+ ::css::awt::FontWeight::SEMIBOLD, // WEIGHT_SEMIBOLD
+ ::css::awt::FontWeight::BOLD, // WEIGHT_BOLD
+ ::css::awt::FontWeight::ULTRABOLD, // WEIGHT_ULTRABOLD
+ ::css::awt::FontWeight::BLACK }; // WEIGHT_BLACK
+ return ::css::uno::makeAny(aWeight[nWeight]);
+}
+
+// static
+::FontWeight Document::mapFontWeight(::css::uno::Any const & rWeight)
+{
+ float nWeight = ::css::awt::FontWeight::NORMAL;
+ rWeight >>= nWeight;
+ return nWeight <= ::css::awt::FontWeight::DONTKNOW ? WEIGHT_DONTKNOW
+ : nWeight <= ::css::awt::FontWeight::THIN ? WEIGHT_THIN
+ : nWeight <= ::css::awt::FontWeight::ULTRALIGHT ? WEIGHT_ULTRALIGHT
+ : nWeight <= ::css::awt::FontWeight::LIGHT ? WEIGHT_LIGHT
+ : nWeight <= ::css::awt::FontWeight::SEMILIGHT ? WEIGHT_SEMILIGHT
+ : nWeight <= ::css::awt::FontWeight::NORMAL ? WEIGHT_NORMAL
+ : nWeight <= ::css::awt::FontWeight::SEMIBOLD ? WEIGHT_SEMIBOLD
+ : nWeight <= ::css::awt::FontWeight::BOLD ? WEIGHT_BOLD
+ : nWeight <= ::css::awt::FontWeight::ULTRABOLD ? WEIGHT_ULTRABOLD
+ : WEIGHT_BLACK;
+}
+
+}
+
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
new file mode 100755
index 000000000000..7279b5e2ff60
--- /dev/null
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -0,0 +1,552 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/helper/acc_factory.hxx>
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <accessibility/standard/vclxaccessiblebutton.hxx>
+#include <accessibility/standard/vclxaccessiblecheckbox.hxx>
+#include <accessibility/standard/vclxaccessibledropdowncombobox.hxx>
+#include <accessibility/standard/vclxaccessiblecombobox.hxx>
+#include <accessibility/standard/vclxaccessibledropdownlistbox.hxx>
+#include <accessibility/standard/vclxaccessibleedit.hxx>
+#include <accessibility/standard/vclxaccessiblefixedhyperlink.hxx>
+#include <accessibility/standard/vclxaccessiblefixedtext.hxx>
+#include <accessibility/standard/vclxaccessiblelistbox.hxx>
+#include <accessibility/standard/vclxaccessiblemenu.hxx>
+#include <accessibility/standard/vclxaccessibleradiobutton.hxx>
+#include <accessibility/standard/vclxaccessiblescrollbar.hxx>
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+#include <accessibility/standard/vclxaccessibletoolbox.hxx>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <accessibility/standard/vclxaccessiblestatusbar.hxx>
+#include <accessibility/standard/vclxaccessibletabcontrol.hxx>
+#include <accessibility/standard/vclxaccessibletabpagewindow.hxx>
+#include <accessibility/standard/vclxaccessiblemenubar.hxx>
+#include <accessibility/standard/vclxaccessiblepopupmenu.hxx>
+#include <accessibility/extended/accessibletablistbox.hxx>
+#include <accessibility/extended/AccessibleBrowseBox.hxx>
+#include <accessibility/extended/accessibleiconchoicectrl.hxx>
+#include <accessibility/extended/accessibletabbar.hxx>
+#include <accessibility/extended/accessiblelistbox.hxx>
+#include <accessibility/extended/AccessibleBrowseBoxHeaderBar.hxx>
+#include <accessibility/extended/textwindowaccessibility.hxx>
+#include <accessibility/extended/AccessibleBrowseBoxTableCell.hxx>
+#include <accessibility/extended/AccessibleBrowseBoxHeaderCell.hxx>
+#include <accessibility/extended/AccessibleBrowseBoxCheckBoxCell.hxx>
+#include <accessibility/extended/accessibleeditbrowseboxcell.hxx>
+#include <accessibility/extended/AccessibleToolPanelDeck.hxx>
+#include <accessibility/extended/AccessibleToolPanelDeckTabBar.hxx>
+#include <accessibility/extended/AccessibleToolPanelDeckTabBarItem.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <accessibility/extended/AccessibleGridControl.hxx>
+#include <svtools/accessibletable.hxx>
+#include <vcl/popupmenuwindow.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include "floatingwindowaccessible.hxx"
+
+//........................................................................
+namespace accessibility
+{
+
+inline bool hasFloatingChild(Window *pWindow)
+{
+ Window * pChild = pWindow->GetAccessibleChildWindow(0);
+ if( pChild && WINDOW_FLOATINGWINDOW == pChild->GetType() )
+ return true;
+
+ return false;
+}
+
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::accessibility;
+ using namespace ::svt;
+ using namespace ::svt::table;
+
+ //================================================================
+ //= IAccessibleFactory
+ //================================================================
+ class AccessibleFactory :public ::toolkit::IAccessibleFactory
+ ,public ::svt::IAccessibleFactory
+ {
+ private:
+ oslInterlockedCount m_refCount;
+
+ public:
+ AccessibleFactory();
+
+ // IReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ // ::toolkit::IAccessibleFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXButton* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXCheckBox* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXRadioButton* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXListBox* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedText* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedHyperlink* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXScrollBar* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXEdit* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXComboBox* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXToolBox* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXWindow* _pXWindow );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar );
+
+ // ::svt::IAccessibleFactory
+ virtual IAccessibleTabListBox*
+ createAccessibleTabListBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ SvHeaderTabListBox& rBox
+ ) const;
+
+ virtual IAccessibleBrowseBox*
+ createAccessibleBrowseBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox
+ ) const;
+
+ virtual IAccessibleTableControl*
+ createAccessibleTableControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTable& _rTable
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleIconChoiceCtrl(
+ SvtIconChoiceCtrl& _rIconCtrl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleTabBar(
+ TabBar& _rTabBar
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleTextWindowContext(
+ VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView, bool bCompoundControlChild
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleTreeListBox(
+ SvTreeListBox& _rListBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleBrowseBoxHeaderBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ IAccessibleTableProvider& _rOwningTable,
+ AccessibleBrowseBoxObjType _eObjType
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleBrowseBoxTableCell(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowId,
+ sal_uInt16 _nColId,
+ sal_Int32 _nOffset
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleBrowseBoxHeaderCell(
+ sal_Int32 _nColumnRowId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ AccessibleBrowseBoxObjType _eObjType
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessibleCheckBoxCell(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
+ IAccessibleTableProvider& _rBrowseBox,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xFocusWindow,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos,
+ const TriState& _eState,
+ sal_Bool _bEnabled,
+ sal_Bool _bIsTriState
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createEditBrowseBoxTableCellAccess(
+ const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxParent,
+ const ::com::sun::star::uno::Reference< com::sun::star::accessibility::XAccessible >& _rxControlAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _rxFocusWindow,
+ IAccessibleTableProvider& _rBrowseBox,
+ sal_Int32 _nRowPos,
+ sal_uInt16 _nColPos
+ ) const;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelDeck(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::ToolPanelDeck& i_rPanelDeck
+ );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleToolPanelTabBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rAccessibleParent,
+ ::svt::IToolPanelDeck& i_rPanelDeck,
+ ::svt::PanelTabBar& i_rTabBar
+ );
+
+ protected:
+ virtual ~AccessibleFactory();
+ };
+
+
+ //--------------------------------------------------------------------
+ AccessibleFactory::AccessibleFactory()
+ :m_refCount( 0 )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ AccessibleFactory::~AccessibleFactory()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL AccessibleFactory::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL AccessibleFactory::release()
+ {
+ if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
+ {
+ delete this;
+ return 0;
+ }
+ return m_refCount;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar )
+ {
+ OAccessibleMenuBaseComponent* pAccessible;
+ if ( _bIsMenuBar )
+ pAccessible = new VCLXAccessibleMenuBar( _pMenu );
+ else
+ pAccessible = new VCLXAccessiblePopupMenu( _pMenu );
+ pAccessible->SetStates();
+ return pAccessible;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXButton* _pXWindow )
+ {
+ return new VCLXAccessibleButton( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXCheckBox* _pXWindow )
+ {
+ return new VCLXAccessibleCheckBox( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXRadioButton* _pXWindow )
+ {
+ return new VCLXAccessibleRadioButton( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXListBox* _pXWindow )
+ {
+ sal_Bool bIsDropDownBox = sal_False;
+ ListBox* pBox = static_cast< ListBox* >( _pXWindow->GetWindow() );
+ if ( pBox )
+ bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );
+
+ if ( bIsDropDownBox )
+ return new VCLXAccessibleDropDownListBox( _pXWindow );
+ else
+ return new VCLXAccessibleListBox( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXFixedText* _pXWindow )
+ {
+ return new VCLXAccessibleFixedText( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXFixedHyperlink* _pXWindow )
+ {
+ return new VCLXAccessibleFixedHyperlink( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXScrollBar* _pXWindow )
+ {
+ return new VCLXAccessibleScrollBar( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXEdit* _pXWindow )
+ {
+ return new VCLXAccessibleEdit( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXComboBox* _pXWindow )
+ {
+ sal_Bool bIsDropDownBox = sal_False;
+ ComboBox* pBox = static_cast< ComboBox* >( _pXWindow->GetWindow() );
+ if ( pBox )
+ bIsDropDownBox = ( ( pBox->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN );
+
+ if ( bIsDropDownBox )
+ return new VCLXAccessibleDropDownComboBox( _pXWindow );
+ else
+ return new VCLXAccessibleComboBox( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXWindow* _pXWindow )
+ {
+ Reference< XAccessibleContext > xContext;
+
+ Window* pWindow = _pXWindow->GetWindow();
+ if ( pWindow )
+ {
+ WindowType nType = pWindow->GetType();
+
+ if ( nType == WINDOW_MENUBARWINDOW || pWindow->IsMenuFloatingWindow() || pWindow->IsToolbarFloatingWindow() )
+ {
+ Reference< XAccessible > xAcc( pWindow->GetAccessible() );
+ if ( xAcc.is() )
+ {
+ Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() );
+ if ( pWindow->GetType() == WINDOW_MENUBARWINDOW ||
+ ( xCont.is() && xCont->getAccessibleRole() == AccessibleRole::POPUP_MENU ) )
+ {
+ xContext = xCont;
+ }
+ }
+ }
+ else if ( nType == WINDOW_STATUSBAR )
+ {
+ xContext = (XAccessibleContext*) new VCLXAccessibleStatusBar( _pXWindow );
+ }
+ else if ( nType == WINDOW_TABCONTROL )
+ {
+ xContext = (XAccessibleContext*) new VCLXAccessibleTabControl( _pXWindow );
+ }
+ else if ( nType == WINDOW_TABPAGE && pWindow->GetAccessibleParentWindow() && pWindow->GetAccessibleParentWindow()->GetType() == WINDOW_TABCONTROL )
+ {
+ xContext = new VCLXAccessibleTabPageWindow( _pXWindow );
+ }
+ else if ( nType == WINDOW_FLOATINGWINDOW )
+ {
+ xContext = new FloatingWindowAccessible( _pXWindow );
+ }
+ else if ( nType == WINDOW_BORDERWINDOW && hasFloatingChild( pWindow ) )
+ {
+ PopupMenuFloatingWindow* pChild = dynamic_cast<PopupMenuFloatingWindow*>(
+ pWindow->GetAccessibleChildWindow(0));
+ if ( pChild && pChild->IsPopupMenu() )
+ {
+ // Get the accessible context from the child window.
+ Reference<XAccessible> xAccessible = pChild->CreateAccessible();
+ if (xAccessible.is())
+ xContext = xAccessible->getAccessibleContext();
+ }
+ else
+ xContext = new FloatingWindowAccessible( _pXWindow );
+ }
+ else if ( ( nType == WINDOW_HELPTEXTWINDOW ) || ( nType == WINDOW_FIXEDLINE ) )
+ {
+ xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleFixedText( _pXWindow );
+ }
+ else
+ {
+ xContext = (accessibility::XAccessibleContext*) new VCLXAccessibleComponent( _pXWindow );
+ }
+ }
+
+ return xContext;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleContext( VCLXToolBox* _pXWindow )
+ {
+ return new VCLXAccessibleToolBox( _pXWindow );
+ }
+
+ //--------------------------------------------------------------------
+ IAccessibleTabListBox* AccessibleFactory::createAccessibleTabListBox(
+ const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) const
+ {
+ return new AccessibleTabListBox( rxParent, rBox );
+ }
+
+ //--------------------------------------------------------------------
+ IAccessibleBrowseBox* AccessibleFactory::createAccessibleBrowseBox(
+ const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox ) const
+ {
+ return new AccessibleBrowseBoxAccess( _rxParent, _rBrowseBox );
+ }
+
+ //--------------------------------------------------------------------
+ IAccessibleTableControl* AccessibleFactory::createAccessibleTableControl(
+ const Reference< XAccessible >& _rxParent, IAccessibleTable& _rTable ) const
+ {
+ return new AccessibleGridControlAccess( _rxParent, _rTable );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessibleIconChoiceCtrl(
+ SvtIconChoiceCtrl& _rIconCtrl, const Reference< XAccessible >& _xParent ) const
+ {
+ return new AccessibleIconChoiceCtrl( _rIconCtrl, _xParent );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessibleTabBar( TabBar& _rTabBar ) const
+ {
+ return new AccessibleTabBar( &_rTabBar );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleTextWindowContext(
+ VCLXWindow* pVclXWindow, TextEngine& rEngine, TextView& rView, bool bCompoundControlChild ) const
+ {
+ return new Document( pVclXWindow, rEngine, rView, bCompoundControlChild );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessibleTreeListBox(
+ SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent ) const
+ {
+ return new AccessibleListBox( _rListBox, _xParent );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderBar(
+ const Reference< XAccessible >& rxParent, IAccessibleTableProvider& _rOwningTable,
+ AccessibleBrowseBoxObjType _eObjType ) const
+ {
+ return new AccessibleBrowseBoxHeaderBar( rxParent, _rOwningTable, _eObjType );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxTableCell(
+ const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox,
+ const Reference< XWindow >& _xFocusWindow, sal_Int32 _nRowId, sal_uInt16 _nColId, sal_Int32 _nOffset ) const
+ {
+ return new AccessibleBrowseBoxTableCell( _rxParent, _rBrowseBox, _xFocusWindow,
+ _nRowId, _nColId, _nOffset );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessibleBrowseBoxHeaderCell(
+ sal_Int32 _nColumnRowId, const Reference< XAccessible >& rxParent, IAccessibleTableProvider& _rBrowseBox,
+ const Reference< XWindow >& _xFocusWindow, AccessibleBrowseBoxObjType _eObjType ) const
+ {
+ return new AccessibleBrowseBoxHeaderCell( _nColumnRowId, rxParent, _rBrowseBox,
+ _xFocusWindow, _eObjType );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createAccessibleCheckBoxCell(
+ const Reference< XAccessible >& _rxParent, IAccessibleTableProvider& _rBrowseBox,
+ const Reference< XWindow >& _xFocusWindow, sal_Int32 _nRowPos, sal_uInt16 _nColPos,
+ const TriState& _eState, sal_Bool _bEnabled, sal_Bool _bIsTriState ) const
+ {
+ return new AccessibleCheckBoxCell( _rxParent, _rBrowseBox, _xFocusWindow,
+ _nRowPos, _nColPos, _eState, _bEnabled, _bIsTriState );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > AccessibleFactory::createEditBrowseBoxTableCellAccess(
+ const Reference< XAccessible >& _rxParent, const Reference< XAccessible >& _rxControlAccessible,
+ const Reference< XWindow >& _rxFocusWindow, IAccessibleTableProvider& _rBrowseBox,
+ sal_Int32 _nRowPos, sal_uInt16 _nColPos ) const
+ {
+ return new EditBrowseBoxTableCellAccess( _rxParent, _rxControlAccessible,
+ _rxFocusWindow, _rBrowseBox, _nRowPos, _nColPos );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelDeck(
+ const Reference< XAccessible >& i_rAccessibleParent, ::svt::ToolPanelDeck& i_rPanelDeck )
+ {
+ return new AccessibleToolPanelDeck( i_rAccessibleParent, i_rPanelDeck );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleContext > AccessibleFactory::createAccessibleToolPanelTabBar(
+ const Reference< XAccessible >& i_rAccessibleParent, ::svt::IToolPanelDeck& i_rPanelDeck, ::svt::PanelTabBar& i_rTabBar )
+ {
+ return new AccessibleToolPanelTabBar( i_rAccessibleParent, i_rPanelDeck, i_rTabBar );
+ }
+
+//........................................................................
+} // namespace accessibility
+//........................................................................
+
+//========================================================================
+extern "C" void* SAL_CALL getStandardAccessibleFactory()
+{
+ ::toolkit::IAccessibleFactory* pFactory = new ::accessibility::AccessibleFactory;
+ pFactory->acquire();
+ return pFactory;
+}
+
+extern "C" void* SAL_CALL getSvtAccessibilityComponentFactory()
+{
+ ::svt::IAccessibleFactory* pFactory = new ::accessibility::AccessibleFactory;
+ pFactory->acquire();
+ return pFactory;
+}
diff --git a/accessibility/source/helper/accessiblestrings.src b/accessibility/source/helper/accessiblestrings.src
new file mode 100644
index 000000000000..ee7f77f9b502
--- /dev/null
+++ b/accessibility/source/helper/accessiblestrings.src
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_HELPER_ACCESSIBLESTRINGS_HRC_
+#include <accessibility/helper/accessiblestrings.hrc>
+#endif
+
+
+String RID_STR_ACC_ACTION_CLICK
+{
+ Text = "click";
+};
+
+String RID_STR_ACC_ACTION_TOGGLEPOPUP
+{
+ Text = "togglePopup";
+};
+
+String RID_STR_ACC_ACTION_SELECT
+{
+ Text = "select";
+};
+
+String RID_STR_ACC_ACTION_INCLINE
+{
+ Text = "incrementLine";
+};
+
+String RID_STR_ACC_ACTION_DECLINE
+{
+ Text = "decrementLine";
+};
+
+String RID_STR_ACC_ACTION_INCBLOCK
+{
+ Text = "incrementBlock";
+};
+
+String RID_STR_ACC_ACTION_DECBLOCK
+{
+ Text = "decrementBlock";
+};
+
+String RID_STR_ACC_NAME_BROWSEBUTTON
+{
+ Text [ en-US ] = "Browse";
+};
+
+String RID_STR_ACC_DESC_PANELDECL_TABBAR
+{
+ Text [ en-US ] = "Panel Deck Tab Bar";
+};
diff --git a/accessibility/source/helper/accresmgr.cxx b/accessibility/source/helper/accresmgr.cxx
new file mode 100644
index 000000000000..41647837df4e
--- /dev/null
+++ b/accessibility/source/helper/accresmgr.cxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/helper/accresmgr.hxx>
+
+#ifndef _TOOLS_SIMPLERESMGR_HXX
+#include <tools/simplerm.hxx>
+#endif
+#include <vcl/svapp.hxx>
+
+
+// -----------------------------------------------------------------------------
+// TkResMgr
+// -----------------------------------------------------------------------------
+
+SimpleResMgr* TkResMgr::m_pImpl = NULL;
+
+// -----------------------------------------------------------------------------
+
+TkResMgr::EnsureDelete::~EnsureDelete()
+{
+ delete TkResMgr::m_pImpl;
+}
+
+// -----------------------------------------------------------------------------
+
+void TkResMgr::ensureImplExists()
+{
+ if (m_pImpl)
+ return;
+
+ ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+
+ ByteString sResMgrName( "acc" );
+
+ m_pImpl = SimpleResMgr::Create( sResMgrName.GetBuffer(), aLocale );
+
+ if (m_pImpl)
+ {
+ // now that we have a impl class, make sure it's deleted on unloading the library
+ static TkResMgr::EnsureDelete s_aDeleteTheImplClass;
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString TkResMgr::loadString( sal_uInt16 nResId )
+{
+ ::rtl::OUString sReturn;
+
+ ensureImplExists();
+ if ( m_pImpl )
+ sReturn = m_pImpl->ReadString( nResId );
+
+ return sReturn;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/helper/characterattributeshelper.cxx b/accessibility/source/helper/characterattributeshelper.cxx
new file mode 100644
index 000000000000..6444925dfbac
--- /dev/null
+++ b/accessibility/source/helper/characterattributeshelper.cxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/helper/characterattributeshelper.hxx>
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+
+// -----------------------------------------------------------------------------
+// CharacterAttributesHelper
+// -----------------------------------------------------------------------------
+
+CharacterAttributesHelper::CharacterAttributesHelper( const Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor )
+{
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharBackColor" ), makeAny( (sal_Int32) nBackColor ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharColor" ), makeAny( (sal_Int32) nColor ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharFontCharSet" ), makeAny( (sal_Int16) rFont.GetCharSet() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharFontFamily" ), makeAny( (sal_Int16) rFont.GetFamily() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharFontName" ), makeAny( (::rtl::OUString) rFont.GetName() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharFontPitch" ), makeAny( (sal_Int16) rFont.GetPitch() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharFontStyleName" ), makeAny( (::rtl::OUString) rFont.GetStyleName() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharHeight" ), makeAny( (sal_Int16) rFont.GetSize().Height() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharScaleWidth" ), makeAny( (sal_Int16) rFont.GetSize().Width() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharStrikeout" ), makeAny( (sal_Int16) rFont.GetStrikeout() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharUnderline" ), makeAny( (sal_Int16) rFont.GetUnderline() ) ) );
+ m_aAttributeMap.insert( AttributeMap::value_type( ::rtl::OUString::createFromAscii( "CharWeight" ), makeAny( (float) rFont.GetWeight() ) ) );
+}
+
+// -----------------------------------------------------------------------------
+
+CharacterAttributesHelper::~CharacterAttributesHelper()
+{
+ m_aAttributeMap.clear();
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes()
+{
+ Sequence< PropertyValue > aValues( m_aAttributeMap.size() );
+ PropertyValue* pValues = aValues.getArray();
+
+ for ( AttributeMap::iterator aIt = m_aAttributeMap.begin(); aIt != m_aAttributeMap.end(); ++aIt, ++pValues )
+ {
+ pValues->Name = aIt->first;
+ pValues->Handle = (sal_Int32) -1;
+ pValues->Value = aIt->second;
+ pValues->State = PropertyState_DIRECT_VALUE;
+ }
+
+ return aValues;
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes( const Sequence< ::rtl::OUString >& aRequestedAttributes )
+{
+ Sequence< PropertyValue > aValues;
+ sal_Int32 nLength = aRequestedAttributes.getLength();
+
+ if ( nLength != 0 )
+ {
+ const ::rtl::OUString* pNames = aRequestedAttributes.getConstArray();
+ AttributeMap aAttributeMap;
+
+ for ( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ AttributeMap::iterator aFound = m_aAttributeMap.find( pNames[i] );
+ if ( aFound != m_aAttributeMap.end() )
+ aAttributeMap.insert( *aFound );
+ }
+
+ aValues.realloc( aAttributeMap.size() );
+ PropertyValue* pValues = aValues.getArray();
+
+ for ( AttributeMap::iterator aIt = aAttributeMap.begin(); aIt != aAttributeMap.end(); ++aIt, ++pValues )
+ {
+ pValues->Name = aIt->first;
+ pValues->Handle = (sal_Int32) -1;
+ pValues->Value = aIt->second;
+ pValues->State = PropertyState_DIRECT_VALUE;
+ }
+ }
+ else
+ {
+ aValues = GetCharacterAttributes();
+ }
+
+ return aValues;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/helper/makefile.mk b/accessibility/source/helper/makefile.mk
new file mode 100644
index 000000000000..72284e38f3bc
--- /dev/null
+++ b/accessibility/source/helper/makefile.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=accessibility
+TARGET=helper
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/acc_factory.obj \
+ $(SLO)$/accresmgr.obj \
+ $(SLO)$/characterattributeshelper.obj \
+
+SRS1NAME=$(TARGET)
+SRC1FILES=\
+ accessiblestrings.src
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/source/inc/floatingwindowaccessible.hxx b/accessibility/source/inc/floatingwindowaccessible.hxx
new file mode 100644
index 000000000000..2d5e0e603f5a
--- /dev/null
+++ b/accessibility/source/inc/floatingwindowaccessible.hxx
@@ -0,0 +1,45 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef ACCESSIBILITY_FLOATINGWINDOWACCESSIBLE_HXX
+#define ACCESSIBILITY_FLOATINGWINDOWACCESSIBLE_HXX
+
+#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#endif
+
+class FloatingWindowAccessible : public VCLXAccessibleComponent
+{
+public:
+ FloatingWindowAccessible( VCLXWindow* pWindow );
+ virtual ~FloatingWindowAccessible();
+
+ virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
+};
+
+#endif // ACCESSIBILITY_FLOATINGWINDOWACCESSIBLE_HXX
+
diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx
new file mode 100644
index 000000000000..5ebb06dc9db1
--- /dev/null
+++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx
@@ -0,0 +1,783 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/accessiblemenubasecomponent.hxx>
+#include <accessibility/standard/vclxaccessiblemenu.hxx>
+#include <accessibility/standard/vclxaccessiblemenuitem.hxx>
+#include <accessibility/standard/vclxaccessiblemenuseparator.hxx>
+#include <toolkit/helper/externallock.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/menu.hxx>
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// OAccessibleMenuBaseComponent
+// -----------------------------------------------------------------------------
+
+OAccessibleMenuBaseComponent::OAccessibleMenuBaseComponent( Menu* pMenu )
+ :AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
+ ,m_pMenu( pMenu )
+ ,m_bEnabled( sal_False )
+ ,m_bFocused( sal_False )
+ ,m_bVisible( sal_False )
+ ,m_bSelected( sal_False )
+ ,m_bChecked( sal_False )
+{
+ m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
+
+ if ( m_pMenu )
+ {
+ m_aAccessibleChildren.assign( m_pMenu->GetItemCount(), Reference< XAccessible >() );
+ m_pMenu->AddEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+OAccessibleMenuBaseComponent::~OAccessibleMenuBaseComponent()
+{
+ if ( m_pMenu )
+ m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
+
+ delete m_pExternalLock;
+ m_pExternalLock = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsEnabled()
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsFocused()
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsVisible()
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsSelected()
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsChecked()
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::SetStates()
+{
+ m_bEnabled = IsEnabled();
+ m_bFocused = IsFocused();
+ m_bVisible = IsVisible();
+ m_bSelected = IsSelected();
+ m_bChecked = IsChecked();
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::SetEnabled( sal_Bool bEnabled )
+{
+ if ( m_bEnabled != bEnabled )
+ {
+ Any aOldValue[2], aNewValue[2];
+ if ( m_bEnabled )
+ {
+ aOldValue[0] <<= AccessibleStateType::SENSITIVE;
+ aOldValue[1] <<= AccessibleStateType::ENABLED;
+ }
+ else
+ {
+ aNewValue[0] <<= AccessibleStateType::ENABLED;
+ aNewValue[1] <<= AccessibleStateType::SENSITIVE;
+ }
+ m_bEnabled = bEnabled;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] );
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::SetFocused( sal_Bool bFocused )
+{
+ if ( m_bFocused != bFocused )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bFocused )
+ aOldValue <<= AccessibleStateType::FOCUSED;
+ else
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ m_bFocused = bFocused;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::SetVisible( sal_Bool bVisible )
+{
+ if ( m_bVisible != bVisible )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bVisible )
+ aOldValue <<= AccessibleStateType::VISIBLE;
+ else
+ aNewValue <<= AccessibleStateType::VISIBLE;
+ m_bVisible = bVisible;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::SetSelected( sal_Bool bSelected )
+{
+ if ( m_bSelected != bSelected )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bSelected )
+ aOldValue <<= AccessibleStateType::SELECTED;
+ else
+ aNewValue <<= AccessibleStateType::SELECTED;
+ m_bSelected = bSelected;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::SetChecked( sal_Bool bChecked )
+{
+ if ( m_bChecked != bChecked )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bChecked )
+ aOldValue <<= AccessibleStateType::CHECKED;
+ else
+ aNewValue <<= AccessibleStateType::CHECKED;
+ m_bChecked = bChecked;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::UpdateEnabled( sal_Int32 i, sal_Bool bEnabled )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
+ if ( pComp )
+ pComp->SetEnabled( bEnabled );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::UpdateFocused( sal_Int32 i, sal_Bool bFocused )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
+ if ( pComp )
+ pComp->SetFocused( bFocused );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::UpdateVisible()
+{
+ SetVisible( IsVisible() );
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
+ if ( pComp )
+ pComp->SetVisible( pComp->IsVisible() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::UpdateSelected( sal_Int32 i, sal_Bool bSelected )
+{
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
+ if ( pComp )
+ pComp->SetSelected( bSelected );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::UpdateChecked( sal_Int32 i, sal_Bool bChecked )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
+ if ( pComp )
+ pComp->SetChecked( bChecked );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::UpdateAccessibleName( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xChild.get() );
+ if ( pComp )
+ pComp->SetAccessibleName( pComp->GetAccessibleName() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::UpdateItemText( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xChild.get() );
+ if ( pComp )
+ pComp->SetItemText( pComp->GetItemText() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuBaseComponent::GetChildCount()
+{
+ return m_aAccessibleChildren.size();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int32 i )
+{
+ Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ if ( !xChild.is() )
+ {
+ if ( m_pMenu )
+ {
+ // create a new child
+ OAccessibleMenuBaseComponent* pChild;
+
+ if ( m_pMenu->GetItemType( (sal_uInt16)i ) == MENUITEM_SEPARATOR )
+ {
+ pChild = new VCLXAccessibleMenuSeparator( m_pMenu, (sal_uInt16)i );
+ }
+ else
+ {
+ PopupMenu* pPopupMenu = m_pMenu->GetPopupMenu( m_pMenu->GetItemId( (sal_uInt16)i ) );
+ if ( pPopupMenu )
+ {
+ pChild = new VCLXAccessibleMenu( m_pMenu, (sal_uInt16)i, pPopupMenu );
+ pPopupMenu->SetAccessible( pChild );
+ }
+ else
+ {
+ pChild = new VCLXAccessibleMenuItem( m_pMenu, (sal_uInt16)i );
+ }
+ }
+
+ // set states
+ pChild->SetStates();
+
+ xChild = pChild;
+
+ // insert into menu item list
+ m_aAccessibleChildren[i] = xChild;
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Point& rPoint )
+{
+ Reference< XAccessible > xChild;
+ for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ {
+ Reference< XAccessible > xAcc = getAccessibleChild( i );
+ if ( xAcc.is() )
+ {
+ Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
+ if ( xComp.is() )
+ {
+ Rectangle aRect = VCLRectangle( xComp->getBounds() );
+ Point aPos = VCLPoint( rPoint );
+ if ( aRect.IsInside( aPos ) )
+ {
+ xChild = xAcc;
+ break;
+ }
+ }
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::InsertChild( sal_Int32 i )
+{
+ if ( i > (sal_Int32)m_aAccessibleChildren.size() )
+ i = m_aAccessibleChildren.size();
+
+ if ( i >= 0 )
+ {
+ // insert entry in child list
+ m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
+
+ // update item position of accessible children
+ for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j )
+ {
+ Reference< XAccessible > xAcc( m_aAccessibleChildren[j] );
+ if ( xAcc.is() )
+ {
+ OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xAcc.get() );
+ if ( pComp )
+ pComp->SetItemPos( (sal_uInt16)j );
+ }
+ }
+
+ // send accessible child event
+ Reference< XAccessible > xChild( GetChild( i ) );
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::RemoveChild( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ // keep the accessible of the removed item
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+
+ // remove entry in child list
+ m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
+
+ // update item position of accessible children
+ for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j )
+ {
+ Reference< XAccessible > xAcc( m_aAccessibleChildren[j] );
+ if ( xAcc.is() )
+ {
+ OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xAcc.get() );
+ if ( pComp )
+ pComp->SetItemPos( (sal_uInt16)j );
+ }
+ }
+
+ // send accessible child event
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+
+ Reference< XComponent > xComponent( xChild, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsHighlighted()
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsChildHighlighted()
+{
+ sal_Bool bChildHighlighted = sal_False;
+
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
+ if ( pComp && pComp->IsHighlighted() )
+ {
+ bChildHighlighted = sal_True;
+ break;
+ }
+ }
+ }
+
+ return bChildHighlighted;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::SelectChild( sal_Int32 i )
+{
+ // open the menu
+ if ( getAccessibleRole() == AccessibleRole::MENU && !IsPopupMenuOpen() )
+ Click();
+
+ // highlight the child
+ if ( m_pMenu )
+ m_pMenu->HighlightItem( (sal_uInt16)i );
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::DeSelectAll()
+{
+ if ( m_pMenu )
+ m_pMenu->DeHighlight();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsChildSelected( sal_Int32 i )
+{
+ sal_Bool bSelected = sal_False;
+
+ if ( m_pMenu && m_pMenu->IsHighlighted( (sal_uInt16)i ) )
+ bSelected = sal_True;
+
+ return bSelected;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::Select()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::DeSelect()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::Click()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsPopupMenuOpen()
+{
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( OAccessibleMenuBaseComponent, MenuEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclMenuEvent ), "OAccessibleMenuBaseComponent - Unknown MenuEvent!" );
+ if ( pEvent && pEvent->ISA( VclMenuEvent ) )
+ {
+ DBG_ASSERT( ((VclMenuEvent*)pEvent)->GetMenu(), "OAccessibleMenuBaseComponent - Menu?" );
+ ProcessMenuEvent( *(VclMenuEvent*)pEvent );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent )
+{
+ sal_uInt16 nItemPos = rVclMenuEvent.GetItemPos();
+
+ switch ( rVclMenuEvent.GetId() )
+ {
+ case VCLEVENT_MENU_SHOW:
+ case VCLEVENT_MENU_HIDE:
+ {
+ UpdateVisible();
+ }
+ break;
+ case VCLEVENT_MENU_HIGHLIGHT:
+ {
+ SetFocused( sal_False );
+ UpdateFocused( nItemPos, sal_True );
+ UpdateSelected( nItemPos, sal_True );
+ }
+ break;
+ case VCLEVENT_MENU_DEHIGHLIGHT:
+ {
+ UpdateFocused( nItemPos, sal_False );
+ UpdateSelected( nItemPos, sal_False );
+ }
+ break;
+ case VCLEVENT_MENU_SUBMENUACTIVATE:
+ {
+ }
+ break;
+ case VCLEVENT_MENU_SUBMENUDEACTIVATE:
+ {
+ UpdateFocused( nItemPos, sal_True );
+ }
+ break;
+ case VCLEVENT_MENU_ENABLE:
+ {
+ UpdateEnabled( nItemPos, sal_True );
+ }
+ break;
+ case VCLEVENT_MENU_DISABLE:
+ {
+ UpdateEnabled( nItemPos, sal_False );
+ }
+ break;
+ case VCLEVENT_MENU_SUBMENUCHANGED:
+ {
+ RemoveChild( nItemPos );
+ InsertChild( nItemPos );
+ }
+ break;
+ case VCLEVENT_MENU_INSERTITEM:
+ {
+ InsertChild( nItemPos );
+ }
+ break;
+ case VCLEVENT_MENU_REMOVEITEM:
+ {
+ RemoveChild( nItemPos );
+ }
+ break;
+ case VCLEVENT_MENU_ACCESSIBLENAMECHANGED:
+ {
+ UpdateAccessibleName( nItemPos );
+ }
+ break;
+ case VCLEVENT_MENU_ITEMTEXTCHANGED:
+ {
+ UpdateAccessibleName( nItemPos );
+ UpdateItemText( nItemPos );
+ }
+ break;
+ case VCLEVENT_MENU_ITEMCHECKED:
+ {
+ UpdateChecked( nItemPos, sal_True );
+ }
+ break;
+ case VCLEVENT_MENU_ITEMUNCHECKED:
+ {
+ UpdateChecked( nItemPos, sal_False );
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING:
+ {
+ if ( m_pMenu )
+ {
+ m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
+
+ m_pMenu = NULL;
+
+ // dispose all menu items
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleMenuBaseComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleMenuBaseComponent_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleMenuBaseComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleMenuBaseComponent_BASE )
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuBaseComponent::disposing()
+{
+ AccessibleExtendedComponentHelper_BASE::disposing();
+
+ if ( m_pMenu )
+ {
+ m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
+
+ m_pMenu = NULL;
+
+ // dispose all menu items
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessible
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > OAccessibleMenuBaseComponent::getAccessibleContext( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStateSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+
+ if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ FillAccessibleStateSet( *pStateSetHelper );
+ }
+ else
+ {
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ }
+
+ return xSet;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx
new file mode 100644
index 000000000000..05ba722a9453
--- /dev/null
+++ b/accessibility/source/standard/accessiblemenucomponent.cxx
@@ -0,0 +1,471 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/standard/accessiblemenucomponent.hxx>
+
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/unohelp2.hxx>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class OAccessibleMenuComponent
+// -----------------------------------------------------------------------------
+
+OAccessibleMenuComponent::OAccessibleMenuComponent( Menu* pMenu )
+ :OAccessibleMenuBaseComponent( pMenu )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+OAccessibleMenuComponent::~OAccessibleMenuComponent()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuComponent::IsEnabled()
+{
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuComponent::IsVisible()
+{
+ sal_Bool bVisible = sal_False;
+
+ if ( m_pMenu )
+ bVisible = m_pMenu->IsMenuVisible();
+
+ return bVisible;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ if ( IsEnabled() )
+ {
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ }
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ if ( IsFocused() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+
+ if ( IsVisible() )
+ {
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+ }
+
+ rStateSet.AddState( AccessibleStateType::OPAQUE );
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleComponent
+// -----------------------------------------------------------------------------
+
+awt::Rectangle OAccessibleMenuComponent::implGetBounds() throw (RuntimeException)
+{
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ {
+ // get bounding rectangle of the window in screen coordinates
+ Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
+ aBounds = AWTRectangle( aRect );
+
+ // get position of the accessible parent in screen coordinates
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComponent.is() )
+ {
+ awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen();
+
+ // calculate position of the window relative to the accessible parent
+ aBounds.X -= aParentScreenLoc.X;
+ aBounds.Y -= aParentScreenLoc.Y;
+ }
+ }
+ }
+ }
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleMenuComponent, OAccessibleMenuBaseComponent, OAccessibleMenuComponent_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleMenuComponent, OAccessibleMenuBaseComponent, OAccessibleMenuComponent_BASE )
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuComponent::getAccessibleChildCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return GetChildCount();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuComponent::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return GetChild( i );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuComponent::getAccessibleParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xParent;
+
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ {
+ Window* pParent = pWindow->GetAccessibleParentWindow();
+ if ( pParent )
+ xParent = pParent->GetAccessible();
+ }
+ }
+
+ return xParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 OAccessibleMenuComponent::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::UNKNOWN;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuComponent::getAccessibleDescription( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sDescription;
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ sDescription = pWindow->GetAccessibleDescription();
+ }
+
+ return sDescription;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuComponent::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > OAccessibleMenuComponent::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale OAccessibleMenuComponent::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuComponent::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return GetChildAt( rPoint );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Point OAccessibleMenuComponent::getLocationOnScreen( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ awt::Point aPos;
+
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ {
+ Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
+ aPos = AWTPoint( aRect.TopLeft() );
+ }
+ }
+
+ return aPos;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuComponent::grabFocus( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ pWindow->GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuComponent::getForeground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ sal_Int32 nColor = rStyleSettings.GetMenuTextColor().GetColor();
+
+ return nColor;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuComponent::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+Reference< awt::XFont > OAccessibleMenuComponent::getFont( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< awt::XFont > xFont;
+
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ {
+ Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY );
+ if ( xDev.is() )
+ {
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ VCLXFont* pVCLXFont = new VCLXFont;
+ pVCLXFont->Init( *xDev.get(), rStyleSettings.GetMenuFont() );
+ xFont = pVCLXFont;
+ }
+ }
+ }
+
+ return xFont;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuComponent::getTitledBorderText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuComponent::getToolTipText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleSelection
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuComponent::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ SelectChild( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuComponent::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return IsChildSelected( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuComponent::clearAccessibleSelection( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ DeSelectAll();
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuComponent::selectAllAccessibleChildren( ) throw (RuntimeException)
+{
+ // This method makes no sense in a menu, and so does nothing.
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuComponent::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nRet = 0;
+
+ for ( sal_Int32 i = 0, nCount = GetChildCount(); i < nCount; i++ )
+ {
+ if ( IsChildSelected( i ) )
+ ++nRet;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+
+ for ( sal_Int32 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
+ {
+ if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
+ {
+ xChild = GetChild( i );
+ break;
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuComponent::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ DeSelectAll();
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
new file mode 100644
index 000000000000..9ac93cedd299
--- /dev/null
+++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
@@ -0,0 +1,503 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/standard/accessiblemenuitemcomponent.hxx>
+
+
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/helper/externallock.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/accessibletexthelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/unohelp2.hxx>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class OAccessibleMenuItemComponent
+// -----------------------------------------------------------------------------
+
+OAccessibleMenuItemComponent::OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
+ :OAccessibleMenuBaseComponent( pMenu )
+ ,m_pParent( pParent )
+ ,m_nItemPos( nItemPos )
+{
+ m_sAccessibleName = GetAccessibleName();
+ m_sItemText = GetItemText();
+}
+
+// -----------------------------------------------------------------------------
+
+OAccessibleMenuItemComponent::~OAccessibleMenuItemComponent()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuItemComponent::IsEnabled()
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bEnabled = sal_False;
+ if ( m_pParent )
+ bEnabled = m_pParent->IsItemEnabled( m_pParent->GetItemId( m_nItemPos ) );
+
+ return bEnabled;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuItemComponent::IsVisible()
+{
+ sal_Bool bVisible = sal_False;
+
+ if ( m_pParent )
+ bVisible = m_pParent->IsItemPosVisible( m_nItemPos );
+
+ return bVisible;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::Select()
+{
+ // open the parent menu
+ Reference< XAccessible > xParent( getAccessibleParent() );
+ if ( xParent.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() );
+ if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() )
+ pComp->Click();
+ }
+
+ // highlight the menu item
+ if ( m_pParent )
+ m_pParent->HighlightItem( m_nItemPos );
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::DeSelect()
+{
+ if ( m_pParent && IsSelected() )
+ m_pParent->DeHighlight();
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::Click()
+{
+ // open the parent menu
+ Reference< XAccessible > xParent( getAccessibleParent() );
+ if ( xParent.is() )
+ {
+ OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() );
+ if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() )
+ pComp->Click();
+ }
+
+ // click the menu item
+ if ( m_pParent )
+ {
+ Window* pWindow = m_pParent->GetWindow();
+ if ( pWindow )
+ {
+ // #102438# Menu items are not selectable
+ // Popup menus are executed asynchronously, triggered by a timer.
+ // As Menu::SelectItem only works, if the corresponding menu window is
+ // already created, we have to set the menu delay to 0, so
+ // that the popup menus are executed synchronously.
+ AllSettings aSettings = pWindow->GetSettings();
+ MouseSettings aMouseSettings = aSettings.GetMouseSettings();
+ sal_uLong nDelay = aMouseSettings.GetMenuDelay();
+ aMouseSettings.SetMenuDelay( 0 );
+ aSettings.SetMouseSettings( aMouseSettings );
+ pWindow->SetSettings( aSettings );
+
+ m_pParent->SelectItem( m_pParent->GetItemId( m_nItemPos ) );
+
+ // meanwhile the window pointer may be invalid
+ pWindow = m_pParent->GetWindow();
+ if ( pWindow )
+ {
+ // set the menu delay back to the old value
+ aSettings = pWindow->GetSettings();
+ aMouseSettings = aSettings.GetMouseSettings();
+ aMouseSettings.SetMenuDelay( nDelay );
+ aSettings.SetMouseSettings( aMouseSettings );
+ pWindow->SetSettings( aSettings );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::SetItemPos( sal_uInt16 nItemPos )
+{
+ m_nItemPos = nItemPos;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::SetAccessibleName( const ::rtl::OUString& sAccessibleName )
+{
+ if ( !m_sAccessibleName.equals( sAccessibleName ) )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= m_sAccessibleName;
+ aNewValue <<= sAccessibleName;
+ m_sAccessibleName = sAccessibleName;
+ NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuItemComponent::GetAccessibleName()
+{
+ ::rtl::OUString sName;
+ if ( m_pParent )
+ {
+ sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
+ sName = m_pParent->GetAccessibleName( nItemId );
+ if ( sName.getLength() == 0 )
+ sName = m_pParent->GetItemText( nItemId );
+ sName = OutputDevice::GetNonMnemonicString( sName );
+ }
+
+ return sName;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::SetItemText( const ::rtl::OUString& sItemText )
+{
+ Any aOldValue, aNewValue;
+ if ( OCommonAccessibleText::implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) )
+ {
+ m_sItemText = sItemText;
+ NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuItemComponent::GetItemText()
+{
+ ::rtl::OUString sText;
+ if ( m_pParent )
+ sText = OutputDevice::GetNonMnemonicString( m_pParent->GetItemText( m_pParent->GetItemId( m_nItemPos ) ) );
+
+ return sText;
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ if ( IsEnabled() )
+ {
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ }
+
+ if ( IsVisible() )
+ {
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+ }
+
+ rStateSet.AddState( AccessibleStateType::OPAQUE );
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleComponent
+// -----------------------------------------------------------------------------
+
+awt::Rectangle OAccessibleMenuItemComponent::implGetBounds() throw (RuntimeException)
+{
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+
+ if ( m_pParent )
+ {
+ // get bounding rectangle of the item relative to the containing window
+ aBounds = AWTRectangle( m_pParent->GetBoundingRectangle( m_nItemPos ) );
+
+ // get position of containing window in screen coordinates
+ Window* pWindow = m_pParent->GetWindow();
+ if ( pWindow )
+ {
+ Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
+ awt::Point aWindowScreenLoc = AWTPoint( aRect.TopLeft() );
+
+ // get position of accessible parent in screen coordinates
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComponent.is() )
+ {
+ awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen();
+
+ // calculate bounding rectangle of the item relative to the accessible parent
+ aBounds.X += aWindowScreenLoc.X - aParentScreenLoc.X;
+ aBounds.Y += aWindowScreenLoc.Y - aParentScreenLoc.Y;
+ }
+ }
+ }
+ }
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void SAL_CALL OAccessibleMenuItemComponent::disposing()
+{
+ OAccessibleMenuBaseComponent::disposing();
+
+ m_pParent = NULL;
+ m_sAccessibleName = ::rtl::OUString();
+ m_sItemText = ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuItemComponent::getAccessibleChildCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessible >();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return m_pParent->GetAccessible();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuItemComponent::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return m_nItemPos;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 OAccessibleMenuItemComponent::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::UNKNOWN;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuItemComponent::getAccessibleDescription( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sDescription;
+ if ( m_pParent )
+ sDescription = m_pParent->GetHelpText( m_pParent->GetItemId( m_nItemPos ) );
+
+ return sDescription;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuItemComponent::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return m_sAccessibleName;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > OAccessibleMenuItemComponent::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale OAccessibleMenuItemComponent::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Reference< XAccessible >();
+}
+
+// -----------------------------------------------------------------------------
+
+void OAccessibleMenuItemComponent::grabFocus( ) throw (RuntimeException)
+{
+ // no focus for items
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuItemComponent::getForeground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getForeground();
+ }
+
+ return nColor;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 OAccessibleMenuItemComponent::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getBackground();
+ }
+
+ return nColor;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+Reference< awt::XFont > OAccessibleMenuItemComponent::getFont( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< awt::XFont > xFont;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ xFont = xParentComp->getFont();
+ }
+
+ return xFont;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuItemComponent::getTitledBorderText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString OAccessibleMenuItemComponent::getToolTipText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sRet;
+ if ( m_pParent )
+ sRet = m_pParent->GetTipHelpText( m_pParent->GetItemId( m_nItemPos ) );
+
+ return sRet;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/floatingwindowaccessible.cxx b/accessibility/source/standard/floatingwindowaccessible.cxx
new file mode 100644
index 000000000000..5286bfd387ba
--- /dev/null
+++ b/accessibility/source/standard/floatingwindowaccessible.cxx
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+#include <floatingwindowaccessible.hxx>
+
+
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/window.hxx>
+
+namespace uno = ::com::sun::star::uno;
+
+using ::com::sun::star::accessibility::AccessibleRelation;
+namespace AccessibleRelationType = ::com::sun::star::accessibility::AccessibleRelationType;
+
+//-------------------------------------------------------------------
+
+FloatingWindowAccessible::FloatingWindowAccessible(VCLXWindow* pWindow) :
+ VCLXAccessibleComponent(pWindow)
+{
+}
+
+//-------------------------------------------------------------------
+
+FloatingWindowAccessible::~FloatingWindowAccessible()
+{
+}
+
+//-------------------------------------------------------------------
+
+void FloatingWindowAccessible::FillAccessibleRelationSet(utl::AccessibleRelationSetHelper& rRelationSet)
+{
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ Window* pParentWindow = pWindow->GetParent();
+ if( pParentWindow )
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+ aSequence[0] = pParentWindow->GetAccessible();
+ rRelationSet.AddRelation( AccessibleRelation( AccessibleRelationType::SUB_WINDOW_OF, aSequence ) );
+ }
+ }
+}
diff --git a/accessibility/source/standard/makefile.mk b/accessibility/source/standard/makefile.mk
new file mode 100644
index 000000000000..b79d98f659e5
--- /dev/null
+++ b/accessibility/source/standard/makefile.mk
@@ -0,0 +1,78 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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=accessibility
+TARGET=standard
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/accessiblemenubasecomponent.obj \
+ $(SLO)$/accessiblemenucomponent.obj \
+ $(SLO)$/accessiblemenuitemcomponent.obj \
+ $(SLO)$/floatingwindowaccessible.obj \
+ $(SLO)$/vclxaccessiblebox.obj \
+ $(SLO)$/vclxaccessiblebutton.obj \
+ $(SLO)$/vclxaccessiblecheckbox.obj \
+ $(SLO)$/vclxaccessiblecombobox.obj \
+ $(SLO)$/vclxaccessibledropdowncombobox.obj \
+ $(SLO)$/vclxaccessibledropdownlistbox.obj \
+ $(SLO)$/vclxaccessibleedit.obj \
+ $(SLO)$/vclxaccessiblefixedhyperlink.obj \
+ $(SLO)$/vclxaccessiblefixedtext.obj \
+ $(SLO)$/vclxaccessiblelist.obj \
+ $(SLO)$/vclxaccessiblelistbox.obj \
+ $(SLO)$/vclxaccessiblelistitem.obj \
+ $(SLO)$/vclxaccessiblemenu.obj \
+ $(SLO)$/vclxaccessiblemenubar.obj \
+ $(SLO)$/vclxaccessiblemenuitem.obj \
+ $(SLO)$/vclxaccessiblemenuseparator.obj \
+ $(SLO)$/vclxaccessiblepopupmenu.obj \
+ $(SLO)$/vclxaccessibleradiobutton.obj \
+ $(SLO)$/vclxaccessiblescrollbar.obj \
+ $(SLO)$/vclxaccessiblestatusbar.obj \
+ $(SLO)$/vclxaccessiblestatusbaritem.obj \
+ $(SLO)$/vclxaccessibletabcontrol.obj \
+ $(SLO)$/vclxaccessibletabpage.obj \
+ $(SLO)$/vclxaccessibletabpagewindow.obj \
+ $(SLO)$/vclxaccessibletextcomponent.obj \
+ $(SLO)$/vclxaccessibletextfield.obj \
+ $(SLO)$/vclxaccessibletoolbox.obj \
+ $(SLO)$/vclxaccessibletoolboxitem.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
new file mode 100644
index 000000000000..86b98768736a
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -0,0 +1,373 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblebox.hxx>
+#include <accessibility/standard/vclxaccessibletextfield.hxx>
+#include <accessibility/standard/vclxaccessibleedit.hxx>
+#include <accessibility/standard/vclxaccessiblelist.hxx>
+#include <accessibility/helper/listboxhelper.hxx>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <vcl/svapp.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+
+VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, bool bIsDropDownBox)
+ : VCLXAccessibleComponent (pVCLWindow),
+ m_aBoxType (aType),
+ m_bIsDropDownBox (bIsDropDownBox),
+ m_nIndexInParent (DEFAULT_INDEX_IN_PARENT)
+{
+ // Set up the flags that indicate which children this object has.
+ m_bHasListChild = true;
+
+ // A text field is not present for non drop down list boxes.
+ if ((m_aBoxType==LISTBOX) && ! m_bIsDropDownBox)
+ m_bHasTextChild = false;
+ else
+ m_bHasTextChild = true;
+}
+
+VCLXAccessibleBox::~VCLXAccessibleBox (void)
+{
+}
+
+void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ uno::Any aOldValue, aNewValue;
+ uno::Reference<XAccessible> xAcc;
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ Window* pChildWindow = (Window *) rVclWindowEvent.GetData();
+ // Just compare to the combo box text field. All other children
+ // are identical to this object in which case this object will
+ // be removed in a short time.
+ if (m_aBoxType==COMBOBOX)
+ {
+ ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ if ( ( pComboBox != NULL ) && ( pChildWindow != NULL ) )
+ if (pChildWindow == pComboBox->GetSubEdit())
+ {
+ if (rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW)
+ {
+ // Instantiate text field.
+ getAccessibleChild (0);
+ aNewValue <<= m_xText;
+ }
+ else
+ {
+ // Release text field.
+ aOldValue <<= m_xText;
+ m_xText = NULL;
+ }
+ // Tell the listeners about the new/removed child.
+ NotifyAccessibleEvent (
+ AccessibleEventId::CHILD,
+ aOldValue, aNewValue);
+ }
+
+ }
+ }
+ break;
+
+ default:
+ VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent);
+ }
+}
+
+void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_DROPDOWN_OPEN:
+ case VCLEVENT_DROPDOWN_CLOSE:
+ case VCLEVENT_LISTBOX_DOUBLECLICK:
+ case VCLEVENT_LISTBOX_SCROLLED:
+ case VCLEVENT_LISTBOX_SELECT:
+ case VCLEVENT_LISTBOX_ITEMADDED:
+ case VCLEVENT_LISTBOX_ITEMREMOVED:
+ case VCLEVENT_COMBOBOX_ITEMADDED:
+ case VCLEVENT_COMBOBOX_ITEMREMOVED:
+ case VCLEVENT_COMBOBOX_SCROLLED:
+ {
+ // Forward the call to the list child.
+ VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ if ( pList == NULL )
+ {
+ getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
+ pList = static_cast<VCLXAccessibleList*>(m_xList.get());
+ }
+ if ( pList != NULL )
+ pList->ProcessWindowEvent (rVclWindowEvent);
+ break;
+ }
+
+ case VCLEVENT_COMBOBOX_SELECT:
+ case VCLEVENT_COMBOBOX_DESELECT:
+ {
+ // Selection is handled by VCLXAccessibleList which operates on
+ // the same VCL object as this box does. In case of the
+ // 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 && m_xText.is())
+ {
+ Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
+ if ( xText.is() )
+ {
+ ::rtl::OUString sText = xText->getSelectedText();
+ if ( !sText.getLength() )
+ sText = xText->getText();
+ pList->UpdateSelection (sText);
+ }
+ }
+ break;
+ }
+
+ case VCLEVENT_EDIT_MODIFY:
+ case VCLEVENT_EDIT_SELECTIONCHANGED:
+ // Modify/Selection events are handled by the combo box instead of
+ // directly by the edit field (Why?). Therefore, delegate this
+ // call to the edit field.
+ if (m_aBoxType==COMBOBOX)
+ {
+ if (m_xText.is())
+ {
+ Reference<XAccessibleContext> xContext = m_xText->getAccessibleContext();
+ VCLXAccessibleEdit* pEdit = static_cast<VCLXAccessibleEdit*>(xContext.get());
+ if (pEdit != NULL)
+ pEdit->ProcessWindowEvent (rVclWindowEvent);
+ }
+ }
+ break;
+
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
+IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
+
+//===== XAccessible =========================================================
+
+Reference< XAccessibleContext > SAL_CALL VCLXAccessibleBox::getAccessibleContext( )
+ throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return this;
+}
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleChildCount (void)
+ throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Usually a box has a text field and a list of items as its children.
+ // Non drop down list boxes have no text field. Additionally check
+ // whether the object is valid.
+ sal_Int32 nCount = 0;
+ if (IsValid())
+ nCount += (m_bHasTextChild?1:0) + (m_bHasListChild?1:0);
+ else
+ {
+ // Object not valid anymore. Release references to children.
+ m_bHasTextChild = false;
+ m_xText = NULL;
+ m_bHasListChild = false;
+ m_xList = NULL;
+ }
+
+ return nCount;
+}
+
+Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32 i)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if (i<0 || i>=getAccessibleChildCount())
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ if (IsValid())
+ {
+ if (i==1 || ! m_bHasTextChild)
+ {
+ // List.
+ if ( ! m_xList.is())
+ {
+ VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(),
+ (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX),
+ this);
+ pList->SetIndexInParent (i);
+ m_xList = pList;
+ }
+ xChild = m_xList;
+ }
+ else
+ {
+ // Text Field.
+ if ( ! m_xText.is())
+ {
+ if (m_aBoxType==COMBOBOX)
+ {
+ ComboBox* pComboBox = static_cast<ComboBox*>(GetWindow());
+ if (pComboBox!=NULL && pComboBox->GetSubEdit()!=NULL)
+ m_xText = pComboBox->GetSubEdit()->GetAccessible();
+ }
+ else if (m_bIsDropDownBox)
+ m_xText = new VCLXAccessibleTextField (GetVCLXWindow(),this);
+ }
+ xChild = m_xText;
+ }
+ }
+
+ return xChild;
+}
+
+sal_Int16 SAL_CALL VCLXAccessibleBox::getAccessibleRole (void) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Return the role <const>COMBO_BOX</const> for both VCL combo boxes and
+ // VCL list boxes in DropDown-Mode else <const>PANEL</const>.
+ // This way the Java bridge has not to handle both independently.
+ return m_bIsDropDownBox ? AccessibleRole::COMBO_BOX : AccessibleRole::PANEL;
+}
+
+sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT)
+ return m_nIndexInParent;
+ else
+ return VCLXAccessibleComponent::getAccessibleIndexInParent();
+}
+
+//===== XAccessibleAction ===================================================
+
+sal_Int32 SAL_CALL VCLXAccessibleBox::getAccessibleActionCount (void)
+ throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex> aGuard (GetMutex());
+
+ // There is one action for drop down boxes (toggle popup) and none for
+ // the other boxes.
+ return m_bIsDropDownBox ? 1 : 0;
+}
+
+sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ sal_Bool bNotify = sal_False;
+
+ {
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if (nIndex<0 || nIndex>=getAccessibleActionCount())
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+
+ if (m_aBoxType == COMBOBOX)
+ {
+ ComboBox* pComboBox = static_cast< ComboBox* >( GetWindow() );
+ if (pComboBox != NULL)
+ {
+ pComboBox->ToggleDropDown();
+ bNotify = sal_True;
+ }
+ }
+ else if (m_aBoxType == LISTBOX)
+ {
+ ListBox* pListBox = static_cast< ListBox* >( GetWindow() );
+ if (pListBox != NULL)
+ {
+ pListBox->ToggleDropDown();
+ bNotify = sal_True;
+ }
+ }
+ }
+
+ if (bNotify)
+ NotifyAccessibleEvent (AccessibleEventId::ACTION_CHANGED, Any(), Any());
+
+ return bNotify;
+}
+
+::rtl::OUString SAL_CALL VCLXAccessibleBox::getAccessibleActionDescription (sal_Int32 nIndex)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if (nIndex<0 || nIndex>=getAccessibleActionCount())
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ return TK_RES_STRING( RID_STR_ACC_ACTION_TOGGLEPOPUP);
+}
+
+Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBinding( sal_Int32 nIndex )
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ Reference< XAccessibleKeyBinding > xRet;
+
+ if (nIndex<0 || nIndex>=getAccessibleActionCount())
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+
+ // ... which key?
+ return xRet;
+}
+
+//===== XComponent ==========================================================
+
+void SAL_CALL VCLXAccessibleBox::disposing (void)
+{
+ VCLXAccessibleComponent::disposing();
+}
+
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
new file mode 100644
index 000000000000..e133579922b3
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -0,0 +1,326 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessiblebutton.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <vcl/button.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleButton
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleButton::VCLXAccessibleButton( VCLXWindow* pVCLWindow )
+ :VCLXAccessibleTextComponent( pVCLWindow )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleButton::~VCLXAccessibleButton()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_PUSHBUTTON_TOGGLE:
+ {
+ Any aOldValue;
+ Any aNewValue;
+
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton && pButton->GetState() == STATE_CHECK )
+ aNewValue <<= AccessibleStateType::CHECKED;
+ else
+ aOldValue <<= AccessibleStateType::CHECKED;
+
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ default:
+ VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
+
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ if ( pButton->GetState() == STATE_CHECK )
+ rStateSet.AddState( AccessibleStateType::CHECKED );
+
+ if ( pButton->IsPressed() )
+ rStateSet.AddState( AccessibleStateType::PRESSED );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleButton, VCLXAccessibleTextComponent, VCLXAccessibleButton_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleButton, VCLXAccessibleTextComponent, VCLXAccessibleButton_BASE )
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleButton::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleButton" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleButton::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleButton" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleButton::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString aName( VCLXAccessibleTextComponent::getAccessibleName() );
+ sal_Int32 nLength = aName.getLength();
+
+ if ( nLength >= 3 && aName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("..."), nLength - 3 ) )
+ {
+ if ( nLength == 3 )
+ {
+ // it's a browse button
+ aName = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_NAME_BROWSEBUTTON ) );
+ }
+ else
+ {
+ // remove the three trailing dots
+ aName = aName.copy( 0, nLength - 3 );
+ }
+ }
+ else if ( nLength >= 3 && aName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("<< "), 0 ) )
+ {
+ // remove the leading symbols
+ aName = aName.copy( 3, nLength - 3 );
+ }
+ else if ( nLength >= 3 && aName.matchAsciiL( RTL_CONSTASCII_STRINGPARAM(" >>"), nLength - 3 ) )
+ {
+ // remove the trailing symbols
+ aName = aName.copy( 0, nLength - 3 );
+ }
+
+ return aName;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleButton::getAccessibleActionCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ pButton->Click();
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
+ Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ KeyEvent aKeyEvent = pWindow->GetActivationKey();
+ KeyCode aKeyCode = aKeyEvent.GetKeyCode();
+ if ( aKeyCode.GetCode() != 0 )
+ {
+ awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ if ( aKeyCode.IsShift() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT;
+ if ( aKeyCode.IsMod1() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD1;
+ if ( aKeyCode.IsMod2() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD2;
+ if ( aKeyCode.IsMod3() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD3;
+ aKeyStroke.KeyCode = aKeyCode.GetCode();
+ aKeyStroke.KeyChar = aKeyEvent.GetCharCode();
+ aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() );
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+ }
+ }
+
+ return xKeyBinding;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleValue
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleButton::getCurrentValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ aValue <<= (sal_Int32) pButton->IsPressed();
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleButton::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ {
+ sal_Int32 nValue = 0;
+ OSL_VERIFY( aNumber >>= nValue );
+
+ if ( nValue < 0 )
+ nValue = 0;
+ else if ( nValue > 1 )
+ nValue = 1;
+
+ pButton->SetPressed( (sal_Bool) nValue );
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleButton::getMaximumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 1;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleButton::getMinimumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 0;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
new file mode 100644
index 000000000000..18a7be8bf810
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -0,0 +1,361 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessiblecheckbox.hxx>
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <vcl/button.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleCheckBox
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleCheckBox::VCLXAccessibleCheckBox( VCLXWindow* pVCLWindow )
+ :VCLXAccessibleTextComponent( pVCLWindow )
+{
+ m_bChecked = IsChecked();
+ m_bIndeterminate = IsIndeterminate();
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleCheckBox::~VCLXAccessibleCheckBox()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+bool VCLXAccessibleCheckBox::IsChecked()
+{
+ bool bChecked = false;
+
+ VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
+ if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 1 )
+ bChecked = true;
+
+ return bChecked;
+}
+
+// -----------------------------------------------------------------------------
+
+bool VCLXAccessibleCheckBox::IsIndeterminate()
+{
+ bool bIndeterminate = false;
+
+ VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
+ if ( pVCLXCheckBox && pVCLXCheckBox->getState() == (sal_Int16) 2 )
+ bIndeterminate = true;
+
+ return bIndeterminate;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleCheckBox::SetChecked( bool bChecked )
+{
+ if ( m_bChecked != bChecked )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bChecked )
+ aOldValue <<= AccessibleStateType::CHECKED;
+ else
+ aNewValue <<= AccessibleStateType::CHECKED;
+ m_bChecked = bChecked;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleCheckBox::SetIndeterminate( bool bIndeterminate )
+{
+ if ( m_bIndeterminate != bIndeterminate )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bIndeterminate )
+ aOldValue <<= AccessibleStateType::INDETERMINATE;
+ else
+ aNewValue <<= AccessibleStateType::INDETERMINATE;
+ m_bIndeterminate = bIndeterminate;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_CHECKBOX_TOGGLE:
+ {
+ SetChecked( IsChecked() );
+ SetIndeterminate( IsIndeterminate() );
+ }
+ break;
+ default:
+ VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleCheckBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ if ( IsChecked() )
+ rStateSet.AddState( AccessibleStateType::CHECKED );
+
+ if ( IsIndeterminate() )
+ rStateSet.AddState( AccessibleStateType::INDETERMINATE );
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE )
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleCheckBox::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleCheckBox" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleCheckBox::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleCheckBox" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleCheckBox::getAccessibleActionCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ CheckBox* pCheckBox = (CheckBox*) GetWindow();
+ VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
+ if ( pCheckBox && pVCLXCheckBox )
+ {
+ sal_Int32 nValueMin = (sal_Int32) 0;
+ sal_Int32 nValueMax = (sal_Int32) 1;
+
+ if ( pCheckBox->IsTriStateEnabled() )
+ nValueMax = (sal_Int32) 2;
+
+ sal_Int32 nValue = (sal_Int32) pVCLXCheckBox->getState();
+
+ ++nValue;
+
+ if ( nValue > nValueMax )
+ nValue = nValueMin;
+
+ pVCLXCheckBox->setState( (sal_Int16) nValue );
+ }
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleCheckBox::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
+ Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ KeyEvent aKeyEvent = pWindow->GetActivationKey();
+ KeyCode aKeyCode = aKeyEvent.GetKeyCode();
+ if ( aKeyCode.GetCode() != 0 )
+ {
+ awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ if ( aKeyCode.IsShift() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT;
+ if ( aKeyCode.IsMod1() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD1;
+ if ( aKeyCode.IsMod2() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD2;
+ if ( aKeyCode.IsMod3() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD3;
+ aKeyStroke.KeyCode = aKeyCode.GetCode();
+ aKeyStroke.KeyChar = aKeyEvent.GetCharCode();
+ aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() );
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+ }
+ }
+
+ return xKeyBinding;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleValue
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleCheckBox::getCurrentValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+
+ VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
+ if ( pVCLXCheckBox )
+ aValue <<= (sal_Int32) pVCLXCheckBox->getState();
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleCheckBox::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ VCLXCheckBox* pVCLXCheckBox = static_cast< VCLXCheckBox* >( GetVCLXWindow() );
+ if ( pVCLXCheckBox )
+ {
+ sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0;
+ OSL_VERIFY( aNumber >>= nValue );
+ OSL_VERIFY( getMinimumValue() >>= nValueMin );
+ OSL_VERIFY( getMaximumValue() >>= nValueMax );
+
+ if ( nValue < nValueMin )
+ nValue = nValueMin;
+ else if ( nValue > nValueMax )
+ nValue = nValueMax;
+
+ pVCLXCheckBox->setState( (sal_Int16) nValue );
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleCheckBox::getMaximumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+
+ CheckBox* pCheckBox = (CheckBox*) GetWindow();
+ if ( pCheckBox && pCheckBox->IsTriStateEnabled() )
+ aValue <<= (sal_Int32) 2;
+ else
+ aValue <<= (sal_Int32) 1;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleCheckBox::getMinimumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 0;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblecombobox.cxx b/accessibility/source/standard/vclxaccessiblecombobox.cxx
new file mode 100644
index 000000000000..9ac9a13591e1
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblecombobox.cxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblecombobox.hxx>
+#include <accessibility/standard/vclxaccessiblelist.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <vcl/svapp.hxx>
+#include <vcl/combobox.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+
+
+VCLXAccessibleComboBox::VCLXAccessibleComboBox (VCLXWindow* pVCLWindow)
+ : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::COMBOBOX, false)
+{
+}
+
+
+
+
+VCLXAccessibleComboBox::~VCLXAccessibleComboBox (void)
+{
+}
+
+
+
+
+bool VCLXAccessibleComboBox::IsValid (void) const
+{
+ return static_cast<ComboBox*>(GetWindow()) != NULL;
+
+}
+
+
+
+
+void VCLXAccessibleComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
+{
+ VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString VCLXAccessibleComboBox::getImplementationName (void)
+ throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii ("com.sun.star.comp.toolkit.AccessibleComboBox");
+}
+
+
+
+
+Sequence< ::rtl::OUString > VCLXAccessibleComboBox::getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames();
+ sal_Int32 nLength = aNames.getLength();
+ aNames.realloc( nLength + 1 );
+ aNames[nLength] = ::rtl::OUString::createFromAscii(
+ "com.sun.star.accessibility.AccessibleComboBox" );
+ return aNames;
+}
diff --git a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
new file mode 100644
index 000000000000..f396ff422947
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/standard/vclxaccessibledropdowncombobox.hxx>
+#include <accessibility/standard/vclxaccessiblecombobox.hxx>
+#include <accessibility/standard/vclxaccessibletextfield.hxx>
+#include <accessibility/standard/vclxaccessiblelist.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/unohelp.hxx>
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+
+VCLXAccessibleDropDownComboBox::VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLWindow)
+ : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::COMBOBOX, true)
+{
+}
+
+
+
+
+VCLXAccessibleDropDownComboBox::~VCLXAccessibleDropDownComboBox (void)
+{
+}
+
+
+
+bool VCLXAccessibleDropDownComboBox::IsValid (void) const
+{
+ return static_cast<ComboBox*>(GetWindow()) != NULL;
+
+}
+
+
+
+
+void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_DROPDOWN_OPEN:
+ case VCLEVENT_DROPDOWN_CLOSE:
+ {
+ /* // child count changed
+ Any aOldValue, aNewValue;
+ // get the listbox child
+ Reference< XAccessible > xChild;
+ if ( !xChild.is() )
+ {
+ try
+ {
+ // the listbox is the second child
+ xChild = getAccessibleChild(1);
+ }
+ catch ( IndexOutOfBoundsException& ) {}
+ catch ( RuntimeException& ) {}
+ }
+ if ( rVclWindowEvent.GetId() == VCLEVENT_DROPDOWN_OPEN )
+ aNewValue <<= xChild;
+ else
+ aOldValue <<= xChild;
+ NotifyAccessibleEvent(
+ AccessibleEventId::CHILD, aOldValue, aNewValue
+ );
+ */
+ break;
+ }
+
+ default:
+ VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString VCLXAccessibleDropDownComboBox::getImplementationName()
+ throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.AccessibleDropDownComboBox");
+}
+
+
+
+
+Sequence< ::rtl::OUString > VCLXAccessibleDropDownComboBox::getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames();
+ sal_Int32 nLength = aNames.getLength();
+ aNames.realloc( nLength + 1 );
+ aNames[nLength] = ::rtl::OUString::createFromAscii(
+ "com.sun.star.accessibility.AccessibleDropDownComboBox" );
+ return aNames;
+}
diff --git a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
new file mode 100644
index 000000000000..4d08d40245fb
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+#include <accessibility/standard/vclxaccessibledropdownlistbox.hxx>
+#include <accessibility/standard/vclxaccessiblelistbox.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/unohelp.hxx>
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+
+VCLXAccessibleDropDownListBox::VCLXAccessibleDropDownListBox (VCLXWindow* pVCLWindow)
+ : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::LISTBOX, true)
+{
+}
+
+
+
+
+VCLXAccessibleDropDownListBox::~VCLXAccessibleDropDownListBox()
+{
+}
+
+
+
+
+bool VCLXAccessibleDropDownListBox::IsValid (void) const
+{
+ return static_cast<ListBox*>(GetWindow()) != NULL;
+
+}
+
+
+
+
+void VCLXAccessibleDropDownListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ VCLXAccessibleBox::ProcessWindowEvent (rVclWindowEvent);
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString VCLXAccessibleDropDownListBox::getImplementationName()
+ throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.AccessibleDropDownListBox");
+}
+
+
+
+
+Sequence< ::rtl::OUString > VCLXAccessibleDropDownListBox::getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames();
+ sal_Int32 nLength = aNames.getLength();
+ aNames.realloc( nLength + 1 );
+ aNames[nLength] = ::rtl::OUString::createFromAscii(
+ "com.sun.star.accessibility.AccessibleDropDownListBox" );
+ return aNames;
+}
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
new file mode 100644
index 000000000000..b806e308bc28
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -0,0 +1,626 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessibleedit.hxx>
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/edit.hxx>
+#include <sot/exchange.hxx>
+#include <sot/formats.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleEdit
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleEdit::VCLXAccessibleEdit( VCLXWindow* pVCLWindow )
+ :VCLXAccessibleTextComponent( pVCLWindow )
+{
+ m_nSelectionStart = getSelectionStart();
+ m_nCaretPosition = getCaretPosition();
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleEdit::~VCLXAccessibleEdit()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_EDIT_MODIFY:
+ {
+ SetText( implGetText() );
+ }
+ break;
+ case VCLEVENT_EDIT_SELECTIONCHANGED:
+ {
+ sal_Int32 nOldCaretPosition = m_nCaretPosition;
+ sal_Int32 nOldSelectionStart = m_nSelectionStart;
+
+ m_nCaretPosition = getCaretPosition();
+ m_nSelectionStart = getSelectionStart();
+
+ Window* pWindow = GetWindow();
+ if ( pWindow && pWindow->HasChildPathFocus() )
+ {
+ if ( m_nCaretPosition != nOldCaretPosition )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= (sal_Int32) nOldCaretPosition;
+ aNewValue <<= (sal_Int32) m_nCaretPosition;
+ NotifyAccessibleEvent( AccessibleEventId::CARET_CHANGED, aOldValue, aNewValue );
+ }
+
+ // #i104470# VCL only has SELECTION_CHANGED, but UAA distinguishes between SELECTION_CHANGED and CARET_CHANGED
+ sal_Bool bHasSelection = ( m_nSelectionStart != m_nCaretPosition );
+ sal_Bool bHadSelection = ( nOldSelectionStart != nOldCaretPosition );
+ if ( ( bHasSelection != bHadSelection ) || ( bHasSelection && ( ( m_nCaretPosition != nOldCaretPosition ) || ( m_nSelectionStart != nOldSelectionStart ) ) ) )
+ {
+ NotifyAccessibleEvent( AccessibleEventId::TEXT_SELECTION_CHANGED, Any(), Any() );
+ }
+
+ }
+ }
+ break;
+ default:
+ VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleEdit::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
+
+ VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
+ if ( pVCLXEdit )
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet.AddState( AccessibleStateType::SINGLE_LINE );
+ if ( pVCLXEdit->isEditable() )
+ rStateSet.AddState( AccessibleStateType::EDITABLE );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleText
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleEdit::implGetText()
+{
+ ::rtl::OUString aText;
+
+ Edit* pEdit = static_cast< Edit* >( GetWindow() );
+ if ( pEdit )
+ {
+ aText = OutputDevice::GetNonMnemonicString( pEdit->GetText() );
+
+ if ( getAccessibleRole() == AccessibleRole::PASSWORD_TEXT )
+ {
+ xub_Unicode cEchoChar = pEdit->GetEchoChar();
+ if ( !cEchoChar )
+ cEchoChar = '*';
+ XubString sTmp;
+ aText = sTmp.Fill( (sal_uInt16)aText.getLength(), cEchoChar );
+ }
+ }
+
+ return aText;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleEdit::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+{
+ awt::Selection aSelection;
+ VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
+ if ( pVCLXEdit )
+ aSelection = pVCLXEdit->getSelection();
+
+ nStartIndex = aSelection.Min;
+ nEndIndex = aSelection.Max;
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE )
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleEdit::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleEdit" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleEdit::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleEdit" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleEdit::getAccessibleChildCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleEdit::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessible >();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleEdit::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int16 nRole;
+ Edit* pEdit = static_cast< Edit* >( GetWindow() );
+ if ( pEdit && ( ( pEdit->GetStyle() & WB_PASSWORD ) || pEdit->GetEchoChar() ) )
+ nRole = AccessibleRole::PASSWORD_TEXT;
+ else
+ nRole = AccessibleRole::TEXT;
+
+ return nRole;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleEdit::getAccessibleActionCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ // There is one action: activate
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ sal_Bool bDoAction = sal_False;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ pWindow->GrabFocus();
+ bDoAction = sal_True;
+ }
+
+ return bDoAction;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleEdit::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ static const ::rtl::OUString sAction( RTL_CONSTASCII_USTRINGPARAM( "activate" ) );
+ return sAction;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleKeyBinding > VCLXAccessibleEdit::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessibleKeyBinding >();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleText
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleEdit::getCaretPosition( ) throw (RuntimeException)
+{
+ return getSelectionEnd();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return setSelection( nIndex, nIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Unicode VCLXAccessibleEdit::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getCharacter( nIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getCharacterAttributes( nIndex, aRequestedAttributes );
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleEdit::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ sal_Int32 nLength = implGetText().getLength();
+
+ if ( !implIsValidRange( nIndex, nIndex, nLength ) )
+ throw IndexOutOfBoundsException();
+
+ Control* pControl = static_cast< Control* >( GetWindow() );
+ if ( pControl )
+ {
+ if ( nIndex == nLength )
+ {
+ // #108914# calculate virtual bounding rectangle
+ for ( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ Rectangle aRect = pControl->GetCharacterBounds( i );
+ sal_Int32 nHeight = aRect.GetHeight();
+ if ( aBounds.Height < nHeight )
+ {
+ aBounds.Y = aRect.Top();
+ aBounds.Height = nHeight;
+ }
+ if ( i == nLength - 1 )
+ {
+ aBounds.X = aRect.Right() + 1;
+ aBounds.Width = 1;
+ }
+ }
+ }
+ else
+ {
+ aBounds = AWTRectangle( pControl->GetCharacterBounds( nIndex ) );
+ }
+ }
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleEdit::getCharacterCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getCharacterCount();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleEdit::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getIndexAtPoint( aPoint );
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleEdit::getSelectedText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getSelectedText();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleEdit::getSelectionStart( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getSelectionStart();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleEdit::getSelectionEnd( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getSelectionEnd();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
+ Edit* pEdit = static_cast< Edit* >( GetWindow() );
+ if ( pVCLXEdit && pEdit && pEdit->IsEnabled() )
+ {
+ pVCLXEdit->setSelection( awt::Selection( nStartIndex, nEndIndex ) );
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleEdit::getText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getText();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleEdit::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getTextRange( nStartIndex, nEndIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getTextAtIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getTextBeforeIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleEdit::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::getTextBehindIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return VCLXAccessibleTextComponent::copyText( nStartIndex, nEndIndex );
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleEditableText
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return copyText( nStartIndex, nEndIndex ) && deleteText( nStartIndex, nEndIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::pasteText( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ if ( GetWindow() )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
+ if ( xClipboard.is() )
+ {
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ Reference< datatransfer::XTransferable > xDataObj = xClipboard->getContents();
+ Application::AcquireSolarMutex( nRef );
+ if ( xDataObj.is() )
+ {
+ datatransfer::DataFlavor aFlavor;
+ SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
+ if ( xDataObj->isDataFlavorSupported( aFlavor ) )
+ {
+ Any aData = xDataObj->getTransferData( aFlavor );
+ ::rtl::OUString sText;
+ aData >>= sText;
+ bReturn = replaceText( nIndex, nIndex, sText );
+ }
+ }
+ }
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return replaceText( nStartIndex, nEndIndex, ::rtl::OUString() );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::insertText( const ::rtl::OUString& sText, sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return replaceText( nIndex, nIndex, sText );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::rtl::OUString& sReplacement ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ sal_Int32 nMinIndex = ::std::min( nStartIndex, nEndIndex );
+ sal_Int32 nMaxIndex = ::std::max( nStartIndex, nEndIndex );
+
+ VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
+ if ( pVCLXEdit && pVCLXEdit->isEditable() )
+ {
+ pVCLXEdit->setText( sText.replaceAt( nMinIndex, nMaxIndex - nMinIndex, sReplacement ) );
+ sal_Int32 nIndex = nMinIndex + sReplacement.getLength();
+ setSelection( nIndex, nIndex );
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const Sequence<PropertyValue>& ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False; // attributes cannot be set for an edit
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleEdit::setText( const ::rtl::OUString& sText ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bSuccess = sal_False;
+ try
+ {
+ bSuccess = replaceText( 0, implGetText().getLength(), sText );
+ }
+ catch( const IndexOutOfBoundsException& )
+ {
+ OSL_ENSURE( sal_False, "VCLXAccessibleText::setText: caught an exception!" );
+ }
+ return bSuccess;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx b/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx
new file mode 100644
index 000000000000..90218e629669
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessiblefixedhyperlink.hxx>
+
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleFixedHyperlink
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleFixedHyperlink::VCLXAccessibleFixedHyperlink( VCLXWindow* pVCLWindow )
+ :VCLXAccessibleTextComponent( pVCLWindow )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleFixedHyperlink::~VCLXAccessibleFixedHyperlink()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleFixedHyperlink::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleFixedHyperlink::implGetLineBoundary( i18n::Boundary& rBoundary, sal_Int32 nIndex )
+{
+ // TODO
+ OCommonAccessibleText::implGetLineBoundary( rBoundary, nIndex );
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleFixedHyperlink::getImplementationName() throw (uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleFixedHyperlink" );
+}
+
+// -----------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > VCLXAccessibleFixedHyperlink::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleFixedHyperlink" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+
diff --git a/accessibility/source/standard/vclxaccessiblefixedtext.cxx b/accessibility/source/standard/vclxaccessiblefixedtext.cxx
new file mode 100644
index 000000000000..ca89fa0417ab
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblefixedtext.cxx
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessiblefixedtext.hxx>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <vcl/fixed.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleFixedText
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleFixedText::VCLXAccessibleFixedText( VCLXWindow* pVCLWindow )
+ :VCLXAccessibleTextComponent( pVCLWindow )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleFixedText::~VCLXAccessibleFixedText()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleFixedText::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
+
+ if ( GetWindow() && GetWindow()->GetStyle() & WB_WORDBREAK )
+ rStateSet.AddState( AccessibleStateType::MULTI_LINE );
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleFixedText::implGetLineBoundary( i18n::Boundary& rBoundary, sal_Int32 nIndex )
+{
+ // TODO
+ OCommonAccessibleText::implGetLineBoundary( rBoundary, nIndex );
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleFixedText::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleFixedText" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleFixedText::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleFixedText" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
new file mode 100644
index 000000000000..03fde2b0dc28
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -0,0 +1,854 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblelist.hxx>
+#include <accessibility/standard/vclxaccessiblelistitem.hxx>
+#include <accessibility/helper/listboxhelper.hxx>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <vcl/svapp.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+#include <toolkit/helper/convert.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::accessibility;
+
+namespace
+{
+ void checkSelection_Impl( sal_Int32 _nIndex, const IComboListBoxHelper& _rListBox, sal_Bool bSelected )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ {
+ sal_Int32 nCount = bSelected ? (sal_Int32)_rListBox.GetSelectEntryCount()
+ : (sal_Int32)_rListBox.GetEntryCount();
+ if ( _nIndex < 0 || _nIndex >= nCount )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+}
+
+VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType,
+ const Reference< XAccessible >& _xParent)
+ : VCLXAccessibleComponent (pVCLWindow),
+ m_aBoxType (aBoxType),
+ m_nVisibleLineCount (0),
+ m_nIndexInParent (DEFAULT_INDEX_IN_PARENT),
+ m_nLastTopEntry ( 0 ),
+ m_nLastSelectedPos ( LISTBOX_ENTRY_NOTFOUND ),
+ m_bDisableProcessEvent ( false ),
+ m_bVisible ( true ),
+ m_xParent ( _xParent )
+{
+ // Because combo boxes and list boxes have the no common interface for
+ // methods with identical signature we have to write down twice the
+ // same code.
+ switch (m_aBoxType)
+ {
+ case COMBOBOX:
+ {
+ ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ if ( pBox != NULL )
+ m_pListBoxHelper = new VCLListBoxHelper<ComboBox> (*pBox);
+ break;
+ }
+
+ case LISTBOX:
+ {
+ ListBox* pBox = static_cast<ListBox*>(GetWindow());
+ if ( pBox != NULL )
+ m_pListBoxHelper = new VCLListBoxHelper<ListBox> (*pBox);
+ break;
+ }
+ }
+ UpdateVisibleLineCount();
+
+ sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount());
+ m_aAccessibleChildren.reserve(nCount);
+}
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleList::~VCLXAccessibleList (void)
+{
+ delete m_pListBoxHelper;
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleList::SetIndexInParent (sal_Int32 nIndex)
+{
+ m_nIndexInParent = nIndex;
+}
+// -----------------------------------------------------------------------------
+
+void SAL_CALL VCLXAccessibleList::disposing (void)
+{
+ VCLXAccessibleComponent::disposing();
+
+ // Dispose all items in the list.
+ clearItems();
+
+ delete m_pListBoxHelper;
+ m_pListBoxHelper = NULL;
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleList::clearItems()
+{
+// ListItems::iterator aEnd = m_aAccessibleChildren.end();
+// for (ListItems::iterator aIter = m_aAccessibleChildren.begin(); aIter != aEnd; ++aIter)
+// ::comphelper::disposeComponent(*aIter);
+
+ // Clear the list itself and delete all the rest.
+ ListItems().swap(m_aAccessibleChildren); // clear and minimize
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+ // check if our list should be visible
+ if ( m_pListBoxHelper
+ && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN
+ && !m_pListBoxHelper->IsInDropDown() )
+ {
+ rStateSet.RemoveState (AccessibleStateType::VISIBLE);
+ rStateSet.RemoveState (AccessibleStateType::SHOWING);
+ m_bVisible = false;
+ }
+
+ // Both the combo box and list box are handled identical in the
+ // following but for some reason they don't have a common interface for
+ // the methods used.
+ if ( m_pListBoxHelper )
+ {
+ if ( m_pListBoxHelper->IsMultiSelectionEnabled() )
+ rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
+ rStateSet.AddState (AccessibleStateType::FOCUSABLE);
+ // All children are transient.
+ rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS);
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleList::notifyVisibleStates(sal_Bool _bSetNew )
+{
+ m_bVisible = _bSetNew ? true : false;
+ Any aOldValue, aNewValue;
+ (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ (_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+
+ ListItems::iterator aIter = m_aAccessibleChildren.begin();
+ ListItems::iterator aEnd = m_aAccessibleChildren.end();
+ UpdateVisibleLineCount();
+ // adjust the index inside the VCLXAccessibleListItem
+ for (;aIter != aEnd ; ++aIter)
+ {
+ Reference< XAccessible > xHold = *aIter;
+ VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get());
+ if ( pItem )
+ {
+ sal_uInt16 nTopEntry = 0;
+ if ( m_pListBoxHelper )
+ nTopEntry = m_pListBoxHelper->GetTopEntry();
+ sal_uInt16 nPos = (sal_uInt16)(aIter - m_aAccessibleChildren.begin());
+ sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
+ pItem->SetVisible( m_bVisible && bVisible );
+ }
+
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
+{
+ // Create a reference to this object to prevent an early release of the
+ // listbox (VCLEVENT_OBJECT_DYING).
+ Reference< XAccessible > xTemp = this;
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_DROPDOWN_OPEN:
+ notifyVisibleStates(sal_True);
+ break;
+ case VCLEVENT_DROPDOWN_CLOSE:
+ notifyVisibleStates(sal_False);
+ break;
+ case VCLEVENT_LISTBOX_SCROLLED:
+ case VCLEVENT_COMBOBOX_SCROLLED:
+ UpdateEntryRange_Impl();
+ break;
+
+ case VCLEVENT_LISTBOX_SELECT:
+ if ( !m_bDisableProcessEvent )
+ UpdateSelection_Impl();
+ break;
+ // The selection events VCLEVENT_COMBOBOX_SELECT and
+ // VCLEVENT_COMBOBOX_DESELECT are not handled here because here we
+ // have no access to the edit field. Its text is necessary to
+ // identify the currently selected item.
+
+ case VCLEVENT_OBJECT_DYING:
+ {
+ dispose();
+
+ VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
+ break;
+ }
+
+ case VCLEVENT_LISTBOX_ITEMREMOVED:
+ case VCLEVENT_COMBOBOX_ITEMREMOVED:
+ HandleChangedItemList (false, reinterpret_cast<sal_IntPtr>(
+ rVclWindowEvent.GetData()));
+ break;
+
+ case VCLEVENT_LISTBOX_ITEMADDED:
+ case VCLEVENT_COMBOBOX_ITEMADDED:
+ HandleChangedItemList (true, reinterpret_cast<sal_IntPtr>(
+ rVclWindowEvent.GetData()));
+ break;
+ case VCLEVENT_CONTROL_GETFOCUS:
+ VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
+ if ( m_pListBoxHelper )
+ {
+ uno::Any aOldValue,
+ aNewValue;
+ sal_uInt16 nPos = m_pListBoxHelper->GetSelectEntryPos();
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ nPos = m_pListBoxHelper->GetTopEntry();
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ aNewValue <<= CreateChild(nPos);
+
+ NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+ }
+ break;
+
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent);
+ }
+}
+// -----------------------------------------------------------------------------
+
+/** To find out which item is currently selected and to update the SELECTED
+ state of the associated accessibility objects accordingly we exploit the
+ fact that the
+*/
+void VCLXAccessibleList::UpdateSelection (::rtl::OUString sTextOfSelectedItem)
+{
+ if ( m_aBoxType == COMBOBOX )
+ {
+ ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ if ( pBox != NULL )
+ {
+ // Find the index of the selected item inside the VCL control...
+ sal_uInt16 nIndex = pBox->GetEntryPos (XubString(sTextOfSelectedItem));
+ // ...and then find the associated accessibility object.
+ if ( nIndex == LISTBOX_ENTRY_NOTFOUND )
+ nIndex = 0;
+ UpdateSelection_Impl(nIndex);
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleList::adjustEntriesIndexInParent(ListItems::iterator& _aBegin,::std::mem_fun_t<bool,VCLXAccessibleListItem>& _rMemFun)
+{
+ ListItems::iterator aIter = _aBegin;
+ ListItems::iterator aEnd = m_aAccessibleChildren.end();
+ // adjust the index inside the VCLXAccessibleListItem
+ for (;aIter != aEnd ; ++aIter)
+ {
+ Reference< XAccessible > xHold = *aIter;
+ VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get());
+ if ( pItem )
+ _rMemFun(pItem);
+ }
+}
+// -----------------------------------------------------------------------------
+
+Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 i)
+{
+ Reference<XAccessible> xChild;
+
+ sal_uInt16 nPos = static_cast<sal_uInt16>(i);
+ if ( nPos >= m_aAccessibleChildren.size() )
+ {
+ m_aAccessibleChildren.resize(nPos + 1);
+
+ // insert into the container
+ xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this);
+ m_aAccessibleChildren[nPos] = xChild;
+ }
+ else
+ {
+ xChild = m_aAccessibleChildren[nPos];
+ // check if position is empty and can be used else we have to adjust all entries behind this
+ if ( xChild.is() )
+ {
+ ListItems::iterator aIter = m_aAccessibleChildren.begin() + nPos;
+ ::std::mem_fun_t<bool, VCLXAccessibleListItem> aTemp(&VCLXAccessibleListItem::IncrementIndexInParent);
+ adjustEntriesIndexInParent( aIter, aTemp);
+ }
+ else
+ {
+ xChild = new VCLXAccessibleListItem(m_pListBoxHelper, i, this);
+ m_aAccessibleChildren[nPos] = xChild;
+ }
+ }
+
+ if ( xChild.is() )
+ {
+ // Just add the SELECTED state.
+ sal_Bool bNowSelected = sal_False;
+ if ( m_pListBoxHelper )
+ bNowSelected = m_pListBoxHelper->IsEntryPosSelected ((sal_uInt16)i);
+ VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get());
+ pItem->SetSelected( bNowSelected );
+
+ // Set the child's VISIBLE state.
+ UpdateVisibleLineCount();
+ sal_uInt16 nTopEntry = 0;
+ if ( m_pListBoxHelper )
+ nTopEntry = m_pListBoxHelper->GetTopEntry();
+ sal_Bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
+ pItem->SetVisible( m_bVisible && bVisible );
+ }
+
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex)
+{
+ if ( !bItemInserted )
+ {
+ if ( nIndex == -1 ) // special handling here
+ {
+ clearItems();
+ }
+ else
+ {
+ if ( nIndex >= 0 && static_cast<sal_uInt16>(nIndex) < m_aAccessibleChildren.size() )
+ {
+ ListItems::iterator aIter = m_aAccessibleChildren.erase(m_aAccessibleChildren.begin()+nIndex);
+ ::std::mem_fun_t<bool, VCLXAccessibleListItem> aTemp(&VCLXAccessibleListItem::DecrementIndexInParent);
+ adjustEntriesIndexInParent( aIter, aTemp );
+ }
+ }
+ }
+ else
+ getAccessibleChild(nIndex);
+
+ NotifyAccessibleEvent (
+ AccessibleEventId::INVALIDATE_ALL_CHILDREN,
+ Any(), Any());
+}
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
+IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
+
+//===== XAccessible =========================================================
+
+Reference<XAccessibleContext> SAL_CALL
+ VCLXAccessibleList::getAccessibleContext (void)
+ throw (RuntimeException)
+{
+ return this;
+}
+// -----------------------------------------------------------------------------
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount (void)
+ throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nCount = 0;
+ if ( m_pListBoxHelper )
+ nCount = m_pListBoxHelper->GetEntryCount();
+
+ return nCount;
+}
+// -----------------------------------------------------------------------------
+
+Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int32 i)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ // search for the child
+ if ( static_cast<sal_uInt16>(i) >= m_aAccessibleChildren.size() )
+ xChild = CreateChild (i);
+ else
+ {
+ xChild = m_aAccessibleChildren[i];
+ if ( !xChild.is() )
+ xChild = CreateChild (i);
+ }
+ OSL_ENSURE( xChild.is(), "VCLXAccessibleList::getAccessibleChild: returning empty child!" );
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleParent( )
+ throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return m_xParent;
+}
+// -----------------------------------------------------------------------------
+
+sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT)
+ return m_nIndexInParent;
+ else
+ return VCLXAccessibleComponent::getAccessibleIndexInParent();
+}
+// -----------------------------------------------------------------------------
+
+sal_Int16 SAL_CALL VCLXAccessibleList::getAccessibleRole (void)
+ throw (RuntimeException)
+{
+ return AccessibleRole::LIST;
+}
+// -----------------------------------------------------------------------------
+
+//===== XAccessibleComponent ================================================
+
+sal_Bool SAL_CALL VCLXAccessibleList::contains( const awt::Point& rPoint ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Bool bInside = sal_False;
+
+ Window* pListBox = GetWindow();
+ if ( pListBox )
+ {
+ Rectangle aRect( Point(0,0), pListBox->GetSizePixel() );
+ bInside = aRect.IsInside( VCLPoint( rPoint ) );
+ }
+
+ return bInside;
+}
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleAt( const awt::Point& rPoint )
+ throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ Reference< XAccessible > xChild;
+ if ( m_pListBoxHelper )
+ {
+ UpdateVisibleLineCount();
+ if ( contains( rPoint ) && m_nVisibleLineCount > 0 )
+ {
+ Point aPos = VCLPoint( rPoint );
+ sal_uInt16 nEndPos = m_pListBoxHelper->GetTopEntry() + (sal_uInt16)m_nVisibleLineCount;
+ for ( sal_uInt16 i = m_pListBoxHelper->GetTopEntry(); i < nEndPos; ++i )
+ {
+ if ( m_pListBoxHelper->GetBoundingRectangle(i).IsInside( aPos ) )
+ {
+ xChild = getAccessibleChild(i);
+ break;
+ }
+ }
+ }
+ }
+
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+
+//===== XServiceInfo ==========================================================
+
+::rtl::OUString VCLXAccessibleList::getImplementationName (void)
+ throw (RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.toolkit.AccessibleList"));
+}
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleList::getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames();
+ sal_Int32 nLength = aNames.getLength();
+ aNames.realloc( nLength + 1 );
+ aNames[nLength] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.AccessibleList"));
+ return aNames;
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleList::UpdateVisibleLineCount()
+{
+ if ( m_pListBoxHelper )
+ {
+ if ( (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
+ m_nVisibleLineCount = m_pListBoxHelper->GetDisplayLineCount();
+ else
+ {
+ sal_uInt16 nCols = 0,
+ nLines = 0;
+ m_pListBoxHelper->GetMaxVisColumnsAndLines (nCols, nLines);
+ m_nVisibleLineCount = nLines;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+void VCLXAccessibleList::UpdateEntryRange_Impl()
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nTop = m_nLastTopEntry;
+
+ if ( m_pListBoxHelper )
+ nTop = m_pListBoxHelper->GetTopEntry();
+ if ( nTop != m_nLastTopEntry )
+ {
+ UpdateVisibleLineCount();
+ sal_Int32 nBegin = Min( m_nLastTopEntry, nTop );
+ sal_Int32 nEnd = Max( m_nLastTopEntry + m_nVisibleLineCount, nTop + m_nVisibleLineCount );
+ for (sal_uInt16 i = static_cast<sal_uInt16>(nBegin); (i <= static_cast<sal_uInt16>(nEnd)); ++i)
+ {
+ sal_Bool bVisible = ( i >= nTop && i < ( nTop + m_nVisibleLineCount ) );
+ Reference< XAccessible > xHold;
+ if ( i < m_aAccessibleChildren.size() )
+ xHold = m_aAccessibleChildren[i];
+ else if ( bVisible )
+ xHold = CreateChild(i);
+
+ if ( xHold.is() )
+ static_cast< VCLXAccessibleListItem* >( xHold.get() )->SetVisible( m_bVisible && bVisible );
+ }
+ }
+
+ m_nLastTopEntry = nTop;
+}
+// -----------------------------------------------------------------------------
+sal_Bool VCLXAccessibleList::checkEntrySelected(sal_uInt16 _nPos,Any& _rNewValue,Reference< XAccessible >& _rxNewAcc)
+{
+ OSL_ENSURE(m_pListBoxHelper,"Helper is not valid!");
+ sal_Bool bNowSelected = sal_False;
+ if ( m_pListBoxHelper )
+ {
+ bNowSelected = m_pListBoxHelper->IsEntryPosSelected (_nPos);
+ if ( bNowSelected )
+ {
+ _rxNewAcc = CreateChild(_nPos);
+ _rNewValue <<= _rxNewAcc;
+ }
+ }
+ return bNowSelected;
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleList::UpdateSelection_Impl(sal_uInt16)
+{
+ uno::Any aOldValue, aNewValue;
+
+ {
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ Reference< XAccessible > xNewAcc;
+
+ if ( m_pListBoxHelper )
+ {
+ sal_uInt16 i=0;
+ for ( ListItems::iterator aIter = m_aAccessibleChildren.begin();
+ aIter != m_aAccessibleChildren.end(); ++aIter,++i)
+ {
+ Reference< XAccessible > xHold = *aIter;
+ if ( xHold.is() )
+ {
+ VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
+ // Retrieve the item's index from the list entry.
+ sal_Bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
+
+ if ( bNowSelected && !pItem->IsSelected() )
+ {
+ xNewAcc = *aIter;
+ aNewValue <<= xNewAcc;
+ }
+ else if ( pItem->IsSelected() )
+ m_nLastSelectedPos = i;
+
+ pItem->SetSelected( bNowSelected );
+ }
+ else
+ { // it could happen that a child was not created before
+ checkEntrySelected(i,aNewValue,xNewAcc);
+ }
+ }
+ sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
+ if ( i < nCount ) // here we have to check the if any other listbox entry is selected
+ {
+ for (; i < nCount && !checkEntrySelected(i,aNewValue,xNewAcc) ;++i )
+ ;
+ }
+ if ( xNewAcc.is() && GetWindow()->HasFocus() )
+ {
+ if ( m_nLastSelectedPos != LISTBOX_ENTRY_NOTFOUND )
+ aOldValue <<= getAccessibleChild( (sal_Int32)m_nLastSelectedPos );
+ aNewValue <<= xNewAcc;
+ }
+ }
+ }
+
+ if ( aNewValue.hasValue() || aOldValue.hasValue() )
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleSelection
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ sal_Bool bNotify = sal_False;
+
+ {
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( m_pListBoxHelper )
+ {
+ checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False);
+
+ m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nChildIndex, sal_True );
+ // call the select handler, don't handle events in this time
+ m_bDisableProcessEvent = true;
+ m_pListBoxHelper->Select();
+ m_bDisableProcessEvent = false;
+ bNotify = sal_True;
+ }
+ }
+
+ if ( bNotify )
+ UpdateSelection_Impl();
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Bool bRet = sal_False;
+ if ( m_pListBoxHelper )
+ {
+ checkSelection_Impl(nChildIndex,*m_pListBoxHelper,sal_False);
+
+ bRet = m_pListBoxHelper->IsEntryPosSelected( (sal_uInt16)nChildIndex );
+ }
+ return bRet;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleList::clearAccessibleSelection( ) throw (RuntimeException)
+{
+ sal_Bool bNotify = sal_False;
+
+ {
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( m_pListBoxHelper )
+ {
+ m_pListBoxHelper->SetNoSelection();
+ bNotify = sal_True;
+ }
+ }
+
+ if ( bNotify )
+ UpdateSelection_Impl();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren( ) throw (RuntimeException)
+{
+ sal_Bool bNotify = sal_False;
+
+ {
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( m_pListBoxHelper )
+ {
+ sal_uInt16 nCount = m_pListBoxHelper->GetEntryCount();
+ for ( sal_uInt16 i = 0; i < nCount; ++i )
+ m_pListBoxHelper->SelectEntryPos( i, sal_True );
+ // call the select handler, don't handle events in this time
+ m_bDisableProcessEvent = true;
+ m_pListBoxHelper->Select();
+ m_bDisableProcessEvent = false;
+ bNotify = sal_True;
+ }
+ }
+
+ if ( bNotify )
+ UpdateSelection_Impl();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nCount = 0;
+ if ( m_pListBoxHelper )
+ nCount = m_pListBoxHelper->GetSelectEntryCount();
+ return nCount;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( m_pListBoxHelper )
+ {
+ checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_True);
+ return getAccessibleChild( (sal_Int32)m_pListBoxHelper->GetSelectEntryPos( (sal_uInt16)nSelectedChildIndex ) );
+ }
+
+ return NULL;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ sal_Bool bNotify = sal_False;
+
+ {
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( m_pListBoxHelper )
+ {
+ checkSelection_Impl(nSelectedChildIndex,*m_pListBoxHelper,sal_False);
+
+ m_pListBoxHelper->SelectEntryPos( (sal_uInt16)nSelectedChildIndex, sal_False );
+ // call the select handler, don't handle events in this time
+ m_bDisableProcessEvent = true;
+ m_pListBoxHelper->Select();
+ m_bDisableProcessEvent = false;
+ bNotify = sal_True;
+ }
+ }
+
+ if ( bNotify )
+ UpdateSelection_Impl();
+}
+// -----------------------------------------------------------------------------
+// accessibility::XAccessibleComponent
+awt::Rectangle VCLXAccessibleList::implGetBounds() throw (uno::RuntimeException)
+{
+ awt::Rectangle aBounds ( 0, 0, 0, 0 );
+ if ( m_pListBoxHelper
+ && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
+ {
+ if ( m_pListBoxHelper->IsInDropDown() )
+ aBounds = AWTRectangle(m_pListBoxHelper->GetDropDownPosSizePixel());
+ }
+ else
+ {
+ // a list has the same bounds as his parent but starts at (0,0)
+ aBounds = VCLXAccessibleComponent::implGetBounds();
+ aBounds.X = 0;
+ aBounds.Y = 0;
+ if ( m_aBoxType == COMBOBOX )
+ {
+ ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ if ( pBox )
+ {
+ Size aSize = pBox->GetSubEdit()->GetSizePixel();
+ aBounds.X += aSize.Height();
+ aBounds.Y += aSize.Width();
+ aBounds.Height -= aSize.Height();
+ aBounds.Width -= aSize.Width();
+ }
+ }
+ }
+ return aBounds;
+}
+// -----------------------------------------------------------------------------
+
+awt::Point VCLXAccessibleList::getLocationOnScreen( ) throw (uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ awt::Point aPos;
+ if ( m_pListBoxHelper
+ && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN )
+ {
+ if ( m_pListBoxHelper->IsInDropDown() )
+ aPos = AWTPoint(m_pListBoxHelper->GetDropDownPosSizePixel().TopLeft());
+ }
+ else
+ {
+ aPos = VCLXAccessibleComponent::getLocationOnScreen();
+ if ( m_aBoxType == COMBOBOX )
+ {
+ ComboBox* pBox = static_cast<ComboBox*>(GetWindow());
+ if ( pBox )
+ {
+ aPos.X += pBox->GetSubEdit()->GetSizePixel().Height();
+ aPos.Y += pBox->GetSubEdit()->GetSizePixel().Width();
+ }
+ }
+ }
+ return aPos;
+}
+// -----------------------------------------------------------------------------
+
diff --git a/accessibility/source/standard/vclxaccessiblelistbox.cxx b/accessibility/source/standard/vclxaccessiblelistbox.cxx
new file mode 100644
index 000000000000..7645d2067c1a
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblelistbox.cxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblelistbox.hxx>
+#include <accessibility/standard/vclxaccessiblelistitem.hxx>
+#include <accessibility/helper/listboxhelper.hxx>
+
+#include <algorithm>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/unohelp.hxx>
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+
+VCLXAccessibleListBox::VCLXAccessibleListBox (VCLXWindow* pVCLWindow)
+ : VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::LISTBOX, false)
+{
+}
+
+
+
+
+VCLXAccessibleListBox::~VCLXAccessibleListBox (void)
+{
+}
+
+
+
+
+bool VCLXAccessibleListBox::IsValid (void) const
+{
+ return static_cast<ListBox*>(GetWindow()) != NULL;
+
+}
+
+
+
+
+void VCLXAccessibleListBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent)
+{
+ VCLXAccessibleBox::ProcessWindowEvent( rVclWindowEvent );
+}
+
+
+
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString VCLXAccessibleListBox::getImplementationName (void)
+ throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.AccessibleListBox");
+}
+
+
+
+
+Sequence< ::rtl::OUString > VCLXAccessibleListBox::getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames = VCLXAccessibleBox::getSupportedServiceNames();
+ sal_Int32 nLength = aNames.getLength();
+ aNames.realloc( nLength + 1 );
+ aNames[nLength] = ::rtl::OUString::createFromAscii(
+ "com.sun.star.accessibility.AccessibleListBox" );
+ return aNames;
+}
diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx
new file mode 100644
index 000000000000..66a819bdf036
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -0,0 +1,674 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblelistitem.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <accessibility/helper/listboxhelper.hxx>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/controllayout.hxx>
+#include <vcl/unohelp2.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+
+namespace
+{
+ void checkIndex_Impl( sal_Int32 _nIndex, const ::rtl::OUString& _sText ) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+ {
+ if ( _nIndex < 0 || _nIndex > _sText.getLength() )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+}
+
+// class VCLXAccessibleListItem ------------------------------------------
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star;
+
+DBG_NAME(VCLXAccessibleListItem)
+
+// -----------------------------------------------------------------------------
+// Ctor() and Dtor()
+// -----------------------------------------------------------------------------
+VCLXAccessibleListItem::VCLXAccessibleListItem( ::accessibility::IComboListBoxHelper* _pListBoxHelper, sal_Int32 _nIndexInParent, const Reference< XAccessible >& _xParent ) :
+
+ VCLXAccessibleListItem_BASE ( m_aMutex ),
+
+ m_nIndexInParent( _nIndexInParent ),
+ m_bSelected ( sal_False ),
+ m_bVisible ( sal_False ),
+ m_nClientId ( 0 ),
+ m_pListBoxHelper( _pListBoxHelper ),
+ m_xParent ( _xParent )
+
+{
+ DBG_CTOR( VCLXAccessibleListItem, NULL );
+
+ if ( m_xParent.is() )
+ m_xParentContext = m_xParent->getAccessibleContext();
+
+ if ( m_pListBoxHelper )
+ m_sEntryText = m_pListBoxHelper->GetEntry( (sal_uInt16)_nIndexInParent );
+}
+// -----------------------------------------------------------------------------
+VCLXAccessibleListItem::~VCLXAccessibleListItem()
+{
+ DBG_DTOR( VCLXAccessibleListItem, NULL );
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleListItem::SetSelected( sal_Bool _bSelected )
+{
+ if ( m_bSelected != _bSelected )
+ {
+ Any aOldValue;
+ Any aNewValue;
+ if ( m_bSelected )
+ aOldValue <<= AccessibleStateType::SELECTED;
+ else
+ aNewValue <<= AccessibleStateType::SELECTED;
+ m_bSelected = _bSelected;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleListItem::SetVisible( sal_Bool _bVisible )
+{
+ if ( m_bVisible != _bVisible )
+ {
+ Any aOldValue, aNewValue;
+ m_bVisible = _bVisible;
+ (_bVisible ? aNewValue : aOldValue ) <<= AccessibleStateType::VISIBLE;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ (_bVisible ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleListItem::NotifyAccessibleEvent( sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _aOldValue,
+ const ::com::sun::star::uno::Any& _aNewValue )
+{
+ AccessibleEventObject aEvt;
+ aEvt.Source = *this;
+ aEvt.EventId = _nEventId;
+ aEvt.OldValue = _aOldValue;
+ aEvt.NewValue = _aNewValue;
+
+ if (m_nClientId)
+ comphelper::AccessibleEventNotifier::addEvent( m_nClientId, aEvt );
+}
+// -----------------------------------------------------------------------------
+// OCommonAccessibleText
+// -----------------------------------------------------------------------------
+::rtl::OUString VCLXAccessibleListItem::implGetText()
+{
+ return m_sEntryText;
+}
+// -----------------------------------------------------------------------------
+Locale VCLXAccessibleListItem::implGetLocale()
+{
+ return Application::GetSettings().GetLocale();
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleListItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+{
+ nStartIndex = 0;
+ nEndIndex = 0;
+}
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+Any SAL_CALL VCLXAccessibleListItem::queryInterface( Type const & rType ) throw (RuntimeException)
+{
+ return VCLXAccessibleListItem_BASE::queryInterface( rType );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleListItem::acquire() throw ()
+{
+ VCLXAccessibleListItem_BASE::acquire();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleListItem::release() throw ()
+{
+ VCLXAccessibleListItem_BASE::release();
+}
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+Sequence< Type > SAL_CALL VCLXAccessibleListItem::getTypes( ) throw (RuntimeException)
+{
+ return VCLXAccessibleListItem_BASE::getTypes();
+}
+// -----------------------------------------------------------------------------
+Sequence< sal_Int8 > VCLXAccessibleListItem::getImplementationId() throw (RuntimeException)
+{
+ static ::cppu::OImplementationId* pId = NULL;
+
+ if ( !pId )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+
+ if ( !pId )
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleListItem::disposing()
+{
+ comphelper::AccessibleEventNotifier::TClientId nId( 0 );
+ Reference< XInterface > xEventSource;
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ VCLXAccessibleListItem_BASE::disposing();
+ m_sEntryText = ::rtl::OUString();
+ m_pListBoxHelper = NULL;
+ m_xParent = NULL;
+ m_xParentContext = NULL;
+
+ nId = m_nClientId;
+ m_nClientId = 0;
+ if ( nId )
+ xEventSource = *this;
+ }
+
+ // Send a disposing to all listeners.
+ if ( nId )
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
+}
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+::rtl::OUString VCLXAccessibleListItem::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleListItem" );
+}
+// -----------------------------------------------------------------------------
+sal_Bool VCLXAccessibleListItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+}
+// -----------------------------------------------------------------------------
+Sequence< ::rtl::OUString > VCLXAccessibleListItem::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(3);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleContext" );
+ aNames[1] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleComponent" );
+ aNames[2] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleListItem" );
+ return aNames;
+}
+// -----------------------------------------------------------------------------
+// XAccessible
+// -----------------------------------------------------------------------------
+Reference< XAccessibleContext > SAL_CALL VCLXAccessibleListItem::getAccessibleContext( ) throw (RuntimeException)
+{
+ return this;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleChildCount( ) throw (RuntimeException)
+{
+ return 0;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleChild( sal_Int32 ) throw (RuntimeException)
+{
+ return Reference< XAccessible >();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleParent( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return m_xParent;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_nIndexInParent;
+}
+// -----------------------------------------------------------------------------
+sal_Int16 SAL_CALL VCLXAccessibleListItem::getAccessibleRole( ) throw (RuntimeException)
+{
+ return AccessibleRole::LIST_ITEM;
+ // return AccessibleRole::LABEL;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleListItem::getAccessibleDescription( ) throw (RuntimeException)
+{
+ // no description for every item
+ return ::rtl::OUString();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // entry text == accessible name
+ return implGetText();
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleListItem::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+
+ if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ if ( m_bSelected )
+ pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+ if ( m_bVisible )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ }
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return xStateSet;
+}
+// -----------------------------------------------------------------------------
+Locale SAL_CALL VCLXAccessibleListItem::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return implGetLocale();
+}
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleListItem::containsPoint( const awt::Point& _aPoint ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Bool bInside = sal_False;
+ if ( m_pListBoxHelper )
+ {
+ Rectangle aRect( m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ) );
+ aRect.Move(-aRect.TopLeft().X(),-aRect.TopLeft().Y());
+ bInside = aRect.IsInside( VCLPoint( _aPoint ) );
+ }
+ return bInside;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+{
+ return Reference< XAccessible >();
+}
+// -----------------------------------------------------------------------------
+awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ awt::Rectangle aRect;
+ if ( m_pListBoxHelper )
+ aRect = AWTRectangle( m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ) );
+
+ return aRect;
+}
+// -----------------------------------------------------------------------------
+awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Point aPoint(0,0);
+ if ( m_pListBoxHelper )
+ {
+ Rectangle aRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
+ aPoint = aRect.TopLeft();
+ }
+ return AWTPoint( aPoint );
+}
+// -----------------------------------------------------------------------------
+awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Point aPoint(0,0);
+ if ( m_pListBoxHelper )
+ {
+ Rectangle aRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
+ aPoint = aRect.TopLeft();
+ aPoint += m_pListBoxHelper->GetWindowExtentsRelative( NULL ).TopLeft();
+ }
+ return AWTPoint( aPoint );
+}
+// -----------------------------------------------------------------------------
+awt::Size SAL_CALL VCLXAccessibleListItem::getSize( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ Size aSize;
+ if ( m_pListBoxHelper )
+ aSize = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent ).GetSize();
+
+ return AWTSize( aSize );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleListItem::grabFocus( ) throw (RuntimeException)
+{
+ // no focus for each item
+}
+// -----------------------------------------------------------------------------
+// XAccessibleText
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getCaretPosition() throw (RuntimeException)
+{
+ return -1;
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+// -----------------------------------------------------------------------------
+sal_Unicode SAL_CALL VCLXAccessibleListItem::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getCharacter( nIndex );
+}
+// -----------------------------------------------------------------------------
+Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::rtl::OUString sText( implGetText() );
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return Sequence< PropertyValue >();
+}
+// -----------------------------------------------------------------------------
+awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ ::rtl::OUString sText( implGetText() );
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( m_pListBoxHelper )
+ {
+ Rectangle aCharRect = m_pListBoxHelper->GetEntryCharacterBounds( m_nIndexInParent, nIndex );
+ Rectangle aItemRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
+ aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
+ aBounds = AWTRectangle( aCharRect );
+ }
+
+ return aBounds;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getCharacterCount();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ sal_Int32 nIndex = -1;
+ if ( m_pListBoxHelper )
+ {
+ sal_uInt16 nPos = LISTBOX_ENTRY_NOTFOUND;
+ Rectangle aItemRect = m_pListBoxHelper->GetBoundingRectangle( (sal_uInt16)m_nIndexInParent );
+ Point aPnt( VCLPoint( aPoint ) );
+ aPnt += aItemRect.TopLeft();
+ sal_Int32 nI = m_pListBoxHelper->GetIndexForPoint( aPnt, nPos );
+ if ( nI != -1 && (sal_uInt16)m_nIndexInParent == nPos )
+ nIndex = nI;
+ }
+ return nIndex;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleListItem::getSelectedText() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getSelectedText();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionStart() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getSelectionStart();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionEnd() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getSelectionEnd();
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleListItem::getText() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getText();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ checkIndex_Impl( nStartIndex, m_sEntryText );
+ checkIndex_Impl( nEndIndex, m_sEntryText );
+
+ sal_Bool bRet = sal_False;
+ if ( m_pListBoxHelper )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pListBoxHelper->GetClipboard();
+ if ( xClipboard.is() )
+ {
+ ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
+ ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
+
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ xClipboard->setContents( pDataObj, NULL );
+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
+ if( xFlushableClipboard.is() )
+ xFlushableClipboard->flushClipboard();
+ Application::AcquireSolarMutex( nRef );
+
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleEventBroadcaster
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleListItem::addEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+{
+ if (xListener.is())
+ {
+ if (!m_nClientId)
+ m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
+ }
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleListItem::removeEventListener( const Reference< XAccessibleEventListener >& xListener ) throw (RuntimeException)
+{
+ if ( xListener.is() && m_nClientId )
+ {
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ if ( m_nClientId )
+ {
+ comphelper::AccessibleEventNotifier::TClientId nId( m_nClientId );
+ m_nClientId = 0;
+ comphelper::AccessibleEventNotifier::revokeClient( nId );
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+
+
+
+// AF (Oct. 29 2002): Return black as constant foreground color. This is an
+// initial implementation and has to be substituted by code that determines
+// the color that is actually used.
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return COL_BLACK;
+}
+
+// AF (Oct. 29 2002): Return white as constant background color. This is an
+// initial implementation and has to be substituted by code that determines
+// the color that is actually used.
+sal_Int32 SAL_CALL VCLXAccessibleListItem::getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return COL_WHITE;
+}
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx
new file mode 100644
index 000000000000..f7e77f3fb8e2
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblemenu.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessiblemenu.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <vcl/menu.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleMenu
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenu::VCLXAccessibleMenu( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
+ :VCLXAccessibleMenuItem( pParent, nItemPos, pMenu )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenu::~VCLXAccessibleMenu()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenu::IsFocused()
+{
+ sal_Bool bFocused = sal_False;
+
+ if ( IsHighlighted() && !IsChildHighlighted() )
+ bFocused = sal_True;
+
+ return bFocused;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenu::IsPopupMenuOpen()
+{
+ sal_Bool bPopupMenuOpen = sal_False;
+
+ if ( m_pParent )
+ {
+ PopupMenu* pPopupMenu = m_pParent->GetPopupMenu( m_pParent->GetItemId( m_nItemPos ) );
+ if ( pPopupMenu && pPopupMenu->IsMenuVisible() )
+ bPopupMenuOpen = sal_True;
+ }
+
+ return bPopupMenuOpen;
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleMenu, VCLXAccessibleMenuItem, VCLXAccessibleMenu_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleMenu, VCLXAccessibleMenuItem, VCLXAccessibleMenu_BASE )
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenu::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleMenu" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleMenu::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleMenu" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenu::getAccessibleChildCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return GetChildCount();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleMenu::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return GetChild( i );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleMenu::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::MENU;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleMenu::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return GetChildAt( rPoint );
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleSelection
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenu::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ SelectChild( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenu::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return IsChildSelected( nChildIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenu::clearAccessibleSelection( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ DeSelectAll();
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenu::selectAllAccessibleChildren( ) throw (RuntimeException)
+{
+ // This method makes no sense in a menu, and so does nothing.
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenu::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nRet = 0;
+
+ for ( sal_Int32 i = 0, nCount = GetChildCount(); i < nCount; i++ )
+ {
+ if ( IsChildSelected( i ) )
+ ++nRet;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleMenu::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+
+ for ( sal_Int32 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
+ {
+ if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
+ {
+ xChild = GetChild( i );
+ break;
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenu::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
+ throw IndexOutOfBoundsException();
+
+ DeSelectAll();
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/accessibility/source/standard/vclxaccessiblemenubar.cxx
new file mode 100644
index 000000000000..a3e2f8cd6ae4
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblemenubar.cxx
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblemenubar.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/menu.hxx>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class VCLXAccessibleMenuBar
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuBar::VCLXAccessibleMenuBar( Menu* pMenu )
+ :OAccessibleMenuComponent( pMenu )
+{
+ if ( pMenu )
+ {
+ m_pWindow = pMenu->GetWindow();
+
+ if ( m_pWindow )
+ m_pWindow->AddEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuBar::~VCLXAccessibleMenuBar()
+{
+ if ( m_pWindow )
+ m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuBar::IsFocused()
+{
+ sal_Bool bFocused = sal_False;
+
+ if ( m_pWindow && m_pWindow->HasFocus() && !IsChildHighlighted() )
+ bFocused = sal_True;
+
+ return bFocused;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( VCLXAccessibleMenuBar, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "VCLXAccessibleMenuBar::WindowEventListener: unknown window event!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "VCLXAccessibleMenuBar::WindowEventListener: no window!" );
+ if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
+ {
+ ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenuBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ SetFocused( rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS );
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING:
+ {
+ if ( m_pWindow )
+ {
+ m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+ m_pWindow = NULL;
+ }
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenuBar::disposing()
+{
+ OAccessibleMenuComponent::disposing();
+
+ if ( m_pWindow )
+ {
+ m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
+ m_pWindow = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuBar::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleMenuBar" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleMenuBar::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleMenuBar" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuBar::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndexInParent = -1;
+
+ if ( m_pMenu )
+ {
+ Window* pWindow = m_pMenu->GetWindow();
+ if ( pWindow )
+ {
+ Window* pParent = pWindow->GetAccessibleParentWindow();
+ if ( pParent )
+ {
+ for ( sal_uInt16 n = pParent->GetAccessibleChildWindowCount(); n; )
+ {
+ Window* pChild = pParent->GetAccessibleChildWindow( --n );
+ if ( pChild == pWindow )
+ {
+ nIndexInParent = n;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return nIndexInParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleMenuBar::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::MENU_BAR;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuBar::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetStyleSettings().GetMenuBarColor().GetColor();
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
new file mode 100644
index 000000000000..7332386e4303
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
@@ -0,0 +1,607 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblemenuitem.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+#include <toolkit/helper/convert.hxx>
+#include <accessibility/helper/characterattributeshelper.hxx>
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <com/sun/star/awt/KeyModifier.hpp>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/unohelp2.hxx>
+
+#include <memory>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class VCLXAccessibleMenuItem
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuItem::VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
+ :OAccessibleMenuItemComponent( pParent, nItemPos, pMenu )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuItem::~VCLXAccessibleMenuItem()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::IsFocused()
+{
+ return IsHighlighted();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::IsSelected()
+{
+ return IsHighlighted();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::IsChecked()
+{
+ sal_Bool bChecked = sal_False;
+
+ if ( m_pParent )
+ {
+ sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
+ if ( m_pParent->IsItemChecked( nItemId ) )
+ bChecked = sal_True;
+ }
+
+ return bChecked;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::IsHighlighted()
+{
+ sal_Bool bHighlighted = sal_False;
+
+ if ( m_pParent && m_pParent->IsHighlighted( m_nItemPos ) )
+ bHighlighted = sal_True;
+
+ return bHighlighted;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenuItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ OAccessibleMenuItemComponent::FillAccessibleStateSet( rStateSet );
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ if ( IsFocused() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+
+ rStateSet.AddState( AccessibleStateType::SELECTABLE );
+
+ if ( IsSelected() )
+ rStateSet.AddState( AccessibleStateType::SELECTED );
+
+ if ( IsChecked() )
+ rStateSet.AddState( AccessibleStateType::CHECKED );
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleText
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuItem::implGetText()
+{
+ return m_sItemText;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale VCLXAccessibleMenuItem::implGetLocale()
+{
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleMenuItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+{
+ nStartIndex = 0;
+ nEndIndex = 0;
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE )
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuItem::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleMenuItem" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleMenuItem::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleMenuItem" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleMenuItem::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::MENU_ITEM;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleText
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuItem::getCaretPosition() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Unicode VCLXAccessibleMenuItem::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getCharacter( nIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > VCLXAccessibleMenuItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Sequence< PropertyValue > aValues;
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ Font aFont = Application::GetSettings().GetStyleSettings().GetMenuFont();
+ sal_Int32 nBackColor = getBackground();
+ sal_Int32 nColor = getForeground();
+ ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
+ aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
+
+ return aValues;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleMenuItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( m_pParent )
+ {
+ sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
+ Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos );
+ Rectangle aCharRect = m_pParent->GetCharacterBounds( nItemId, nIndex );
+ aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
+ aBounds = AWTRectangle( aCharRect );
+ }
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuItem::getCharacterCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getCharacterCount();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndex = -1;
+ if ( m_pParent )
+ {
+ sal_uInt16 nItemId = 0;
+ Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos );
+ Point aPnt( VCLPoint( aPoint ) );
+ aPnt += aItemRect.TopLeft();
+ sal_Int32 nI = m_pParent->GetIndexForPoint( aPnt, nItemId );
+ if ( nI != -1 && m_pParent->GetItemId( m_nItemPos ) == nItemId )
+ nIndex = nI;
+ }
+
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuItem::getSelectedText() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getSelectedText();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuItem::getSelectionStart() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getSelectionStart();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuItem::getSelectionEnd() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getSelectionEnd();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuItem::getText() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getText();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ if ( m_pParent )
+ {
+ Window* pWindow = m_pParent->GetWindow();
+ if ( pWindow )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard();
+ if ( xClipboard.is() )
+ {
+ ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
+
+ ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ xClipboard->setContents( pDataObj, NULL );
+
+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
+ if( xFlushableClipboard.is() )
+ xFlushableClipboard->flushClipboard();
+
+ Application::AcquireSolarMutex( nRef );
+
+ bReturn = sal_True;
+ }
+ }
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleMenuItem::getAccessibleActionCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ Click();
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuItem::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
+ Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+
+ if ( m_pParent )
+ {
+ // create auto mnemonics
+ if ( Application::GetSettings().GetStyleSettings().GetAutoMnemonic() && !( m_pParent->GetMenuFlags() & MENU_FLAG_NOAUTOMNEMONICS ) )
+ m_pParent->CreateAutoMnemonics();
+
+ // activation key
+ KeyEvent aKeyEvent = m_pParent->GetActivationKey( m_pParent->GetItemId( m_nItemPos ) );
+ KeyCode aKeyCode = aKeyEvent.GetKeyCode();
+ Sequence< awt::KeyStroke > aSeq1(1);
+ aSeq1[0].Modifiers = 0;
+ Reference< XAccessible > xParent( getAccessibleParent() );
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
+ if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU_BAR )
+ aSeq1[0].Modifiers |= awt::KeyModifier::MOD2;
+ }
+ aSeq1[0].KeyCode = aKeyCode.GetCode();
+ aSeq1[0].KeyChar = aKeyEvent.GetCharCode();
+ aSeq1[0].KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() );
+ pKeyBindingHelper->AddKeyBinding( aSeq1 );
+
+ // complete menu activation key sequence
+ Sequence< awt::KeyStroke > aSeq;
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
+ if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU )
+ {
+ Reference< XAccessibleAction > xAction( xParentContext, UNO_QUERY );
+ if ( xAction.is() && xAction->getAccessibleActionCount() > 0 )
+ {
+ Reference< XAccessibleKeyBinding > xKeyB( xAction->getAccessibleActionKeyBinding( 0 ) );
+ if ( xKeyB.is() && xKeyB->getAccessibleKeyBindingCount() > 1 )
+ aSeq = xKeyB->getAccessibleKeyBinding( 1 );
+ }
+ }
+ }
+ Sequence< awt::KeyStroke > aSeq2 = ::comphelper::concatSequences( aSeq, aSeq1 );
+ pKeyBindingHelper->AddKeyBinding( aSeq2 );
+
+ // accelerator key
+ KeyCode aAccelKeyCode = m_pParent->GetAccelKey( m_pParent->GetItemId( m_nItemPos ) );
+ if ( aAccelKeyCode.GetCode() != 0 )
+ {
+ Sequence< awt::KeyStroke > aSeq3(1);
+ aSeq3[0].Modifiers = 0;
+ if ( aAccelKeyCode.IsShift() )
+ aSeq3[0].Modifiers |= awt::KeyModifier::SHIFT;
+ if ( aAccelKeyCode.IsMod1() )
+ aSeq3[0].Modifiers |= awt::KeyModifier::MOD1;
+ if ( aAccelKeyCode.IsMod2() )
+ aSeq3[0].Modifiers |= awt::KeyModifier::MOD2;
+ if ( aAccelKeyCode.IsMod3() )
+ aSeq3[0].Modifiers |= awt::KeyModifier::MOD3;
+ aSeq3[0].KeyCode = aAccelKeyCode.GetCode();
+ aSeq3[0].KeyFunc = static_cast< sal_Int16 >( aAccelKeyCode.GetFunction() );
+ pKeyBindingHelper->AddKeyBinding( aSeq3 );
+ }
+ }
+
+ return xKeyBinding;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleValue
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleMenuItem::getCurrentValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ if ( IsSelected() )
+ aValue <<= (sal_Int32) 1;
+ else
+ aValue <<= (sal_Int32) 0;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleMenuItem::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+ sal_Int32 nValue = 0;
+ OSL_VERIFY( aNumber >>= nValue );
+
+ if ( nValue <= 0 )
+ {
+ DeSelect();
+ bReturn = sal_True;
+ }
+ else if ( nValue >= 1 )
+ {
+ Select();
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleMenuItem::getMaximumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 1;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleMenuItem::getMinimumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 0;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx b/accessibility/source/standard/vclxaccessiblemenuseparator.cxx
new file mode 100644
index 000000000000..07c8c0f2a3d4
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblemenuseparator.cxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblemenuseparator.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class VCLXAccessibleMenuSeparator
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuSeparator::VCLXAccessibleMenuSeparator( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
+ :OAccessibleMenuItemComponent( pParent, nItemPos, pMenu )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleMenuSeparator::~VCLXAccessibleMenuSeparator()
+{
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleMenuSeparator::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleMenuSeparator" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleMenuSeparator::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleMenuSeparator" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleMenuSeparator::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::SEPARATOR;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx b/accessibility/source/standard/vclxaccessiblepopupmenu.cxx
new file mode 100644
index 000000000000..328e015c60e5
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblepopupmenu.cxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblepopupmenu.hxx>
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class VCLXAccessiblePopupMenu
+// -----------------------------------------------------------------------------
+
+VCLXAccessiblePopupMenu::VCLXAccessiblePopupMenu( Menu* pMenu )
+ :OAccessibleMenuComponent( pMenu )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessiblePopupMenu::~VCLXAccessiblePopupMenu()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessiblePopupMenu::IsFocused()
+{
+ return !IsChildHighlighted();
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessiblePopupMenu::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessiblePopupMenu" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessiblePopupMenu::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessiblePopupMenu" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessiblePopupMenu::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessiblePopupMenu::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::POPUP_MENU;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessiblePopupMenu::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetStyleSettings().GetMenuColor().GetColor();
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
new file mode 100644
index 000000000000..76940967fcce
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -0,0 +1,314 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessibleradiobutton.hxx>
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/window.hxx>
+#include <vcl/button.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleRadioButton
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleRadioButton::VCLXAccessibleRadioButton( VCLXWindow* pVCLWindow )
+ :VCLXAccessibleTextComponent( pVCLWindow )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleRadioButton::~VCLXAccessibleRadioButton()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_RADIOBUTTON_TOGGLE:
+ {
+ Any aOldValue;
+ Any aNewValue;
+
+ VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() );
+ if ( pVCLXRadioButton && pVCLXRadioButton->getState() )
+ aNewValue <<= AccessibleStateType::CHECKED;
+ else
+ aOldValue <<= AccessibleStateType::CHECKED;
+
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ default:
+ VCLXAccessibleTextComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
+{
+ VCLXAccessibleTextComponent::FillAccessibleRelationSet( rRelationSet );
+
+ RadioButton* pRadioButton = dynamic_cast< RadioButton* >( GetWindow() );
+ if ( pRadioButton )
+ {
+ ::std::vector< RadioButton* > aGroup;
+ pRadioButton->GetRadioButtonGroup( aGroup, true );
+ if ( !aGroup.empty() )
+ {
+ sal_Int32 i = 0;
+ Sequence< Reference< XInterface > > aSequence( static_cast< sal_Int32 >( aGroup.size() ) );
+ ::std::vector< RadioButton* >::const_iterator aEndItr = aGroup.end();
+ for ( ::std::vector< RadioButton* >::const_iterator aItr = aGroup.begin(); aItr < aEndItr; ++aItr )
+ {
+ aSequence[i++] = (*aItr)->GetAccessible();
+ }
+ rRelationSet.AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleRadioButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
+
+ VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() );
+ if ( pVCLXRadioButton )
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ if ( pVCLXRadioButton->getState() )
+ rStateSet.AddState( AccessibleStateType::CHECKED );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleRadioButton, VCLXAccessibleTextComponent, VCLXAccessibleRadioButton_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleRadioButton, VCLXAccessibleTextComponent, VCLXAccessibleRadioButton_BASE )
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleRadioButton::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleRadioButton" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleRadioButton::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleRadioButton" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleRadioButton::getAccessibleActionCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleRadioButton::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() );
+ if ( pVCLXRadioButton && !pVCLXRadioButton->getState() )
+ pVCLXRadioButton->setState( sal_True );
+
+ return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleRadioButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
+ Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ KeyEvent aKeyEvent = pWindow->GetActivationKey();
+ KeyCode aKeyCode = aKeyEvent.GetKeyCode();
+ if ( aKeyCode.GetCode() != 0 )
+ {
+ awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ if ( aKeyCode.IsShift() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::SHIFT;
+ if ( aKeyCode.IsMod1() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD1;
+ if ( aKeyCode.IsMod2() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD2;
+ if ( aKeyCode.IsMod3() )
+ aKeyStroke.Modifiers |= awt::KeyModifier::MOD3;
+ aKeyStroke.KeyCode = aKeyCode.GetCode();
+ aKeyStroke.KeyChar = aKeyEvent.GetCharCode();
+ aKeyStroke.KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() );
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+ }
+ }
+
+ return xKeyBinding;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleValue
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleRadioButton::getCurrentValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+
+ VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() );
+ if ( pVCLXRadioButton )
+ aValue <<= (sal_Int32) pVCLXRadioButton->getState();
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleRadioButton::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() );
+ if ( pVCLXRadioButton )
+ {
+ sal_Int32 nValue = 0;
+ OSL_VERIFY( aNumber >>= nValue );
+
+ if ( nValue < 0 )
+ nValue = 0;
+ else if ( nValue > 1 )
+ nValue = 1;
+
+ pVCLXRadioButton->setState( (sal_Bool) nValue );
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleRadioButton::getMaximumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 1;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleRadioButton::getMinimumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 0;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
new file mode 100644
index 000000000000..9bd9cf45f94b
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessiblescrollbar.hxx>
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/scrbar.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleScrollBar
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleScrollBar::VCLXAccessibleScrollBar( VCLXWindow* pVCLWindow )
+ :VCLXAccessibleComponent( pVCLWindow )
+{
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleScrollBar::~VCLXAccessibleScrollBar()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_SCROLLBAR_SCROLL:
+ {
+ NotifyAccessibleEvent( AccessibleEventId::VALUE_CHANGED, Any(), Any() );
+ }
+ break;
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleScrollBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+
+ VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() );
+ if ( pVCLXScrollBar )
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::HORIZONTAL )
+ rStateSet.AddState( AccessibleStateType::HORIZONTAL );
+ else if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::VERTICAL )
+ rStateSet.AddState( AccessibleStateType::VERTICAL );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleScrollBar, VCLXAccessibleComponent, VCLXAccessibleScrollBar_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleScrollBar, VCLXAccessibleComponent, VCLXAccessibleScrollBar_BASE )
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleScrollBar::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleScrollBar" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleScrollBar::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleScrollBar" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleScrollBar::getAccessibleActionCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 4;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleScrollBar::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ sal_Bool bReturn = sal_False;
+ ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ if ( pScrollBar )
+ {
+ ScrollType eScrollType;
+ switch ( nIndex )
+ {
+ case 0: eScrollType = SCROLL_LINEUP; break;
+ case 1: eScrollType = SCROLL_LINEDOWN; break;
+ case 2: eScrollType = SCROLL_PAGEUP; break;
+ case 3: eScrollType = SCROLL_PAGEDOWN; break;
+ default: eScrollType = SCROLL_DONTKNOW; break;
+ }
+ if ( pScrollBar->DoScrollAction( eScrollType ) )
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleScrollBar::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ ::rtl::OUString sDescription;
+
+ switch ( nIndex )
+ {
+ case 0: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_DECLINE ) ); break;
+ case 1: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_INCLINE ) ); break;
+ case 2: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_DECBLOCK ) ); break;
+ case 3: sDescription = ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_INCBLOCK ) ); break;
+ default: break;
+ }
+
+ return sDescription;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleKeyBinding > VCLXAccessibleScrollBar::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessibleKeyBinding >();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleValue
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleScrollBar::getCurrentValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+
+ VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() );
+ if ( pVCLXScrollBar )
+ aValue <<= (sal_Int32) pVCLXScrollBar->getValue();
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleScrollBar::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() );
+ if ( pVCLXScrollBar )
+ {
+ sal_Int32 nValue = 0, nValueMin = 0, nValueMax = 0;
+ OSL_VERIFY( aNumber >>= nValue );
+ OSL_VERIFY( getMinimumValue() >>= nValueMin );
+ OSL_VERIFY( getMaximumValue() >>= nValueMax );
+
+ if ( nValue < nValueMin )
+ nValue = nValueMin;
+ else if ( nValue > nValueMax )
+ nValue = nValueMax;
+
+ pVCLXScrollBar->setValue( nValue );
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleScrollBar::getMaximumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+
+ VCLXScrollBar* pVCLXScrollBar = static_cast< VCLXScrollBar* >( GetVCLXWindow() );
+ if ( pVCLXScrollBar )
+ aValue <<= (sal_Int32) pVCLXScrollBar->getMaximum();
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
+
+Any VCLXAccessibleScrollBar::getMinimumValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= (sal_Int32) 0;
+
+ return aValue;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
new file mode 100644
index 000000000000..1e1d7b0ef640
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
@@ -0,0 +1,366 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblestatusbar.hxx>
+#include <accessibility/standard/vclxaccessiblestatusbaritem.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <vcl/status.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleStatusBar
+// ----------------------------------------------------
+
+VCLXAccessibleStatusBar::VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow )
+ :VCLXAccessibleComponent( pVCLXWindow )
+{
+ m_pStatusBar = static_cast< StatusBar* >( GetWindow() );
+
+ if ( m_pStatusBar )
+ m_aAccessibleChildren.assign( m_pStatusBar->GetItemCount(), Reference< XAccessible >() );
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleStatusBar::~VCLXAccessibleStatusBar()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBar::UpdateShowing( sal_Int32 i, sal_Bool bShowing )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
+ if ( pVCLXAccessibleStatusBarItem )
+ pVCLXAccessibleStatusBarItem->SetShowing( bShowing );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBar::UpdateItemName( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
+ if ( pVCLXAccessibleStatusBarItem )
+ {
+ ::rtl::OUString sItemName = pVCLXAccessibleStatusBarItem->GetItemName();
+ pVCLXAccessibleStatusBarItem->SetItemName( sItemName );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBar::UpdateItemText( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
+ if ( pVCLXAccessibleStatusBarItem )
+ {
+ ::rtl::OUString sItemText = pVCLXAccessibleStatusBarItem->GetItemText();
+ pVCLXAccessibleStatusBarItem->SetItemText( sItemText );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBar::InsertChild( sal_Int32 i )
+{
+ if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ // insert entry in child list
+ m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
+
+ // send accessible child event
+ Reference< XAccessible > xChild( getAccessibleChild( i ) );
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBar::RemoveChild( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ // get the accessible of the removed page
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+
+ // remove entry in child list
+ m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
+
+ // send accessible child event
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+
+ Reference< XComponent > xComponent( xChild, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_STATUSBAR_ITEMADDED:
+ {
+ if ( m_pStatusBar )
+ {
+ sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
+ InsertChild( nItemPos );
+ }
+ }
+ break;
+ case VCLEVENT_STATUSBAR_ITEMREMOVED:
+ {
+ if ( m_pStatusBar )
+ {
+ sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ {
+ Reference< XAccessible > xChild( getAccessibleChild( i ) );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
+ if ( pVCLXAccessibleStatusBarItem && pVCLXAccessibleStatusBarItem->GetItemId() == nItemId )
+ {
+ RemoveChild( i );
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+ case VCLEVENT_STATUSBAR_ALLITEMSREMOVED:
+ {
+ for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i )
+ RemoveChild( i );
+ }
+ break;
+ case VCLEVENT_STATUSBAR_SHOWITEM:
+ case VCLEVENT_STATUSBAR_HIDEITEM:
+ {
+ if ( m_pStatusBar )
+ {
+ sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
+ UpdateShowing( nItemPos, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWITEM );
+ }
+ }
+ break;
+ case VCLEVENT_STATUSBAR_SHOWALLITEMS:
+ case VCLEVENT_STATUSBAR_HIDEALLITEMS:
+ {
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ UpdateShowing( i, rVclWindowEvent.GetId() == VCLEVENT_STATUSBAR_SHOWALLITEMS );
+ }
+ break;
+ case VCLEVENT_STATUSBAR_NAMECHANGED:
+ {
+ if ( m_pStatusBar )
+ {
+ sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
+ UpdateItemName( nItemPos );
+ }
+ }
+ break;
+ case VCLEVENT_STATUSBAR_DRAWITEM:
+ {
+ if ( m_pStatusBar )
+ {
+ sal_uInt16 nItemId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nItemPos = m_pStatusBar->GetItemPos( nItemId );
+ UpdateItemText( nItemPos );
+ }
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING:
+ {
+ if ( m_pStatusBar )
+ {
+ m_pStatusBar = NULL;
+
+ // dispose all children
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+ break;
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBar::disposing()
+{
+ VCLXAccessibleComponent::disposing();
+
+ if ( m_pStatusBar )
+ {
+ m_pStatusBar = NULL;
+
+ // dispose all children
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBar::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleStatusBar" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleStatusBar::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleStatusBar" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleStatusBar::getAccessibleChildCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return m_aAccessibleChildren.size();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ if ( !xChild.is() )
+ {
+ if ( m_pStatusBar )
+ {
+ sal_uInt16 nItemId = m_pStatusBar->GetItemId( (sal_uInt16)i );
+
+ xChild = new VCLXAccessibleStatusBarItem( m_pStatusBar, nItemId );
+
+ // insert into status bar item list
+ m_aAccessibleChildren[i] = xChild;
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xChild;
+ if ( m_pStatusBar )
+ {
+ sal_uInt16 nItemId = m_pStatusBar->GetItemId( VCLPoint( rPoint ) );
+ sal_Int32 nItemPos = m_pStatusBar->GetItemPos( nItemId );
+ if ( nItemPos >= 0 && nItemPos < (sal_Int32)m_aAccessibleChildren.size() )
+ xChild = getAccessibleChild( nItemPos );
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
new file mode 100644
index 000000000000..c3badc50bdbf
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
@@ -0,0 +1,629 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessiblestatusbaritem.hxx>
+#include <toolkit/helper/externallock.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <accessibility/helper/characterattributeshelper.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/unohelp2.hxx>
+#include <vcl/status.hxx>
+#include <vcl/controllayout.hxx>
+
+#include <memory>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class VCLXAccessibleStatusBarItem
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleStatusBarItem::VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId )
+ :AccessibleTextHelper_BASE( new VCLExternalSolarLock() )
+ ,m_pStatusBar( pStatusBar )
+ ,m_nItemId( nItemId )
+{
+ m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
+
+ m_sItemName = GetItemName();
+ m_sItemText = GetItemText();
+ m_bShowing = IsShowing();
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleStatusBarItem::~VCLXAccessibleStatusBarItem()
+{
+ delete m_pExternalLock;
+ m_pExternalLock = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleStatusBarItem::IsShowing()
+{
+ sal_Bool bShowing = sal_False;
+
+ if ( m_pStatusBar )
+ bShowing = m_pStatusBar->IsItemVisible( m_nItemId );
+
+ return bShowing;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBarItem::SetShowing( sal_Bool bShowing )
+{
+ if ( m_bShowing != bShowing )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bShowing )
+ aOldValue <<= AccessibleStateType::SHOWING;
+ else
+ aNewValue <<= AccessibleStateType::SHOWING;
+ m_bShowing = bShowing;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBarItem::SetItemName( const ::rtl::OUString& sItemName )
+{
+ if ( !m_sItemName.equals( sItemName ) )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= m_sItemName;
+ aNewValue <<= sItemName;
+ m_sItemName = sItemName;
+ NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::GetItemName()
+{
+ ::rtl::OUString sName;
+ if ( m_pStatusBar )
+ sName = m_pStatusBar->GetAccessibleName( m_nItemId );
+
+ return sName;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBarItem::SetItemText( const ::rtl::OUString& sItemText )
+{
+ Any aOldValue, aNewValue;
+ if ( implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) )
+ {
+ m_sItemText = sItemText;
+ NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::GetItemText()
+{
+ ::rtl::OUString sText;
+ ::vcl::ControlLayoutData aLayoutData;
+ if ( m_pStatusBar )
+ {
+ Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId );
+ m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect );
+ sText = aLayoutData.m_aDisplayText;
+ }
+
+ return sText;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::SENSITIVE );
+
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+
+ if ( IsShowing() )
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleComponent
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleStatusBarItem::implGetBounds() throw (RuntimeException)
+{
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+
+ if ( m_pStatusBar )
+ aBounds = AWTRectangle( m_pStatusBar->GetItemRect( m_nItemId ) );
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleText
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::implGetText()
+{
+ return GetItemText();
+}
+
+// -----------------------------------------------------------------------------
+
+lang::Locale VCLXAccessibleStatusBarItem::implGetLocale()
+{
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBarItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+{
+ nStartIndex = 0;
+ nEndIndex = 0;
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE )
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBarItem::disposing()
+{
+ AccessibleTextHelper_BASE::disposing();
+
+ m_pStatusBar = NULL;
+ m_sItemName = ::rtl::OUString();
+ m_sItemText = ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleStatusBarItem" );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleStatusBarItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleStatusBarItem::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleStatusBarItem" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessible
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > VCLXAccessibleStatusBarItem::getAccessibleContext( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleChildCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessible >();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xParent;
+ if ( m_pStatusBar )
+ xParent = m_pStatusBar->GetAccessible();
+
+ return xParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndexInParent = -1;
+ if ( m_pStatusBar )
+ nIndexInParent = m_pStatusBar->GetItemPos( m_nItemId );
+
+ return nIndexInParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleStatusBarItem::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::LABEL;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::getAccessibleDescription( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sDescription;
+ if ( m_pStatusBar )
+ sDescription = m_pStatusBar->GetHelpText( m_nItemId );
+
+ return sDescription;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return GetItemName();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > VCLXAccessibleStatusBarItem::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > VCLXAccessibleStatusBarItem::getAccessibleStateSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+
+ if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ FillAccessibleStateSet( *pStateSetHelper );
+ }
+ else
+ {
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ }
+
+ return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale VCLXAccessibleStatusBarItem::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Reference< XAccessible >();
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleStatusBarItem::grabFocus( ) throw (RuntimeException)
+{
+ // no focus for status bar items
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleStatusBarItem::getForeground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getForeground();
+ }
+
+ return nColor;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleStatusBarItem::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getBackground();
+ }
+
+ return nColor;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+Reference< awt::XFont > VCLXAccessibleStatusBarItem::getFont( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< awt::XFont > xFont;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ xFont = xParentComp->getFont();
+ }
+
+ return xFont;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::getTitledBorderText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return GetItemText();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleStatusBarItem::getToolTipText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleText
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleStatusBarItem::getCaretPosition() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleStatusBarItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > VCLXAccessibleStatusBarItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Sequence< PropertyValue > aValues;
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ if ( m_pStatusBar )
+ {
+ Font aFont = m_pStatusBar->GetFont();
+ sal_Int32 nBackColor = getBackground();
+ sal_Int32 nColor = getForeground();
+ ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
+ aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
+ }
+
+ return aValues;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleStatusBarItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( m_pStatusBar )
+ {
+ ::vcl::ControlLayoutData aLayoutData;
+ Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId );
+ m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect );
+ Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex );
+ aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
+ aBounds = AWTRectangle( aCharRect );
+ }
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleStatusBarItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndex = -1;
+ if ( m_pStatusBar )
+ {
+ ::vcl::ControlLayoutData aLayoutData;
+ Rectangle aItemRect = m_pStatusBar->GetItemRect( m_nItemId );
+ m_pStatusBar->RecordLayoutData( &aLayoutData, aItemRect );
+ Point aPnt( VCLPoint( aPoint ) );
+ aPnt += aItemRect.TopLeft();
+ nIndex = aLayoutData.GetIndexForPoint( aPnt );
+ }
+
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleStatusBarItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ if ( m_pStatusBar )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pStatusBar->GetClipboard();
+ if ( xClipboard.is() )
+ {
+ ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
+
+ ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ xClipboard->setContents( pDataObj, NULL );
+
+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
+ if( xFlushableClipboard.is() )
+ xFlushableClipboard->flushClipboard();
+
+ Application::AcquireSolarMutex( nRef );
+
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
new file mode 100644
index 000000000000..e23580b05280
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
@@ -0,0 +1,515 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessibletabcontrol.hxx>
+#include <accessibility/standard/vclxaccessibletabpage.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleTabControl
+// ----------------------------------------------------
+
+VCLXAccessibleTabControl::VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow )
+ :VCLXAccessibleComponent( pVCLXWindow )
+{
+ m_pTabControl = static_cast< TabControl* >( GetWindow() );
+
+ if ( m_pTabControl )
+ m_aAccessibleChildren.assign( m_pTabControl->GetPageCount(), Reference< XAccessible >() );
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleTabControl::~VCLXAccessibleTabControl()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::UpdateFocused()
+{
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->SetFocused( pVCLXAccessibleTabPage->IsFocused() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::UpdateSelected( sal_Int32 i, bool bSelected )
+{
+ NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
+
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->SetSelected( bSelected );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::UpdatePageText( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->SetPageText( pVCLXAccessibleTabPage->GetPageText() );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::UpdateTabPage( sal_Int32 i, bool bNew )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->Update( bNew );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::InsertChild( sal_Int32 i )
+{
+ if ( i >= 0 && i <= (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ // insert entry in child list
+ m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
+
+ // send accessible child event
+ Reference< XAccessible > xChild( getAccessibleChild( i ) );
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::RemoveChild( sal_Int32 i )
+{
+ if ( i >= 0 && i < (sal_Int32)m_aAccessibleChildren.size() )
+ {
+ // get the accessible of the removed page
+ Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+
+ // remove entry in child list
+ m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
+
+ // send accessible child event
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+
+ Reference< XComponent > xComponent( xChild, UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABPAGE_ACTIVATE:
+ case VCLEVENT_TABPAGE_DEACTIVATE:
+ {
+ if ( m_pTabControl )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId );
+ UpdateFocused();
+ UpdateSelected( nPagePos, rVclWindowEvent.GetId() == VCLEVENT_TABPAGE_ACTIVATE );
+ }
+ }
+ break;
+ case VCLEVENT_TABPAGE_PAGETEXTCHANGED:
+ {
+ if ( m_pTabControl )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId );
+ UpdatePageText( nPagePos );
+ }
+ }
+ break;
+ case VCLEVENT_TABPAGE_INSERTED:
+ {
+ if ( m_pTabControl )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ sal_uInt16 nPagePos = m_pTabControl->GetPagePos( nPageId );
+ InsertChild( nPagePos );
+ }
+ }
+ break;
+ case VCLEVENT_TABPAGE_REMOVED:
+ {
+ if ( m_pTabControl )
+ {
+ sal_uInt16 nPageId = (sal_uInt16)(sal_IntPtr) rVclWindowEvent.GetData();
+ for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ {
+ Reference< XAccessible > xChild( getAccessibleChild( i ) );
+ if ( xChild.is() )
+ {
+ VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
+ if ( pVCLXAccessibleTabPage && pVCLXAccessibleTabPage->GetPageId() == nPageId )
+ {
+ RemoveChild( i );
+ break;
+ }
+ }
+ }
+ }
+ }
+ break;
+ case VCLEVENT_TABPAGE_REMOVEDALL:
+ {
+ for ( sal_Int32 i = m_aAccessibleChildren.size() - 1; i >= 0; --i )
+ RemoveChild( i );
+ }
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ UpdateFocused();
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING:
+ {
+ if ( m_pTabControl )
+ {
+ m_pTabControl = NULL;
+
+ // dispose all tab pages
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+ break;
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ if ( m_pTabControl )
+ {
+ Window* pChild = static_cast< Window* >( rVclWindowEvent.GetData() );
+ if ( pChild && pChild->GetType() == WINDOW_TABPAGE )
+ {
+ for ( sal_Int32 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i )
+ {
+ sal_uInt16 nPageId = m_pTabControl->GetPageId( (sal_uInt16)i );
+ TabPage* pTabPage = m_pTabControl->GetTabPage( nPageId );
+ if ( pTabPage == (TabPage*) pChild )
+ UpdateTabPage( i, rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW );
+ }
+ }
+ }
+ }
+ break;
+ default:
+ VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent );
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+
+ if ( m_pTabControl )
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTabControl, VCLXAccessibleComponent, VCLXAccessibleTabControl_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTabControl, VCLXAccessibleComponent, VCLXAccessibleTabControl_BASE )
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::disposing()
+{
+ VCLXAccessibleComponent::disposing();
+
+ if ( m_pTabControl )
+ {
+ m_pTabControl = NULL;
+
+ // dispose all tab pages
+ for ( sal_uInt32 i = 0; i < m_aAccessibleChildren.size(); ++i )
+ {
+ Reference< XComponent > xComponent( m_aAccessibleChildren[i], UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ m_aAccessibleChildren.clear();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabControl::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleTabControl" );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleTabControl::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleTabControl" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabControl::getAccessibleChildCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return m_aAccessibleChildren.size();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleTabControl::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ if ( !xChild.is() )
+ {
+ if ( m_pTabControl )
+ {
+ sal_uInt16 nPageId = m_pTabControl->GetPageId( (sal_uInt16)i );
+
+ xChild = new VCLXAccessibleTabPage( m_pTabControl, nPageId );
+
+ // insert into tab page list
+ m_aAccessibleChildren[i] = xChild;
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleTabControl::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::PAGE_TAB_LIST;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabControl::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleSelection
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ if ( m_pTabControl )
+ m_pTabControl->SelectTabPage( m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTabControl::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ sal_Bool bSelected = sal_False;
+ if ( m_pTabControl && m_pTabControl->GetCurPageId() == m_pTabControl->GetPageId( (sal_uInt16)nChildIndex ) )
+ bSelected = sal_True;
+
+ return bSelected;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::clearAccessibleSelection( ) throw (RuntimeException)
+{
+ // This method makes no sense in a tab control, and so does nothing.
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::selectAllAccessibleChildren( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ selectAccessibleChild( 0 );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabControl::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleTabControl::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+
+ for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ )
+ {
+ if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
+ {
+ xChild = getAccessibleChild( i );
+ break;
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabControl::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ // This method makes no sense in a tab control, and so does nothing.
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx
new file mode 100644
index 000000000000..6b871fced829
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibletabpage.cxx
@@ -0,0 +1,702 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessibletabpage.hxx>
+#include <toolkit/helper/externallock.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <accessibility/helper/characterattributeshelper.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/unohelp2.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+
+#include <memory>
+
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+// -----------------------------------------------------------------------------
+// class VCLXAccessibleTabPage
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleTabPage::VCLXAccessibleTabPage( TabControl* pTabControl, sal_uInt16 nPageId )
+ :AccessibleTextHelper_BASE( new VCLExternalSolarLock() )
+ ,m_pTabControl( pTabControl )
+ ,m_nPageId( nPageId )
+{
+ m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
+ m_bFocused = IsFocused();
+ m_bSelected = IsSelected();
+ m_sPageText = GetPageText();
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleTabPage::~VCLXAccessibleTabPage()
+{
+ delete m_pExternalLock;
+ m_pExternalLock = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+bool VCLXAccessibleTabPage::IsFocused()
+{
+ bool bFocused = false;
+
+ if ( m_pTabControl && m_pTabControl->HasFocus() && m_pTabControl->GetCurPageId() == m_nPageId )
+ bFocused = true;
+
+ return bFocused;
+}
+
+// -----------------------------------------------------------------------------
+
+bool VCLXAccessibleTabPage::IsSelected()
+{
+ bool bSelected = false;
+
+ if ( m_pTabControl && m_pTabControl->GetCurPageId() == m_nPageId )
+ bSelected = true;
+
+ return bSelected;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::SetFocused( bool bFocused )
+{
+ if ( m_bFocused != bFocused )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bFocused )
+ aOldValue <<= AccessibleStateType::FOCUSED;
+ else
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ m_bFocused = bFocused;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::SetSelected( bool bSelected )
+{
+ if ( m_bSelected != bSelected )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bSelected )
+ aOldValue <<= AccessibleStateType::SELECTED;
+ else
+ aNewValue <<= AccessibleStateType::SELECTED;
+ m_bSelected = bSelected;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::SetPageText( const ::rtl::OUString& sPageText )
+{
+ Any aOldValue, aNewValue;
+ if ( OCommonAccessibleText::implInitTextChangedEvent( m_sPageText, sPageText, aOldValue, aNewValue ) )
+ {
+ Any aOldName, aNewName;
+ aOldName <<= m_sPageText;
+ aNewName <<= sPageText;
+ m_sPageText = sPageText;
+ NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldName, aNewName );
+ NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabPage::GetPageText()
+{
+ ::rtl::OUString sText;
+ if ( m_pTabControl )
+ sText = OutputDevice::GetNonMnemonicString( m_pTabControl->GetPageText( m_nPageId ) );
+
+ return sText;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::Update( bool bNew )
+{
+ if ( m_pTabControl )
+ {
+ TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId );
+ if ( pTabPage )
+ {
+ Reference< XAccessible > xChild( pTabPage->GetAccessible( bNew ) );
+ if ( xChild.is() )
+ {
+ Any aOldValue, aNewValue;
+ if ( bNew )
+ aNewValue <<= xChild;
+ else
+ aOldValue <<= xChild;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet.AddState( AccessibleStateType::SENSITIVE );
+
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+
+ if ( IsFocused() )
+ rStateSet.AddState( AccessibleStateType::FOCUSED );
+
+ rStateSet.AddState( AccessibleStateType::VISIBLE );
+
+ rStateSet.AddState( AccessibleStateType::SHOWING );
+
+ rStateSet.AddState( AccessibleStateType::SELECTABLE );
+
+ if ( IsSelected() )
+ rStateSet.AddState( AccessibleStateType::SELECTED );
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleComponent
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleTabPage::implGetBounds() throw (RuntimeException)
+{
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+
+ if ( m_pTabControl )
+ aBounds = AWTRectangle( m_pTabControl->GetTabBounds( m_nPageId ) );
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleText
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabPage::implGetText()
+{
+ return GetPageText();
+}
+
+// -----------------------------------------------------------------------------
+
+lang::Locale VCLXAccessibleTabPage::implGetLocale()
+{
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+{
+ nStartIndex = 0;
+ nEndIndex = 0;
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE )
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::disposing()
+{
+ AccessibleTextHelper_BASE::disposing();
+
+ m_pTabControl = NULL;
+ m_sPageText = ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabPage::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleTabPage" );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTabPage::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleTabPage::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleTabPage" );
+ return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessible
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > VCLXAccessibleTabPage::getAccessibleContext( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabPage::getAccessibleChildCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nCount = 0;
+ if ( m_pTabControl )
+ {
+ TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId );
+ if ( pTabPage && pTabPage->IsVisible() )
+ nCount = 1;
+ }
+
+ return nCount;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ Reference< XAccessible > xChild;
+ if ( m_pTabControl )
+ {
+ TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId );
+ if ( pTabPage && pTabPage->IsVisible() )
+ xChild = pTabPage->GetAccessible();
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xParent;
+ if ( m_pTabControl )
+ xParent = m_pTabControl->GetAccessible();
+
+ return xParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabPage::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndexInParent = -1;
+ if ( m_pTabControl )
+ nIndexInParent = m_pTabControl->GetPagePos( m_nPageId );
+
+ return nIndexInParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleTabPage::getAccessibleRole( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return AccessibleRole::PAGE_TAB;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabPage::getAccessibleDescription( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sDescription;
+ if ( m_pTabControl )
+ sDescription = m_pTabControl->GetHelpText( m_nPageId );
+
+ return sDescription;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabPage::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return GetPageText();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > VCLXAccessibleTabPage::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > VCLXAccessibleTabPage::getAccessibleStateSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+
+ if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ FillAccessibleStateSet( *pStateSetHelper );
+ }
+ else
+ {
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ }
+
+ return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Locale VCLXAccessibleTabPage::getLocale( ) throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt::Point& rPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xChild;
+ for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ {
+ Reference< XAccessible > xAcc = getAccessibleChild( i );
+ if ( xAcc.is() )
+ {
+ Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
+ if ( xComp.is() )
+ {
+ Rectangle aRect = VCLRectangle( xComp->getBounds() );
+ Point aPos = VCLPoint( rPoint );
+ if ( aRect.IsInside( aPos ) )
+ {
+ xChild = xAcc;
+ break;
+ }
+ }
+ }
+ }
+
+ return xChild;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPage::grabFocus( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( m_pTabControl )
+ {
+ m_pTabControl->SelectTabPage( m_nPageId );
+ m_pTabControl->GrabFocus();
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabPage::getForeground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getForeground();
+ }
+
+ return nColor;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabPage::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ nColor = xParentComp->getBackground();
+ }
+
+ return nColor;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+Reference< awt::XFont > VCLXAccessibleTabPage::getFont( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< awt::XFont > xFont;
+ Reference< XAccessible > xParent = getAccessibleParent();
+ if ( xParent.is() )
+ {
+ Reference< XAccessibleExtendedComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
+ if ( xParentComp.is() )
+ xFont = xParentComp->getFont();
+ }
+
+ return xFont;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabPage::getTitledBorderText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTabPage::getToolTipText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleText
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabPage::getCaretPosition() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTabPage::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > VCLXAccessibleTabPage::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Sequence< PropertyValue > aValues;
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ if ( m_pTabControl )
+ {
+ Font aFont = m_pTabControl->GetFont();
+ sal_Int32 nBackColor = getBackground();
+ sal_Int32 nColor = getForeground();
+ ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
+ aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
+ }
+
+ return aValues;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleTabPage::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( m_pTabControl )
+ {
+ Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
+ Rectangle aCharRect = m_pTabControl->GetCharacterBounds( m_nPageId, nIndex );
+ aCharRect.Move( -aPageRect.Left(), -aPageRect.Top() );
+ aBounds = AWTRectangle( aCharRect );
+ }
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabPage::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndex = -1;
+ if ( m_pTabControl )
+ {
+ sal_uInt16 nPageId = 0;
+ Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
+ Point aPnt( VCLPoint( aPoint ) );
+ aPnt += aPageRect.TopLeft();
+ sal_Int32 nI = m_pTabControl->GetIndexForPoint( aPnt, nPageId );
+ if ( nI != -1 && m_nPageId == nPageId )
+ nIndex = nI;
+ }
+
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTabPage::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ if ( m_pTabControl )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pTabControl->GetClipboard();
+ if ( xClipboard.is() )
+ {
+ ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
+
+ ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ xClipboard->setContents( pDataObj, NULL );
+
+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
+ if( xFlushableClipboard.is() )
+ xFlushableClipboard->flushClipboard();
+
+ Application::AcquireSolarMutex( nRef );
+
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
new file mode 100644
index 000000000000..93fc1b3da2ff
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessibletabpagewindow.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleTabPageWindow
+// ----------------------------------------------------
+
+VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow )
+ :VCLXAccessibleComponent( pVCLXWindow )
+{
+ m_pTabPage = static_cast< TabPage* >( GetWindow() );
+ if ( m_pTabPage )
+ {
+ Window* pParent = m_pTabPage->GetAccessibleParentWindow();
+ if ( pParent && pParent->GetType() == WINDOW_TABCONTROL )
+ {
+ m_pTabControl = static_cast< TabControl* >( pParent );
+ if ( m_pTabControl )
+ {
+ for ( sal_uInt16 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i )
+ {
+ sal_uInt16 nPageId = m_pTabControl->GetPageId( i );
+ if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage )
+ m_nPageId = nPageId;
+ }
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleTabPageWindow::~VCLXAccessibleTabPageWindow()
+{
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleComponent
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleTabPageWindow::implGetBounds() throw (RuntimeException)
+{
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+
+ if ( m_pTabControl )
+ {
+ Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
+ if ( m_pTabPage )
+ {
+ Rectangle aRect = Rectangle( m_pTabPage->GetPosPixel(), m_pTabPage->GetSizePixel() );
+ aRect.Move( -aPageRect.Left(), -aPageRect.Top() );
+ aBounds = AWTRectangle( aRect );
+ }
+ }
+
+ return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTabPageWindow::disposing()
+{
+ VCLXAccessibleComponent::disposing();
+
+ m_pTabControl = NULL;
+ m_pTabPage = NULL;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleTabPageWindow::getAccessibleParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xParent;
+ if ( m_pTabControl )
+ {
+ Reference< XAccessible > xAcc( m_pTabControl->GetAccessible() );
+ if ( xAcc.is() )
+ {
+ Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() );
+ if ( xCont.is() )
+ xParent = xCont->getAccessibleChild( m_pTabControl->GetPagePos( m_nPageId ) );
+ }
+ }
+
+ return xParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
new file mode 100644
index 000000000000..c6bbaddf6426
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -0,0 +1,362 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessibletextcomponent.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <accessibility/helper/characterattributeshelper.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/unohelp2.hxx>
+#include <vcl/ctrl.hxx>
+
+#include <memory>
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleTextComponent
+// ----------------------------------------------------
+
+VCLXAccessibleTextComponent::VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow )
+ :VCLXAccessibleComponent( pVCLXWindow )
+{
+ if ( GetWindow() )
+ m_sText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() );
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleTextComponent::~VCLXAccessibleTextComponent()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTextComponent::SetText( const ::rtl::OUString& sText )
+{
+ Any aOldValue, aNewValue;
+ if ( implInitTextChangedEvent( m_sText, sText, aOldValue, aNewValue ) )
+ {
+ m_sText = sText;
+ NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTextComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_FRAMETITLECHANGED:
+ {
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ SetText( implGetText() );
+ }
+ break;
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleText
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTextComponent::implGetText()
+{
+ ::rtl::OUString aText;
+ if ( GetWindow() )
+ aText = OutputDevice::GetNonMnemonicString( GetWindow()->GetText() );
+
+ return aText;
+}
+
+// -----------------------------------------------------------------------------
+
+lang::Locale VCLXAccessibleTextComponent::implGetLocale()
+{
+ return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTextComponent::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+{
+ nStartIndex = 0;
+ nEndIndex = 0;
+}
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleTextComponent::disposing()
+{
+ VCLXAccessibleComponent::disposing();
+
+ m_sText = ::rtl::OUString();
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
+
+// -----------------------------------------------------------------------------
+// XAccessibleText
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTextComponent::getCaretPosition() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTextComponent::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return setSelection( nIndex, nIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Unicode VCLXAccessibleTextComponent::getCharacter( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getCharacter( nIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< PropertyValue > VCLXAccessibleTextComponent::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Sequence< PropertyValue > aValues;
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ if ( GetWindow() )
+ {
+ Font aFont = GetWindow()->GetControlFont();
+ sal_Int32 nBackColor = GetWindow()->GetControlBackground().GetColor();
+ sal_Int32 nColor = GetWindow()->GetControlForeground().GetColor();
+ ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
+ aValues = pHelper->GetCharacterAttributes( aRequestedAttributes );
+ }
+
+ return aValues;
+}
+
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleTextComponent::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidIndex( nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aRect;
+ Control* pControl = static_cast< Control* >( GetWindow() );
+ if ( pControl )
+ aRect = AWTRectangle( pControl->GetCharacterBounds( nIndex ) );
+
+ return aRect;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTextComponent::getCharacterCount() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getCharacterCount();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTextComponent::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndex = -1;
+ Control* pControl = static_cast< Control* >( GetWindow() );
+ if ( pControl )
+ nIndex = pControl->GetIndexForPoint( VCLPoint( aPoint ) );
+
+ return nIndex;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTextComponent::getSelectedText() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getSelectedText();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTextComponent::getSelectionStart() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getSelectionStart();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleTextComponent::getSelectionEnd() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getSelectionEnd();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTextComponent::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTextComponent::getText() throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getText();
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleTextComponent::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextRange( nStartIndex, nEndIndex );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+::com::sun::star::accessibility::TextSegment VCLXAccessibleTextComponent::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ if ( GetWindow() )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = GetWindow()->GetClipboard();
+ if ( xClipboard.is() )
+ {
+ ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
+
+ ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ xClipboard->setContents( pDataObj, NULL );
+
+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
+ if( xFlushableClipboard.is() )
+ xFlushableClipboard->flushClipboard();
+
+ Application::AcquireSolarMutex( nRef );
+
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibletextfield.cxx b/accessibility/source/standard/vclxaccessibletextfield.cxx
new file mode 100644
index 000000000000..e77d203d443a
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibletextfield.cxx
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_accessibility.hxx"
+#include <accessibility/standard/vclxaccessibletextfield.hxx>
+#include <vcl/lstbox.hxx>
+#include <accessibility/helper/listboxhelper.hxx>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <vcl/svapp.hxx>
+#include <vcl/combobox.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+
+
+
+
+VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) :
+
+ VCLXAccessibleTextComponent (pVCLWindow),
+
+ m_xParent( _xParent )
+
+{
+}
+
+
+
+
+VCLXAccessibleTextField::~VCLXAccessibleTextField (void)
+{
+}
+
+
+
+
+::rtl::OUString VCLXAccessibleTextField::implGetText (void)
+{
+ ::rtl::OUString aText;
+ ListBox* pListBox = static_cast<ListBox*>(GetWindow());
+ if (pListBox!=NULL && !pListBox->IsInDropDown())
+ aText = pListBox->GetSelectEntry();
+
+ return aText;
+}
+
+
+
+
+IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
+IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
+
+
+//===== XAccessible =========================================================
+
+Reference<XAccessibleContext> SAL_CALL
+ VCLXAccessibleTextField::getAccessibleContext (void)
+ throw (RuntimeException)
+{
+ return this;
+}
+
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount (void)
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+
+
+
+Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ throw IndexOutOfBoundsException();
+}
+
+
+
+
+sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole (void)
+ throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return AccessibleRole::TEXT;
+}
+
+Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent( )
+ throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return m_xParent;
+}
+
+
+
+//===== XServiceInfo ==========================================================
+
+::rtl::OUString VCLXAccessibleTextField::getImplementationName (void)
+ throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii ("com.sun.star.comp.toolkit.AccessibleTextField");
+}
+
+
+
+
+Sequence< ::rtl::OUString > VCLXAccessibleTextField::getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames = VCLXAccessibleTextComponent::getSupportedServiceNames();
+ sal_Int32 nLength = aNames.getLength();
+ aNames.realloc( nLength + 1 );
+ aNames[nLength] = ::rtl::OUString::createFromAscii(
+ "com.sun.star.accessibility.AccessibleTextField");
+ return aNames;
+}
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
new file mode 100644
index 000000000000..a11e1d52c7e3
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -0,0 +1,882 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+
+// includes --------------------------------------------------------------
+#include <accessibility/standard/vclxaccessibletoolbox.hxx>
+#include <accessibility/standard/vclxaccessibletoolboxitem.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <tools/debug.hxx>
+#include <vcl/toolbox.hxx>
+#include <comphelper/accessiblewrapper.hxx>
+#include <comphelper/processfactory.hxx>
+
+using namespace ::comphelper;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+
+namespace
+{
+ // =========================================================================
+ // = OToolBoxWindowItemContext
+ // =========================================================================
+ /** XAccessibleContext implementation for a toolbox item which is represented by a VCL Window
+ */
+ class OToolBoxWindowItemContext : public OAccessibleContextWrapper
+ {
+ sal_Int32 m_nIndexInParent;
+ public:
+ OToolBoxWindowItemContext(sal_Int32 _nIndexInParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ ) : OAccessibleContextWrapper(
+ _rxORB,
+ _rxInnerAccessibleContext,
+ _rxOwningAccessible,
+ _rxParentAccessible )
+ ,m_nIndexInParent(_nIndexInParent)
+ {
+ }
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ // -------------------------------------------------------------------------
+ sal_Int32 SAL_CALL OToolBoxWindowItemContext::getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ return m_nIndexInParent;
+ }
+
+ // =========================================================================
+ // = OToolBoxWindowItem
+ // =========================================================================
+ typedef ::cppu::ImplHelper1 < XUnoTunnel
+ > OToolBoxWindowItem_Base;
+
+ /** XAccessible implementation for a toolbox item which is represented by a VCL Window
+ */
+ class OToolBoxWindowItem
+ :public OAccessibleWrapper
+ ,public OToolBoxWindowItem_Base
+ {
+ private:
+ sal_Int32 m_nIndexInParent;
+
+ public:
+ inline sal_Int32 getIndexInParent() const { return m_nIndexInParent; }
+ inline void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; }
+
+ static sal_Bool isWindowItem( const Reference< XAccessible >& _rxAcc, OToolBoxWindowItem** /* [out] */ _ppImplementation = NULL );
+
+ public:
+ OToolBoxWindowItem(sal_Int32 _nIndexInParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxInnerAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ ) : OAccessibleWrapper(
+ _rxORB,
+ _rxInnerAccessible,
+ _rxParentAccessible)
+ ,m_nIndexInParent(_nIndexInParent)
+ {
+ }
+
+ protected:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // OAccessibleWrapper
+ virtual OAccessibleContextWrapper* createAccessibleContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerContext
+ );
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw (RuntimeException);
+ static Sequence< sal_Int8 > getUnoTunnelImplementationId();
+ };
+
+ // -------------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2( OToolBoxWindowItem, OAccessibleWrapper, OToolBoxWindowItem_Base )
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( OToolBoxWindowItem, OAccessibleWrapper, OToolBoxWindowItem_Base )
+
+ // -------------------------------------------------------------------------
+ OAccessibleContextWrapper* OToolBoxWindowItem::createAccessibleContext(
+ const Reference< XAccessibleContext >& _rxInnerContext )
+ {
+ return new OToolBoxWindowItemContext( m_nIndexInParent,getORB(), _rxInnerContext, this, getParent() );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool OToolBoxWindowItem::isWindowItem( const Reference< XAccessible >& _rxAcc, OToolBoxWindowItem** /* [out] */ _ppImplementation )
+ {
+ OToolBoxWindowItem* pImplementation = NULL;
+
+ Reference< XUnoTunnel > xTunnel( _rxAcc, UNO_QUERY );
+ if ( xTunnel.is() )
+ pImplementation = reinterpret_cast< OToolBoxWindowItem* >( xTunnel->getSomething( getUnoTunnelImplementationId() ) );
+
+ if ( _ppImplementation )
+ *_ppImplementation = pImplementation;
+
+ return NULL != pImplementation;
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< sal_Int8 > OToolBoxWindowItem::getUnoTunnelImplementationId()
+ {
+ static ::cppu::OImplementationId * pId = 0;
+ if (! pId)
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if (! pId)
+ {
+ static ::cppu::OImplementationId aId;
+ pId = &aId;
+ }
+ }
+ return pId->getImplementationId();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int64 SAL_CALL OToolBoxWindowItem::getSomething( const Sequence< sal_Int8 >& _rId ) throw (RuntimeException)
+ {
+ if ( ( 16 == _rId.getLength() )
+ && ( 0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rId.getConstArray(), 16 ) )
+ )
+ return reinterpret_cast< sal_Int64>( this );
+
+ return 0;
+ }
+}
+
+DBG_NAME(VCLXAccessibleToolBox)
+
+// -----------------------------------------------------------------------------
+// VCLXAccessibleToolBox
+// -----------------------------------------------------------------------------
+VCLXAccessibleToolBox::VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow ) :
+
+ VCLXAccessibleComponent( pVCLXWindow )
+
+{
+ DBG_CTOR(VCLXAccessibleToolBox,NULL);
+}
+// -----------------------------------------------------------------------------
+VCLXAccessibleToolBox::~VCLXAccessibleToolBox()
+{
+ DBG_DTOR(VCLXAccessibleToolBox,NULL);
+}
+// -----------------------------------------------------------------------------
+VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( sal_Int32 _nPos, bool _bMustHaveFocus )
+{
+ VCLXAccessibleToolBoxItem* pItem = NULL;
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox && ( !_bMustHaveFocus || pToolBox->HasFocus() ) )
+ {
+ ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
+ // returns only toolbox buttons, not windows
+ if ( aIter != m_aAccessibleChildren.end() && !aIter->second.is())
+ pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ }
+
+ return pItem;
+}
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleToolBox::UpdateFocus_Impl()
+{
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if( !pToolBox )
+ return;
+
+ // submit events only if toolbox has the focus to avoid sending events due to mouse move
+ sal_Bool bHasFocus = sal_False;
+ if ( pToolBox->HasFocus() )
+ bHasFocus = sal_True;
+ else
+ {
+ // check for subtoolbar, i.e. check if our parent is a toolbar
+ ToolBox* pToolBoxParent = dynamic_cast< ToolBox* >( pToolBox->GetParent() );
+ // subtoolbars never get the focus as key input is just forwarded, so check if the parent toolbar has it
+ if ( pToolBoxParent && pToolBoxParent->HasFocus() )
+ bHasFocus = sal_True;
+ }
+
+ if ( bHasFocus )
+ {
+ sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
+ sal_uInt16 nFocusCount = 0;
+ for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
+ aIter != m_aAccessibleChildren.end(); ++aIter )
+ {
+ sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first );
+
+ if ( aIter->second.is() )
+ {
+ VCLXAccessibleToolBoxItem* pItem =
+ static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ if ( pItem->HasFocus() && nItemId != nHighlightItemId )
+ {
+ // reset the old focused item
+ pItem->SetFocus( sal_False );
+ nFocusCount++;
+ }
+ if ( nItemId == nHighlightItemId )
+ {
+ // set the new focused item
+ pItem->SetFocus( sal_True );
+ nFocusCount++;
+ }
+ }
+ // both items changed?
+ if ( nFocusCount > 1 )
+ break;
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::ReleaseFocus_Impl( sal_Int32 _nPos )
+{
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox ) // #107124#, do not check for focus because this message is also handled in losefocus
+ {
+ ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
+ if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() )
+ {
+ VCLXAccessibleToolBoxItem* pItem =
+ static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ if ( pItem->HasFocus() )
+ pItem->SetFocus( sal_False );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::UpdateChecked_Impl( sal_Int32 )
+{
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
+ aIter != m_aAccessibleChildren.end(); ++aIter )
+ {
+ sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)aIter->first );
+
+ VCLXAccessibleToolBoxItem* pItem =
+ static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( sal_Int32 _nPos )
+{
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)_nPos );
+
+ ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
+ if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() )
+ {
+ VCLXAccessibleToolBoxItem* pItem =
+ static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ if ( pItem )
+ pItem->SetIndeterminate( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::implReleaseToolboxItem( ToolBoxItemsMap::iterator& _rMapPos,
+ bool _bNotifyRemoval, bool _bDispose )
+{
+ Reference< XAccessible > xItemAcc( _rMapPos->second );
+ if ( !xItemAcc.is() )
+ return;
+
+ if ( _bNotifyRemoval )
+ {
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, makeAny( xItemAcc ), Any() );
+ }
+
+ OToolBoxWindowItem* pWindowItem = NULL;
+ if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) )
+ {
+ static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() )->ReleaseToolBox();
+ if ( _bDispose )
+ ::comphelper::disposeComponent( xItemAcc );
+ }
+ else
+ {
+ if ( _bDispose )
+ {
+ if ( pWindowItem )
+ {
+ Reference< XAccessibleContext > xContext( pWindowItem->getContextNoCreate() );
+ ::comphelper::disposeComponent( xContext );
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::UpdateItem_Impl( sal_Int32 _nPos, sal_Bool _bItemAdded )
+{
+ if ( _nPos < sal_Int32( m_aAccessibleChildren.size() ) )
+ {
+ UpdateAllItems_Impl();
+ return;
+ }
+
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ if ( !_bItemAdded )
+ { // the item was removed
+ // -> destroy the old item
+ ToolBoxItemsMap::iterator aItemPos = m_aAccessibleChildren.find( _nPos );
+ if ( m_aAccessibleChildren.end() != aItemPos )
+ {
+ implReleaseToolboxItem( aItemPos, true, true );
+ m_aAccessibleChildren.erase( aItemPos );
+ }
+ }
+
+ // adjust the "index-in-parent"s
+ ToolBoxItemsMap::iterator aIndexAdjust = m_aAccessibleChildren.upper_bound( _nPos );
+ while ( m_aAccessibleChildren.end() != aIndexAdjust )
+ {
+ Reference< XAccessible > xItemAcc( aIndexAdjust->second );
+
+ OToolBoxWindowItem* pWindowItem = NULL;
+ if ( !OToolBoxWindowItem::isWindowItem( xItemAcc, &pWindowItem ) )
+ {
+ VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() );
+ if ( pItem )
+ {
+ sal_Int32 nIndex = pItem->getIndexInParent( );
+ nIndex += _bItemAdded ? +1 : -1;
+ pItem->setIndexInParent( nIndex );
+ }
+ }
+ else
+ {
+ if ( pWindowItem )
+ {
+ sal_Int32 nIndex = pWindowItem->getIndexInParent( );
+ nIndex += _bItemAdded ? +1 : -1;
+ pWindowItem->setIndexInParent( nIndex );
+ }
+ }
+
+ ++aIndexAdjust;
+ }
+
+ if ( _bItemAdded )
+ {
+ // TODO: we should make this dependent on the existence of event listeners
+ // with the current implementation, we always create accessible object
+ Any aNewChild = makeAny( getAccessibleChild( (sal_Int32)_nPos ) );
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewChild );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::UpdateAllItems_Impl()
+{
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ // deregister the old items
+ for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
+ aIter != m_aAccessibleChildren.end(); ++aIter )
+ {
+ implReleaseToolboxItem( aIter, true, true );
+ }
+ m_aAccessibleChildren.clear();
+
+ // register the new items
+ sal_uInt16 i, nCount = pToolBox->GetItemCount();
+ for ( i = 0; i < nCount; ++i )
+ {
+ Any aNewValue;
+ aNewValue <<= getAccessibleChild( (sal_Int32)i );;
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewValue );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( Window* pWindow, bool bOpen )
+{
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if( pWindow && pToolBox )
+ {
+ Reference< XAccessible > xChild( pWindow->GetAccessible() );
+ if( xChild.is() )
+ {
+ Reference< XAccessible > xChildItem( getAccessibleChild( static_cast< sal_Int32 >( pToolBox->GetItemPos( pToolBox->GetDownItemId() ) ) ) );
+ VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xChildItem.get() );
+
+ pItem->SetChild( xChild );
+ pItem->NotifyChildEvent( xChild, bOpen );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::UpdateItemName_Impl( sal_Int32 _nPos )
+{
+ VCLXAccessibleToolBoxItem* pItem = GetItem_Impl( _nPos, false );
+ if ( pItem )
+ pItem->NameChanged();
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::UpdateItemEnabled_Impl( sal_Int32 _nPos )
+{
+ VCLXAccessibleToolBoxItem* pItem = GetItem_Impl( _nPos, false );
+ if ( pItem )
+ pItem->ToggleEnableState();
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent, bool _bShow )
+{
+ Window* pChildWindow = (Window *) rVclWindowEvent.GetData();
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pChildWindow
+ && pToolBox
+ && pToolBox == pChildWindow->GetParent()
+ && pChildWindow->GetType() == WINDOW_TOOLBOX )
+ {
+ sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() );
+ Reference< XAccessible > xItem = getAccessibleChild( nIndex );
+ if ( xItem.is() )
+ {
+ Reference< XAccessible > xChild = pChildWindow->GetAccessible();
+ VCLXAccessibleToolBoxItem* pItem =
+ static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() );
+ pItem->SetChild( xChild );
+ pItem->NotifyChildEvent( xChild, _bShow );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::ReleaseSubToolBox( ToolBox* _pSubToolBox )
+{
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ sal_Int32 nIndex = pToolBox->GetItemPos( pToolBox->GetCurItemId() );
+ Reference< XAccessible > xItem = getAccessibleChild( nIndex );
+ if ( xItem.is() )
+ {
+ Reference< XAccessible > xChild = _pSubToolBox->GetAccessible();
+ VCLXAccessibleToolBoxItem* pItem =
+ static_cast< VCLXAccessibleToolBoxItem* >( xItem.get() );
+ if ( pItem->GetChild() == xChild )
+ {
+ pItem->SetChild( Reference< XAccessible >() );
+ pItem->NotifyChildEvent( xChild, false );
+ }
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ if ( pToolBox->IsHorizontal() )
+ rStateSet.AddState( AccessibleStateType::HORIZONTAL );
+ else
+ rStateSet.AddState( AccessibleStateType::VERTICAL );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ // to prevent an early release of the toolbox (VCLEVENT_OBJECT_DYING)
+ Reference< XAccessibleContext > xTemp = this;
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TOOLBOX_CLICK:
+ {
+ if ( rVclWindowEvent.GetData() )
+ {
+ UpdateChecked_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
+ UpdateIndeterminate_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
+ }
+ break;
+ }
+ case VCLEVENT_TOOLBOX_DOUBLECLICK:
+ case VCLEVENT_TOOLBOX_ACTIVATE:
+ case VCLEVENT_TOOLBOX_DEACTIVATE:
+ case VCLEVENT_TOOLBOX_SELECT:
+ break;
+
+ case VCLEVENT_TOOLBOX_HIGHLIGHT:
+ UpdateFocus_Impl();
+ break;
+
+ case VCLEVENT_TOOLBOX_HIGHLIGHTOFF:
+ ReleaseFocus_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
+ break;
+
+ case VCLEVENT_TOOLBOX_ITEMADDED :
+// UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), VCLEVENT_TOOLBOX_ITEMADDED == rVclWindowEvent.GetId() );
+ UpdateItem_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData(), sal_True );
+ break;
+
+ case VCLEVENT_TOOLBOX_ITEMREMOVED :
+ case VCLEVENT_TOOLBOX_ALLITEMSCHANGED :
+ {
+ UpdateAllItems_Impl();
+ break;
+ }
+
+ case VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED:
+ {
+ sal_Int32 nPos = (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData();
+ ToolBoxItemsMap::iterator aAccessiblePos( m_aAccessibleChildren.find( nPos ) );
+ if ( m_aAccessibleChildren.end() != aAccessiblePos )
+ {
+ implReleaseToolboxItem( aAccessiblePos, false, true );
+ m_aAccessibleChildren.erase (aAccessiblePos);
+ }
+
+ Any aNewValue;
+ aNewValue <<= getAccessibleChild(nPos);
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewValue );
+ break;
+ }
+ case VCLEVENT_TOOLBOX_ITEMTEXTCHANGED :
+ UpdateItemName_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
+ break;
+
+ case VCLEVENT_TOOLBOX_ITEMENABLED :
+ case VCLEVENT_TOOLBOX_ITEMDISABLED :
+ {
+ UpdateItemEnabled_Impl( (sal_Int32)(sal_IntPtr)rVclWindowEvent.GetData() );
+ break;
+ }
+
+ case VCLEVENT_DROPDOWN_OPEN:
+ case VCLEVENT_DROPDOWN_CLOSE:
+ {
+ UpdateCustomPopupItemp_Impl( static_cast< Window* >( rVclWindowEvent.GetData() ), rVclWindowEvent.GetId() == VCLEVENT_DROPDOWN_OPEN );
+ break;
+ }
+
+ case VCLEVENT_OBJECT_DYING :
+ {
+ // if this toolbox is a subtoolbox, we have to relese it from its parent
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox && pToolBox->GetParent() &&
+ pToolBox->GetParent()->GetType() == WINDOW_TOOLBOX )
+ {
+ VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >(
+ pToolBox->GetParent()->GetAccessible()->getAccessibleContext().get() );
+ if ( pParent )
+ pParent->ReleaseSubToolBox( pToolBox );
+ }
+
+ // dispose all items
+ for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
+ aIter != m_aAccessibleChildren.end(); ++aIter )
+ {
+ implReleaseToolboxItem( aIter, false, true );
+ }
+ m_aAccessibleChildren.clear();
+
+ //!!! no break to call base class
+ }
+
+ default:
+ VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children
+ {
+ Reference< XAccessible > xReturn = GetItemWindowAccessible(rVclWindowEvent);
+ if ( xReturn.is() )
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), makeAny(xReturn) );
+ else
+ HandleSubToolBarEvent( rVclWindowEvent, true );
+ }
+ break;
+
+ default:
+ VCLXAccessibleComponent::ProcessWindowChildEvent( rVclWindowEvent );
+
+ }
+}
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleToolBox, VCLXAccessibleComponent, VCLXAccessibleToolBox_BASE )
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleToolBox, VCLXAccessibleComponent, VCLXAccessibleToolBox_BASE )
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleToolBox::disposing()
+{
+ VCLXAccessibleComponent::disposing();
+
+ // release the items
+ for ( ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.begin();
+ aIter != m_aAccessibleChildren.end(); ++aIter )
+ {
+ implReleaseToolboxItem( aIter, false, true );
+ }
+ m_aAccessibleChildren.clear();
+}
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+::rtl::OUString VCLXAccessibleToolBox::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleToolBox" );
+}
+// -----------------------------------------------------------------------------
+Sequence< ::rtl::OUString > VCLXAccessibleToolBox::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames = VCLXAccessibleComponent::getSupportedServiceNames();
+ sal_Int32 nLength = aNames.getLength();
+ aNames.realloc( nLength + 1 );
+ aNames[nLength] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleToolBox" );
+ return aNames;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleToolBox::getAccessibleChildCount( ) throw (RuntimeException)
+{
+ comphelper::OExternalLockGuard aGuard( this );
+
+ sal_Int32 nCount = 0;
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ nCount = pToolBox->GetItemCount();
+
+ return nCount;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if ( i < 0 || i >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+
+ comphelper::OExternalLockGuard aGuard( this );
+
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ Reference< XAccessible > xChild;
+ // search for the child
+ ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find(i);
+ if ( m_aAccessibleChildren.end() == aIter )
+ {
+ sal_uInt16 nItemId = pToolBox->GetItemId( (sal_uInt16)i );
+ sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
+ Window* pItemWindow = pToolBox->GetItemWindow( nItemId );
+ // not found -> create a new child
+ VCLXAccessibleToolBoxItem* pChild = new VCLXAccessibleToolBoxItem( pToolBox, i );
+ Reference< XAccessible> xParent = pChild;
+ if ( pItemWindow )
+ {
+ xChild = new OToolBoxWindowItem(0,::comphelper::getProcessServiceFactory(),pItemWindow->GetAccessible(),xParent);
+ pItemWindow->SetAccessible(xChild);
+ pChild->SetChild( xChild );
+ }
+ xChild = pChild;
+ if ( nHighlightItemId > 0 && nItemId == nHighlightItemId )
+ pChild->SetFocus( sal_True );
+ if ( pToolBox->IsItemChecked( nItemId ) )
+ pChild->SetChecked( sal_True );
+ if ( pToolBox->GetItemState( nItemId ) == STATE_DONTKNOW )
+ pChild->SetIndeterminate( true );
+ m_aAccessibleChildren.insert( ToolBoxItemsMap::value_type( i, xChild ) );
+ }
+ else
+ {
+ // found it
+ xChild = aIter->second;
+ }
+ return xChild;
+ }
+
+ return NULL;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleAtPoint( const awt::Point& _rPoint ) throw (RuntimeException)
+{
+ comphelper::OExternalLockGuard aGuard( this );
+
+ Reference< XAccessible > xAccessible;
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pToolBox )
+ {
+ sal_uInt16 nItemPos = pToolBox->GetItemPos( VCLPoint( _rPoint ) );
+ if ( nItemPos != TOOLBOX_ITEM_NOTFOUND )
+ xAccessible = getAccessibleChild( nItemPos );
+ }
+
+ return xAccessible;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent )
+{
+ Reference< XAccessible > xReturn;
+ Window* pChildWindow = (Window *) rVclWindowEvent.GetData();
+ ToolBox* pToolBox = static_cast< ToolBox* >( GetWindow() );
+ if ( pChildWindow && pToolBox )
+ {
+ sal_uInt16 nCount = pToolBox->GetItemCount();
+ for (sal_uInt16 i = 0 ; i < nCount && !xReturn.is() ; ++i)
+ {
+ sal_uInt16 nItemId = pToolBox->GetItemId( i );
+ Window* pItemWindow = pToolBox->GetItemWindow( nItemId );
+ if ( pItemWindow == pChildWindow )
+ xReturn = getAccessibleChild(i);
+ }
+ }
+ return xReturn;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > VCLXAccessibleToolBox::GetChildAccessible( const VclWindowEvent& rVclWindowEvent )
+{
+ Reference< XAccessible > xReturn = GetItemWindowAccessible(rVclWindowEvent);
+
+ if ( !xReturn.is() )
+ xReturn = VCLXAccessibleComponent::GetChildAccessible(rVclWindowEvent);
+ return xReturn;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleSelection
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+ ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
+ sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex);
+ pToolBox->ChangeHighlight( nPos );
+}
+// -----------------------------------------------------------------------------
+sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+ ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
+ sal_uInt16 nPos = static_cast < sal_uInt16 > (nChildIndex);
+ if ( pToolBox != NULL && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) )
+ return sal_True;
+ else
+ return sal_False;
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::clearAccessibleSelection( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() );
+ pToolBox -> LoseFocus();
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::selectAllAccessibleChildren( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ // intentionally empty. makes no sense for a toolbox
+}
+// -----------------------------------------------------------------------------
+sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ sal_Int32 nRet = 0;
+ for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; i++ )
+ {
+ if ( isAccessibleChildSelected( i ) )
+ {
+ nRet = 1;
+ break; // a toolbox can only have (n)one selected child
+ }
+ }
+ return nRet;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+ Reference< XAccessible > xChild;
+ for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ )
+ {
+ if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
+ {
+ xChild = getAccessibleChild( i );
+ break;
+ }
+ }
+ return xChild;
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBox::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+ if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() )
+ throw IndexOutOfBoundsException();
+ clearAccessibleSelection(); // a toolbox can only have (n)one selected child
+}
+// -----------------------------------------------------------------------------
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
new file mode 100644
index 000000000000..d4ad29a27bef
--- /dev/null
+++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -0,0 +1,718 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_accessibility.hxx"
+#include <accessibility/standard/vclxaccessibletoolboxitem.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <accessibility/helper/accresmgr.hxx>
+#include <accessibility/helper/accessiblestrings.hrc>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
+#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
+#include <tools/debug.hxx>
+#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>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+
+// class VCLXAccessibleToolBoxItem ------------------------------------------
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+DBG_NAME(VCLXAccessibleToolBoxItem)
+
+// -----------------------------------------------------------------------------
+// Ctor() and Dtor()
+// -----------------------------------------------------------------------------
+VCLXAccessibleToolBoxItem::VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos ) :
+
+ AccessibleTextHelper_BASE( new VCLExternalSolarLock() ),
+
+ m_pToolBox ( _pToolBox ),
+ m_nIndexInParent( _nPos ),
+ m_nRole ( AccessibleRole::PUSH_BUTTON ),
+ m_nItemId ( 0 ),
+ m_bHasFocus ( sal_False ),
+ m_bIsChecked ( sal_False ),
+ m_bIndeterminate( false )
+
+{
+ DBG_CTOR( VCLXAccessibleToolBoxItem, NULL );
+
+ m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock( ) );
+
+ DBG_ASSERT( m_pToolBox, "invalid toolbox" );
+ m_nItemId = m_pToolBox->GetItemId( (sal_uInt16)m_nIndexInParent );
+ m_sOldName = GetText( true );
+ m_bIsChecked = m_pToolBox->IsItemChecked( m_nItemId );
+ m_bIndeterminate = ( m_pToolBox->GetItemState( m_nItemId ) == STATE_DONTKNOW );
+ ToolBoxItemType eType = m_pToolBox->GetItemType( (sal_uInt16)m_nIndexInParent );
+ switch ( eType )
+ {
+ case TOOLBOXITEM_BUTTON :
+ {
+ ToolBoxItemBits nBits = m_pToolBox->GetItemBits( m_nItemId );
+ if (( nBits & TIB_DROPDOWN ) == TIB_DROPDOWN)
+ m_nRole = AccessibleRole::BUTTON_DROPDOWN;
+ else if (( ( nBits & TIB_CHECKABLE ) == TIB_CHECKABLE ) ||
+ ( ( nBits & TIB_AUTOCHECK ) == TIB_AUTOCHECK ) )
+ m_nRole = AccessibleRole::TOGGLE_BUTTON;
+ else if ( m_pToolBox->GetItemWindow( m_nItemId ) )
+ m_nRole = AccessibleRole::PANEL;
+ break;
+ }
+
+ case TOOLBOXITEM_SPACE :
+ m_nRole = AccessibleRole::FILLER;
+ break;
+
+ case TOOLBOXITEM_SEPARATOR :
+ case TOOLBOXITEM_BREAK :
+ m_nRole = AccessibleRole::SEPARATOR;
+ break;
+
+ default:
+ {
+ DBG_ERRORFILE( "unsupported toolbox itemtype" );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+VCLXAccessibleToolBoxItem::~VCLXAccessibleToolBoxItem()
+{
+ DBG_DTOR( VCLXAccessibleToolBoxItem, NULL );
+
+ delete m_pExternalLock;
+ m_pExternalLock = NULL;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString VCLXAccessibleToolBoxItem::GetText( bool _bAsName )
+{
+ ::rtl::OUString sRet;
+ // no text for separators and spaces
+ if ( m_pToolBox && m_nItemId > 0 && ( _bAsName || m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) )
+ {
+ sRet = m_pToolBox->GetItemText( m_nItemId );
+//OJ #108243# we only read the name of the toolboxitem
+//
+// Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId );
+// if ( pItemWindow && pItemWindow->GetAccessible().is() &&
+// pItemWindow->GetAccessible()->getAccessibleContext().is() )
+// {
+// ::rtl::OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
+// if ( ( sRet.getLength() > 0 ) && ( sWinText.getLength() > 0 ) )
+// sRet += String( RTL_CONSTASCII_USTRINGPARAM( " " ) );
+// sRet += sWinText;
+// }
+ }
+ return sRet;
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::SetFocus( sal_Bool _bFocus )
+{
+ if ( m_bHasFocus != _bFocus )
+ {
+ Any aOldValue;
+ Any aNewValue;
+ if ( m_bHasFocus )
+ aOldValue <<= AccessibleStateType::FOCUSED;
+ else
+ aNewValue <<= AccessibleStateType::FOCUSED;
+ m_bHasFocus = _bFocus;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::SetChecked( sal_Bool _bCheck )
+{
+ if ( m_bIsChecked != _bCheck )
+ {
+ Any aOldValue;
+ Any aNewValue;
+ if ( m_bIsChecked )
+ aOldValue <<= AccessibleStateType::CHECKED;
+ else
+ aNewValue <<= AccessibleStateType::CHECKED;
+ m_bIsChecked = _bCheck;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::SetIndeterminate( bool _bIndeterminate )
+{
+ if ( m_bIndeterminate != _bIndeterminate )
+ {
+ Any aOldValue, aNewValue;
+ if ( m_bIndeterminate )
+ aOldValue <<= AccessibleStateType::INDETERMINATE;
+ else
+ aNewValue <<= AccessibleStateType::INDETERMINATE;
+ m_bIndeterminate = _bIndeterminate;
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::NameChanged()
+{
+ ::rtl::OUString sNewName = implGetText();
+ if ( sNewName != m_sOldName )
+ {
+ Any aOldValue, aNewValue;
+ aOldValue <<= m_sOldName;
+ // save new name as old name for next change
+ m_sOldName = sNewName;
+ aNewValue <<= m_sOldName;
+ NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
+ }
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::SetChild( const Reference< XAccessible >& _xChild )
+{
+ m_xChild = _xChild;
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::NotifyChildEvent( const Reference< XAccessible >& _xChild, bool _bShow )
+{
+ Any aOld = _bShow ? Any() : makeAny( _xChild );
+ Any aNew = _bShow ? makeAny( _xChild ) : Any();
+ NotifyAccessibleEvent( AccessibleEventId::CHILD, aOld, aNew );
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::ToggleEnableState()
+{
+ Any aOldValue[2], aNewValue[2];
+ if ( m_pToolBox->IsItemEnabled( m_nItemId ) )
+ {
+ aNewValue[0] <<= AccessibleStateType::SENSITIVE;
+ aNewValue[1] <<= AccessibleStateType::ENABLED;
+ }
+ else
+ {
+ aOldValue[0] <<= AccessibleStateType::ENABLED;
+ aOldValue[1] <<= AccessibleStateType::SENSITIVE;
+ }
+
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] );
+ NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] );
+}
+// -----------------------------------------------------------------------------
+awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::implGetBounds( ) throw (RuntimeException)
+{
+ awt::Rectangle aRect;
+ if ( m_pToolBox )
+ aRect = AWTRectangle( m_pToolBox->GetItemPosRect( (sal_uInt16)m_nIndexInParent ) );
+
+ return aRect;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString VCLXAccessibleToolBoxItem::implGetText()
+{
+ return GetText (true);
+}
+// -----------------------------------------------------------------------------
+Locale VCLXAccessibleToolBoxItem::implGetLocale()
+{
+ return Application::GetSettings().GetUILocale();
+}
+// -----------------------------------------------------------------------------
+void VCLXAccessibleToolBoxItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
+{
+ nStartIndex = 0;
+ nEndIndex = 0;
+}
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_REFCOUNT( VCLXAccessibleToolBoxItem, AccessibleTextHelper_BASE )
+Any SAL_CALL VCLXAccessibleToolBoxItem::queryInterface( const Type& _rType ) throw (RuntimeException)
+{
+ // --> PB 2004-09-03 #i33611# - toolbox buttons without text don't support XAccessibleText
+ if ( _rType == ::getCppuType( ( const Reference< XAccessibleText >* ) 0 )
+ && ( !m_pToolBox || m_pToolBox->GetButtonType() == BUTTON_SYMBOL ) )
+ return Any();
+ // <--
+
+ ::com::sun::star::uno::Any aReturn = AccessibleTextHelper_BASE::queryInterface( _rType );
+ if ( !aReturn.hasValue() )
+ aReturn = VCLXAccessibleToolBoxItem_BASE::queryInterface( _rType );
+ return aReturn;
+}
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleToolBoxItem, AccessibleTextHelper_BASE, VCLXAccessibleToolBoxItem_BASE )
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleToolBoxItem::disposing()
+{
+ AccessibleTextHelper_BASE::disposing();
+ m_pToolBox = NULL;
+}
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+::rtl::OUString VCLXAccessibleToolBoxItem::getImplementationName() throw (RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleToolBoxItem" );
+}
+// -----------------------------------------------------------------------------
+sal_Bool VCLXAccessibleToolBoxItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+ for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+ ;
+
+ return pNames != pEnd;
+}
+// -----------------------------------------------------------------------------
+Sequence< ::rtl::OUString > VCLXAccessibleToolBoxItem::getSupportedServiceNames() throw (RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames(4);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleContext" );
+ aNames[1] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleComponent" );
+ aNames[2] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleExtendedComponent" );
+ aNames[3] = ::rtl::OUString::createFromAscii( "com.sun.star.accessibility.AccessibleToolBoxItem" );
+ return aNames;
+}
+// -----------------------------------------------------------------------------
+// XAccessible
+// -----------------------------------------------------------------------------
+Reference< XAccessibleContext > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleContext( ) throw (RuntimeException)
+{
+ return this;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChildCount( ) throw (RuntimeException)
+{
+ OContextEntryGuard aGuard( this );
+
+ return m_xChild.is() ? 1 : 0;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChild( sal_Int32 i ) throw (RuntimeException, com::sun::star::lang::IndexOutOfBoundsException)
+{
+ OContextEntryGuard aGuard( this );
+
+ // no child -> so index is out of bounds
+ if ( !m_xChild.is() || i != 0 )
+ throw IndexOutOfBoundsException();
+
+ return m_xChild;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleParent( ) throw (RuntimeException)
+{
+ OContextEntryGuard aGuard( this );
+
+ return m_pToolBox->GetAccessible();
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleIndexInParent( ) throw (RuntimeException)
+{
+ OContextEntryGuard aGuard( this );
+
+ return m_nIndexInParent;
+}
+// -----------------------------------------------------------------------------
+sal_Int16 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRole( ) throw (RuntimeException)
+{
+ OContextEntryGuard aGuard( this );
+
+ return m_nRole;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sDescription;
+ if ( m_pToolBox )
+ sDescription = m_pToolBox->GetHelpText( m_nItemId );
+
+ return sDescription;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleName( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ // entry text == accessible name
+ return GetText( true );
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRelationSet( ) throw (RuntimeException)
+{
+ OContextEntryGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+ return xSet;
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleStateSet( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+
+ if ( m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ if ( m_bIsChecked )
+ pStateSetHelper->AddState( AccessibleStateType::CHECKED );
+ if ( m_bIndeterminate )
+ pStateSetHelper->AddState( AccessibleStateType::INDETERMINATE );
+ if ( m_pToolBox->IsItemEnabled( m_nItemId ) )
+ {
+ pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ }
+ if ( m_pToolBox->IsItemVisible( m_nItemId ) )
+ pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ if ( m_pToolBox->IsItemReallyVisible( m_nItemId ) )
+ pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ if ( m_bHasFocus )
+ pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
+ }
+ else
+ pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+ return xStateSet;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleText
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getCaretPosition() throw (RuntimeException)
+{
+ return -1;
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setCaretPosition( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+// -----------------------------------------------------------------------------
+Sequence< PropertyValue > SAL_CALL VCLXAccessibleToolBoxItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< ::rtl::OUString >& ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return Sequence< PropertyValue >();
+}
+// -----------------------------------------------------------------------------
+awt::Rectangle SAL_CALL VCLXAccessibleToolBoxItem::getCharacterBounds( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sText( implGetText() );
+
+ if ( !implIsValidIndex( nIndex, sText.getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds
+ {
+ Rectangle aCharRect = m_pToolBox->GetCharacterBounds( m_nItemId, nIndex );
+ Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId );
+ aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
+ aBounds = AWTRectangle( aCharRect );
+ }
+
+ return aBounds;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getIndexAtPoint( const awt::Point& aPoint ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndex = -1;
+ if ( m_pToolBox && m_pToolBox->GetButtonType() != BUTTON_SYMBOL ) // symbol buttons have no character bounds
+ {
+ sal_uInt16 nItemId = 0;
+ Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId );
+ Point aPnt( VCLPoint( aPoint ) );
+ aPnt += aItemRect.TopLeft();
+ sal_Int32 nIdx = m_pToolBox->GetIndexForPoint( aPnt, nItemId );
+ if ( nIdx != -1 && nItemId == m_nItemId )
+ nIndex = nIdx;
+ }
+
+ return nIndex;
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ return sal_False;
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) )
+ throw IndexOutOfBoundsException();
+
+ sal_Bool bReturn = sal_False;
+
+ if ( m_pToolBox )
+ {
+ Reference< datatransfer::clipboard::XClipboard > xClipboard = m_pToolBox->GetClipboard();
+ if ( xClipboard.is() )
+ {
+ ::rtl::OUString sText( getTextRange( nStartIndex, nEndIndex ) );
+
+ ::vcl::unohelper::TextDataObject* pDataObj = new ::vcl::unohelper::TextDataObject( sText );
+ const sal_uInt32 nRef = Application::ReleaseSolarMutex();
+ xClipboard->setContents( pDataObj, NULL );
+
+ Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
+ if( xFlushableClipboard.is() )
+ xFlushableClipboard->flushClipboard();
+
+ Application::AcquireSolarMutex( nRef );
+
+ bReturn = sal_True;
+ }
+ }
+
+ return bReturn;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+{
+ return Reference< XAccessible >();
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL VCLXAccessibleToolBoxItem::grabFocus( ) throw (RuntimeException)
+{
+ Reference< XAccessible > xParent(getAccessibleParent());
+
+ if( xParent.is() )
+ {
+ Reference< XAccessibleSelection > rxAccessibleSelection(xParent->getAccessibleContext(), UNO_QUERY);
+
+ if ( rxAccessibleSelection.is() )
+ {
+ rxAccessibleSelection -> selectAccessibleChild ( getAccessibleIndexInParent() );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getForeground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ if ( m_pToolBox )
+ nColor = m_pToolBox->GetControlForeground().GetColor();
+
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getBackground( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ if ( m_pToolBox )
+ nColor = m_pToolBox->GetControlBackground().GetColor();
+
+ return nColor;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+Reference< awt::XFont > SAL_CALL VCLXAccessibleToolBoxItem::getFont( ) throw (RuntimeException)
+{
+ return uno::Reference< awt::XFont >();
+}
+// -----------------------------------------------------------------------------
+awt::FontDescriptor SAL_CALL VCLXAccessibleToolBoxItem::getFontMetrics( const Reference< awt::XFont >& xFont ) throw (RuntimeException)
+{
+ return xFont->getFontDescriptor();
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getTitledBorderText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sRet;
+ if ( m_pToolBox )
+ sRet = m_pToolBox->GetItemText( m_nItemId );
+
+ return sRet;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString SAL_CALL VCLXAccessibleToolBoxItem::getToolTipText( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sRet;
+ if ( m_pToolBox )
+ {
+ if ( Help::IsExtHelpEnabled() )
+ sRet = m_pToolBox->GetHelpText( m_nItemId );
+ else
+ sRet = m_pToolBox->GetQuickHelpText( m_nItemId );
+ if ( !sRet.getLength() )
+ // no help text set, so use item text
+ sRet = m_pToolBox->GetItemText( m_nItemId );
+ }
+ return sRet;
+}
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+sal_Int32 VCLXAccessibleToolBoxItem::getAccessibleActionCount( ) throw (RuntimeException)
+{
+ // only one action -> "Click"
+ return 1;
+}
+// -----------------------------------------------------------------------------
+sal_Bool VCLXAccessibleToolBoxItem::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ if ( m_pToolBox )
+ m_pToolBox->TriggerItem( m_nItemId );
+
+ return sal_True;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString VCLXAccessibleToolBoxItem::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return ::rtl::OUString( TK_RES_STRING( RID_STR_ACC_ACTION_CLICK ) );
+}
+// -----------------------------------------------------------------------------
+Reference< XAccessibleKeyBinding > VCLXAccessibleToolBoxItem::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ OContextEntryGuard aGuard( this );
+
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw IndexOutOfBoundsException();
+
+ return Reference< XAccessibleKeyBinding >();
+}
+// -----------------------------------------------------------------------------
+// XAccessibleValue
+// -----------------------------------------------------------------------------
+Any VCLXAccessibleToolBoxItem::getCurrentValue( ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ if ( m_pToolBox )
+ aValue <<= (sal_Int32)m_pToolBox->IsItemChecked( m_nItemId );
+
+ return aValue;
+}
+// -----------------------------------------------------------------------------
+sal_Bool VCLXAccessibleToolBoxItem::setCurrentValue( const Any& aNumber ) throw (RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Bool bReturn = sal_False;
+
+ if ( m_pToolBox )
+ {
+ sal_Int32 nValue = 0;
+ OSL_VERIFY( aNumber >>= nValue );
+
+ if ( nValue < 0 )
+ nValue = 0;
+ else if ( nValue > 1 )
+ nValue = 1;
+
+ m_pToolBox->CheckItem( m_nItemId, (sal_Bool) nValue );
+ bReturn = sal_True;
+ }
+
+ return bReturn;
+}
+// -----------------------------------------------------------------------------
+Any VCLXAccessibleToolBoxItem::getMaximumValue( ) throw (RuntimeException)
+{
+ return makeAny((sal_Int32)1);
+}
+// -----------------------------------------------------------------------------
+Any VCLXAccessibleToolBoxItem::getMinimumValue( ) throw (RuntimeException)
+{
+ return makeAny((sal_Int32)0);
+}
+// -----------------------------------------------------------------------------
+
+
diff --git a/accessibility/util/acc.map b/accessibility/util/acc.map
new file mode 100644
index 000000000000..b9e53f414df5
--- /dev/null
+++ b/accessibility/util/acc.map
@@ -0,0 +1,7 @@
+UDK_3_0_0 {
+ global:
+ getStandardAccessibleFactory;
+ getSvtAccessibilityComponentFactory;
+ local:
+ *;
+};
diff --git a/accessibility/util/makefile.mk b/accessibility/util/makefile.mk
new file mode 100644
index 000000000000..42a6061fa2c9
--- /dev/null
+++ b/accessibility/util/makefile.mk
@@ -0,0 +1,86 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+PRJNAME=accessibility
+TARGET=acc
+USE_DEFFILE=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+#.INCLUDE : svpre.mk
+#.INCLUDE : settings.mk
+#.INCLUDE : sv.mk
+
+LDUMP=ldump2.exe
+
+# --- Library -----------------------------------
+# --- acc ---------------------------------------
+LIB1TARGET=$(SLB)$/$(PRJNAME).lib
+LIB1FILES=\
+ $(SLB)$/standard.lib \
+ $(SLB)$/extended.lib \
+ $(SLB)$/helper.lib
+
+SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
+
+SHL1STDLIBS= \
+ $(VCLLIB) \
+ $(COMPHELPERLIB) \
+ $(SOTLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(UNOTOOLSLIB) \
+ $(TKLIB) \
+ $(TOOLSLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(SALLIB)
+
+SHL1LIBS=$(LIB1TARGET)
+SHL1DEPN=$(LIB1TARGET) \
+ makefile.mk
+
+
+SHL1VERSIONMAP= $(TARGET).map
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+DEF1NAME= $(SHL1TARGET)
+
+# === .res file ==========================================================
+
+RES1FILELIST=\
+ $(SRS)$/helper.srs
+
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES=$(RES1FILELIST)
+
+# --- Targets ----------------------------------
+
+.INCLUDE : target.mk
+
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..d81df5fb7363
--- /dev/null
+++ b/accessibility/workben/makefile.in
@@ -0,0 +1,31 @@
+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)/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..7f19d8936757
--- /dev/null
+++ b/accessibility/workben/makefile.mk
@@ -0,0 +1,39 @@
+# 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 \
+ 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..6e8e45bc4e82
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/AccessibilityWorkBench.java
@@ -0,0 +1,702 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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();
+ implSetCurrentObject( aObject );
+ if (aObject instanceof XAccessible)
+ {
+ if (maObjectViewContainer != null)
+ maObjectViewContainer.SetObject( ((XAccessible)aObject).getAccessibleContext() );
+ }
+ if (maCanvas != null)
+ maCanvas.SelectObject ((TreeNode) aObject);
+ setCursor (aCursor);
+ } else {
+ implSetCurrentObject( aEvent.getPath().getLastPathComponent() );
+ if (maObjectViewContainer != null)
+ maObjectViewContainer.SetObject (null);
+ if (maCanvas != null)
+ maCanvas.SelectObject (null);
+ }
+ }
+
+
+ private void implSetCurrentObject( Object i_object )
+ {
+ if ( maObjectViewContainer == null )
+ return;
+ if ( maCurrentObject != null )
+ {
+ AccessibilityModel.removeEventListener( (TreeNode)maCurrentObject, maObjectViewContainer );
+ }
+ maCurrentObject = i_object;
+ if ( maCurrentObject != null )
+ {
+ AccessibilityModel.addEventListener( (TreeNode)maCurrentObject, maObjectViewContainer );
+ }
+ }
+
+ // 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;
+ private Object maCurrentObject = null;
+}
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..86b642e8091c
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/Canvas.java
@@ -0,0 +1,322 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..f2595351a4f5
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/CanvasShape.java
@@ -0,0 +1,412 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..03ad4bf38c46
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/ShapeContainer.java
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..df47f1bc8028
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.common
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+JARFILES = 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..1e56c10c98b4
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/canvas/makefile.mk
@@ -0,0 +1,55 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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..0bf38a0fada2
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/makefile.common
@@ -0,0 +1,30 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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..a07d631d6f11
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/makefile.mk
@@ -0,0 +1,57 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJNAME = awb
+PRJ = ..$/..$/..$/..$/..
+TARGET = java_awb
+PACKAGE = org$/openoffice$/accessibility$/awb
+
+USE_JAVAVER:=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.IF "$(JAVAVER:s/.//)" >= "140"
+JARFILES = 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..36111c54081d
--- /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 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..159467778554
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityModel.java
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..81a499aabf0d
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityNode.java
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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 =
+ 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 localListener = this.listener;
+ if (localListener != null) {
+ localListener.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 = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.OldValue );
+ if (xAccessible != null) {
+ handleChildRemoved(xAccessible);
+ }
+
+ xAccessible = UnoRuntime.queryInterface( XAccessible.class, accessibleEventObject.NewValue );
+ if (xAccessible != null) {
+ handleChildAdded(xAccessible);
+ }
+ }
+
+ XAccessibleEventListener localListener = this.listener;
+ if (localListener != null) {
+ localListener.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..e485c993706a
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTree.java
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..6069c8f5f5ee
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/AccessibilityTreeModel.java
@@ -0,0 +1,217 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..f2b4c6f0e97f
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityModel.java
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..a982ad71c4d5
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/DynamicAccessibilityNode.java
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..579b8822ce76
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/Makefile
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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..8eaa9dab6c02
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/ToolkitNode.java
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+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..e44be51360e7
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.common
@@ -0,0 +1,35 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+JARFILES = 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..0135ca9d6422
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/tree/makefile.mk
@@ -0,0 +1,51 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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..d4c0e102b7a9
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ComponentView.java
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..a8588cd18ca6
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ContextView.java
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..2e39f117f62e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/EditableTextView.java
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..67e8091e027f
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/EventMonitorView.java
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+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);
+ mnLineNo = 0;
+ 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,200));
+
+ 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 ((mnLineNo++) + ". " + NameProvider.getEventName (aEvent.EventId) + " : "
+ + aEvent.OldValue.toString()
+ + " -> "
+ + aEvent.NewValue.toString() + "\n");
+ UpdateVerticalScrollBar();
+ }
+
+ private JTextArea maText;
+ private int mnLineNo;
+ 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..4dec27958d71
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/FocusView.java
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..728b3dc426d7
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/LayoutManager.java
@@ -0,0 +1,160 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..54855cbaf885
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ObjectViewContainer.java
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..216bc3a82bfc
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ParentView.java
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..ad5a83467372
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/SelectionView.java
@@ -0,0 +1,267 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..44638b099edc
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/StateSetView.java
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..07b5d2bb9b78
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/TableView.java
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..4a838aa85884
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/TextView.java
@@ -0,0 +1,467 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..bc598dcaf2fa
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/ViewGridLayout.java
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..38033b3ab658
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.common
@@ -0,0 +1,45 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+JARFILES = 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..0bfa48537ea2
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/makefile.mk
@@ -0,0 +1,51 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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..c210b0eff086
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/CaretSpinnerModel.java
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+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..f37969d5ee59
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextActionDialog.java
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..dad548ca730e
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextAttributeDialog.java
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..cdb3f26b5e55
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextDialogFactory.java
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 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..a8710cbad7cc
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/TextEditDialog.java
@@ -0,0 +1,122 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+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..7d9a5e8febfa
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.common
@@ -0,0 +1,34 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+JARFILES = 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..1ec7da26619b
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/awb/view/text/makefile.mk
@@ -0,0 +1,51 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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..0f56117e1fdf
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/AccessibleEventMulticaster.java
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package 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..ce9091d5d735
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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..0d7b0a3f51df
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/makefile.common
@@ -0,0 +1,36 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+JARFILES = 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..312410c1de48
--- /dev/null
+++ b/accessibility/workben/org/openoffice/accessibility/misc/makefile.mk
@@ -0,0 +1,55 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+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
+