summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/doc/layout/ChangeLog1286
-rw-r--r--toolkit/doc/layout/ChangeLog.0546
-rw-r--r--toolkit/doc/layout/README24
-rw-r--r--toolkit/doc/layout/TODO227
-rw-r--r--toolkit/doc/layout/apinotes.txt76
-rw-r--r--toolkit/doc/layout/metricfield.txt57
-rw-r--r--toolkit/doc/layout/notes.txt117
-rw-r--r--toolkit/doc/layout/oldnotes.txt224
-rw-r--r--toolkit/doc/layout/vcl.txt20
-rw-r--r--toolkit/inc/layout/layout-post.hxx102
-rw-r--r--toolkit/inc/layout/layout-pre.hxx107
-rw-r--r--toolkit/inc/layout/layout.hxx829
-rw-r--r--toolkit/inc/makefile.mk48
-rw-r--r--toolkit/inc/pch/precompiled_toolkit.cxx29
-rw-r--r--toolkit/inc/pch/precompiled_toolkit.hxx349
-rw-r--r--toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx166
-rw-r--r--toolkit/inc/toolkit/awt/vclxbitmap.hxx87
-rw-r--r--toolkit/inc/toolkit/awt/vclxcontainer.hxx80
-rw-r--r--toolkit/inc/toolkit/awt/vclxdevice.hxx137
-rw-r--r--toolkit/inc/toolkit/awt/vclxfont.hxx96
-rw-r--r--toolkit/inc/toolkit/awt/vclxgraphics.hxx140
-rw-r--r--toolkit/inc/toolkit/awt/vclxmenu.hxx186
-rw-r--r--toolkit/inc/toolkit/awt/vclxpointer.hxx85
-rw-r--r--toolkit/inc/toolkit/awt/vclxprinter.hxx225
-rw-r--r--toolkit/inc/toolkit/awt/vclxregion.hxx96
-rw-r--r--toolkit/inc/toolkit/awt/vclxspinbutton.hxx100
-rw-r--r--toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx67
-rw-r--r--toolkit/inc/toolkit/awt/vclxtoolkit.hxx217
-rw-r--r--toolkit/inc/toolkit/awt/vclxtopwindow.hxx123
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindow.hxx220
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx1164
-rw-r--r--toolkit/inc/toolkit/awt/xsimpleanimation.hxx92
-rw-r--r--toolkit/inc/toolkit/awt/xthrobber.hxx88
-rw-r--r--toolkit/inc/toolkit/controls/accessiblecontrolcontext.hxx136
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx308
-rw-r--r--toolkit/inc/toolkit/controls/eventcontainer.hxx142
-rw-r--r--toolkit/inc/toolkit/controls/formattedcontrol.hxx127
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx262
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx90
-rw-r--r--toolkit/inc/toolkit/controls/roadmapcontrol.hxx229
-rw-r--r--toolkit/inc/toolkit/controls/roadmapentry.hxx91
-rw-r--r--toolkit/inc/toolkit/controls/stdtabcontroller.hxx94
-rw-r--r--toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx142
-rw-r--r--toolkit/inc/toolkit/controls/tkscrollbar.hxx124
-rw-r--r--toolkit/inc/toolkit/controls/tksimpleanimation.hxx111
-rw-r--r--toolkit/inc/toolkit/controls/tkspinbutton.hxx127
-rw-r--r--toolkit/inc/toolkit/controls/tkthrobber.hxx109
-rw-r--r--toolkit/inc/toolkit/controls/unocontrol.hxx232
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolbase.hxx69
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainer.hxx166
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx66
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolmodel.hxx177
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx1434
-rw-r--r--toolkit/inc/toolkit/dllapi.h40
-rw-r--r--toolkit/inc/toolkit/helper/accessibilityclient.hxx73
-rw-r--r--toolkit/inc/toolkit/helper/accessiblefactory.hxx141
-rw-r--r--toolkit/inc/toolkit/helper/convert.hxx67
-rw-r--r--toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx56
-rw-r--r--toolkit/inc/toolkit/helper/externallock.hxx45
-rw-r--r--toolkit/inc/toolkit/helper/fixedhyperbase.hxx57
-rw-r--r--toolkit/inc/toolkit/helper/formpdfexport.hxx63
-rw-r--r--toolkit/inc/toolkit/helper/imagealign.hxx63
-rw-r--r--toolkit/inc/toolkit/helper/listenermultiplexer.hxx251
-rw-r--r--toolkit/inc/toolkit/helper/macros.hxx270
-rw-r--r--toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx57
-rw-r--r--toolkit/inc/toolkit/helper/mutexhelper.hxx51
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx242
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx111
-rw-r--r--toolkit/inc/toolkit/helper/solarrelease.hxx61
-rw-r--r--toolkit/inc/toolkit/helper/throbberimpl.hxx84
-rw-r--r--toolkit/inc/toolkit/helper/tkresmgr.hxx77
-rw-r--r--toolkit/inc/toolkit/helper/unomemorystream.hxx73
-rw-r--r--toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx64
-rw-r--r--toolkit/inc/toolkit/helper/unowrapper.hxx93
-rw-r--r--toolkit/inc/toolkit/helper/vclunohelper.hxx163
-rw-r--r--toolkit/prj/build.lst13
-rw-r--r--toolkit/prj/d.lst63
-rw-r--r--toolkit/qa/complex/toolkit/CallbackClass.java67
-rwxr-xr-xtoolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java331
-rwxr-xr-xtoolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java385
-rw-r--r--toolkit/qa/complex/toolkit/CheckAsyncCallback.java127
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java489
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java261
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java211
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java99
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java1017
-rw-r--r--toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java88
-rwxr-xr-xtoolkit/qa/complex/toolkit/interface_tests/makefile.mk57
-rwxr-xr-xtoolkit/qa/complex/toolkit/makefile.mk82
-rw-r--r--toolkit/qa/complex/xunitconversion/XUnitConversionTest.java222
-rw-r--r--toolkit/qa/complex/xunitconversion/makefile.mk77
-rw-r--r--toolkit/qa/unoapi/knownissues.xcl242
-rw-r--r--toolkit/qa/unoapi/makefile.mk43
-rw-r--r--toolkit/qa/unoapi/testdocuments/poliball.gifbin0 -> 945 bytes
-rw-r--r--toolkit/qa/unoapi/toolkit.sce77
-rw-r--r--toolkit/source/awt/asynccallback.cxx199
-rw-r--r--toolkit/source/awt/forward.hxx73
-rw-r--r--toolkit/source/awt/makefile.mk83
-rw-r--r--toolkit/source/awt/non-interactable-containers.xml15
-rw-r--r--toolkit/source/awt/vclxaccessiblecomponent.cxx924
-rw-r--r--toolkit/source/awt/vclxbitmap.cxx93
-rw-r--r--toolkit/source/awt/vclxbutton.cxx126
-rw-r--r--toolkit/source/awt/vclxbutton.hxx114
-rw-r--r--toolkit/source/awt/vclxcontainer.cxx239
-rw-r--r--toolkit/source/awt/vclxdevice.cxx382
-rw-r--r--toolkit/source/awt/vclxdialog.cxx279
-rw-r--r--toolkit/source/awt/vclxdialog.hxx107
-rw-r--r--toolkit/source/awt/vclxfixedline.cxx132
-rw-r--r--toolkit/source/awt/vclxfixedline.hxx75
-rw-r--r--toolkit/source/awt/vclxfont.cxx252
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx478
-rw-r--r--toolkit/source/awt/vclxmenu.cxx1059
-rw-r--r--toolkit/source/awt/vclxplugin.cxx80
-rw-r--r--toolkit/source/awt/vclxplugin.hxx67
-rw-r--r--toolkit/source/awt/vclxpointer.cxx80
-rw-r--r--toolkit/source/awt/vclxprinter.cxx463
-rw-r--r--toolkit/source/awt/vclxregion.cxx171
-rw-r--r--toolkit/source/awt/vclxscroller.cxx212
-rw-r--r--toolkit/source/awt/vclxscroller.hxx87
-rw-r--r--toolkit/source/awt/vclxspinbutton.cxx355
-rw-r--r--toolkit/source/awt/vclxsplitter.cxx245
-rw-r--r--toolkit/source/awt/vclxsplitter.hxx121
-rw-r--r--toolkit/source/awt/vclxsystemdependentwindow.cxx124
-rw-r--r--toolkit/source/awt/vclxtabcontrol.cxx540
-rw-r--r--toolkit/source/awt/vclxtabcontrol.hxx144
-rw-r--r--toolkit/source/awt/vclxtabpage.cxx156
-rw-r--r--toolkit/source/awt/vclxtabpage.hxx73
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx1697
-rw-r--r--toolkit/source/awt/vclxtopwindow.cxx345
-rw-r--r--toolkit/source/awt/vclxwindow.cxx2776
-rw-r--r--toolkit/source/awt/vclxwindow1.cxx108
-rw-r--r--toolkit/source/awt/vclxwindows.cxx6036
-rw-r--r--toolkit/source/awt/xsimpleanimation.cxx165
-rw-r--r--toolkit/source/awt/xthrobber.cxx158
-rw-r--r--toolkit/source/awt/xthrobber.hrc39
-rw-r--r--toolkit/source/awt/xthrobber.src177
-rw-r--r--toolkit/source/controls/accessiblecontrolcontext.cxx380
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx2104
-rw-r--r--toolkit/source/controls/eventcontainer.cxx214
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx468
-rw-r--r--toolkit/source/controls/geometrycontrolmodel.cxx653
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx239
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx93
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx307
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx96
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx163
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx82
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx270
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx121
-rw-r--r--toolkit/source/controls/grid/makefile.mk50
-rw-r--r--toolkit/source/controls/makefile.mk66
-rw-r--r--toolkit/source/controls/roadmapcontrol.cxx589
-rw-r--r--toolkit/source/controls/roadmapentry.cxx126
-rw-r--r--toolkit/source/controls/stdtabcontroller.cxx428
-rw-r--r--toolkit/source/controls/stdtabcontrollermodel.cxx408
-rw-r--r--toolkit/source/controls/tkscrollbar.cxx294
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx211
-rw-r--r--toolkit/source/controls/tkspinbutton.cxx350
-rw-r--r--toolkit/source/controls/tkthrobber.cxx190
-rw-r--r--toolkit/source/controls/tree/makefile.mk48
-rw-r--r--toolkit/source/controls/tree/treecontrol.cxx502
-rw-r--r--toolkit/source/controls/tree/treecontrol.hxx136
-rw-r--r--toolkit/source/controls/tree/treedatamodel.cxx673
-rw-r--r--toolkit/source/controls/unocontrol.cxx1537
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx285
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx834
-rw-r--r--toolkit/source/controls/unocontrolcontainermodel.cxx89
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx1495
-rw-r--r--toolkit/source/controls/unocontrols.cxx3788
-rw-r--r--toolkit/source/helper/accessibilityclient.cxx277
-rw-r--r--toolkit/source/helper/externallock.cxx46
-rw-r--r--toolkit/source/helper/fixedhyperbase.cxx72
-rw-r--r--toolkit/source/helper/formpdfexport.cxx639
-rw-r--r--toolkit/source/helper/imagealign.cxx135
-rw-r--r--toolkit/source/helper/listenermultiplexer.cxx208
-rw-r--r--toolkit/source/helper/makefile.mk64
-rw-r--r--toolkit/source/helper/property.cxx399
-rw-r--r--toolkit/source/helper/registerservices.cxx399
-rw-r--r--toolkit/source/helper/servicenames.cxx105
-rw-r--r--toolkit/source/helper/throbberimpl.cxx138
-rw-r--r--toolkit/source/helper/tkresmgr.cxx100
-rw-r--r--toolkit/source/helper/unomemorystream.cxx108
-rw-r--r--toolkit/source/helper/unopropertyarrayhelper.cxx160
-rw-r--r--toolkit/source/helper/unowrapper.cxx335
-rw-r--r--toolkit/source/helper/vclunohelper.cxx799
-rw-r--r--toolkit/source/layout/core/bin.cxx198
-rw-r--r--toolkit/source/layout/core/bin.hxx113
-rw-r--r--toolkit/source/layout/core/box-base.cxx172
-rw-r--r--toolkit/source/layout/core/box-base.hxx87
-rw-r--r--toolkit/source/layout/core/box.cxx281
-rw-r--r--toolkit/source/layout/core/box.hxx102
-rw-r--r--toolkit/source/layout/core/byteseq.cxx76
-rw-r--r--toolkit/source/layout/core/container.cxx169
-rw-r--r--toolkit/source/layout/core/container.hxx136
-rw-r--r--toolkit/source/layout/core/dialogbuttonhbox.cxx289
-rw-r--r--toolkit/source/layout/core/dialogbuttonhbox.hxx73
-rw-r--r--toolkit/source/layout/core/factory.cxx150
-rw-r--r--toolkit/source/layout/core/factory.hxx74
-rw-r--r--toolkit/source/layout/core/flow.cxx209
-rw-r--r--toolkit/source/layout/core/flow.hxx95
-rw-r--r--toolkit/source/layout/core/helper.cxx672
-rw-r--r--toolkit/source/layout/core/helper.hxx149
-rw-r--r--toolkit/source/layout/core/import.cxx336
-rw-r--r--toolkit/source/layout/core/import.hxx259
-rw-r--r--toolkit/source/layout/core/localized-string.cxx79
-rw-r--r--toolkit/source/layout/core/localized-string.hxx76
-rw-r--r--toolkit/source/layout/core/makefile.mk65
-rw-r--r--toolkit/source/layout/core/precompiled_xmlscript.hxx35
-rw-r--r--toolkit/source/layout/core/proplist.cxx454
-rw-r--r--toolkit/source/layout/core/proplist.hxx91
-rw-r--r--toolkit/source/layout/core/root.cxx409
-rw-r--r--toolkit/source/layout/core/root.hxx156
-rw-r--r--toolkit/source/layout/core/table.cxx311
-rw-r--r--toolkit/source/layout/core/table.hxx102
-rw-r--r--toolkit/source/layout/core/timer.cxx148
-rw-r--r--toolkit/source/layout/core/timer.hxx49
-rw-r--r--toolkit/source/layout/core/translate.cxx130
-rw-r--r--toolkit/source/layout/core/translate.hxx40
-rw-r--r--toolkit/source/layout/core/vcl.cxx66
-rw-r--r--toolkit/source/layout/core/vcl.hxx48
-rw-r--r--toolkit/source/layout/vcl/makefile.mk52
-rw-r--r--toolkit/source/layout/vcl/wbutton.cxx681
-rw-r--r--toolkit/source/layout/vcl/wcontainer.cxx266
-rw-r--r--toolkit/source/layout/vcl/wfield.cxx792
-rw-r--r--toolkit/source/layout/vcl/wrapper.cxx1626
-rw-r--r--toolkit/source/layout/vcl/wrapper.hxx149
-rw-r--r--toolkit/src2xml/README16
-rw-r--r--toolkit/src2xml/dryrunall.sh2
-rw-r--r--toolkit/src2xml/include-sc.lst8
-rw-r--r--toolkit/src2xml/include-sd.lst6
-rw-r--r--toolkit/src2xml/include-sw.lst5
-rw-r--r--toolkit/src2xml/include.lst301
-rw-r--r--toolkit/src2xml/sc.sh3
-rw-r--r--toolkit/src2xml/sd.sh3
-rw-r--r--toolkit/src2xml/source/boxer.py73
-rw-r--r--toolkit/src2xml/source/expression.py111
-rw-r--r--toolkit/src2xml/source/expression_test.py23
-rw-r--r--toolkit/src2xml/source/globals.py115
-rw-r--r--toolkit/src2xml/source/macroexpander_test.py71
-rw-r--r--toolkit/src2xml/source/macroparser.py130
-rw-r--r--toolkit/src2xml/source/macroparser_test.py20
-rw-r--r--toolkit/src2xml/source/src2xml.py227
-rw-r--r--toolkit/src2xml/source/srclexer.py488
-rw-r--r--toolkit/src2xml/source/srcparser.py416
-rw-r--r--toolkit/src2xml/src-sc.lst57
-rw-r--r--toolkit/src2xml/src-sd.lst124
-rw-r--r--toolkit/src2xml/src-sw.lst121
-rw-r--r--toolkit/src2xml/src.lst680
-rw-r--r--toolkit/src2xml/sw.sh3
-rwxr-xr-xtoolkit/test/accessibility/AWB.sxwbin0 -> 9257 bytes
-rw-r--r--toolkit/test/accessibility/AccTreeNode.java350
-rwxr-xr-xtoolkit/test/accessibility/AccessibilityTree.java377
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModel.java513
-rw-r--r--toolkit/test/accessibility/AccessibilityTreeModelBase.java122
-rwxr-xr-xtoolkit/test/accessibility/AccessibilityWorkBench.java620
-rw-r--r--toolkit/test/accessibility/AccessibleActionHandler.java72
-rw-r--r--toolkit/test/accessibility/AccessibleActionNode.java48
-rw-r--r--toolkit/test/accessibility/AccessibleCellHandler.java156
-rw-r--r--toolkit/test/accessibility/AccessibleComponentHandler.java102
-rw-r--r--toolkit/test/accessibility/AccessibleContextHandler.java91
-rw-r--r--toolkit/test/accessibility/AccessibleEditableTextHandler.java40
-rw-r--r--toolkit/test/accessibility/AccessibleExtendedComponentHandler.java73
-rw-r--r--toolkit/test/accessibility/AccessibleHyperlinkHandler.java42
-rw-r--r--toolkit/test/accessibility/AccessibleHypertextHandler.java42
-rw-r--r--toolkit/test/accessibility/AccessibleImageHandler.java51
-rw-r--r--toolkit/test/accessibility/AccessibleRelationHandler.java96
-rw-r--r--toolkit/test/accessibility/AccessibleSelectionHandler.java130
-rw-r--r--toolkit/test/accessibility/AccessibleTableHandler.java90
-rw-r--r--toolkit/test/accessibility/AccessibleTextHandler.java792
-rw-r--r--toolkit/test/accessibility/AccessibleTreeCellRenderer.java86
-rw-r--r--toolkit/test/accessibility/AccessibleTreeHandler.java110
-rw-r--r--toolkit/test/accessibility/AccessibleTreeNode.java101
-rw-r--r--toolkit/test/accessibility/AccessibleUNOHandler.java115
-rwxr-xr-xtoolkit/test/accessibility/Canvas.java448
-rw-r--r--toolkit/test/accessibility/CanvasShape.java330
-rw-r--r--toolkit/test/accessibility/ChildEventHandler.java46
-rw-r--r--toolkit/test/accessibility/ContextEventHandler.java52
-rw-r--r--toolkit/test/accessibility/EventHandler.java57
-rw-r--r--toolkit/test/accessibility/EventListener.java124
-rw-r--r--toolkit/test/accessibility/EventLogger.java31
-rw-r--r--toolkit/test/accessibility/EventQueue.java126
-rw-r--r--toolkit/test/accessibility/FrameActionListener.java21
-rw-r--r--toolkit/test/accessibility/GeometryEventHandler.java54
-rw-r--r--toolkit/test/accessibility/HelpWindow.java185
-rwxr-xr-xtoolkit/test/accessibility/InformationWriter.java415
-rw-r--r--toolkit/test/accessibility/MessageArea.java123
-rwxr-xr-xtoolkit/test/accessibility/MessageInterface.java5
-rw-r--r--toolkit/test/accessibility/NodeFactory.java147
-rw-r--r--toolkit/test/accessibility/NodeHandler.java140
-rw-r--r--toolkit/test/accessibility/NodeMap.java112
-rwxr-xr-xtoolkit/test/accessibility/OfficeConnection.java102
-rw-r--r--toolkit/test/accessibility/Options.java88
-rwxr-xr-xtoolkit/test/accessibility/Print.java5
-rw-r--r--toolkit/test/accessibility/QueuedListener.java55
-rw-r--r--toolkit/test/accessibility/QueuedTopWindowListener.java88
-rw-r--r--toolkit/test/accessibility/SelectionDialog.java179
-rwxr-xr-xtoolkit/test/accessibility/SimpleOffice.java389
-rw-r--r--toolkit/test/accessibility/StringNode.java13
-rw-r--r--toolkit/test/accessibility/TableEventHandler.java43
-rw-r--r--toolkit/test/accessibility/TextLogger.java52
-rw-r--r--toolkit/test/accessibility/TextUpdateListener.java170
-rw-r--r--toolkit/test/accessibility/TopWindowListener.java205
-rw-r--r--toolkit/test/accessibility/VectorNode.java50
-rw-r--r--toolkit/test/accessibility/about.html8
-rw-r--r--toolkit/test/accessibility/help.html91
-rw-r--r--toolkit/test/accessibility/jawb.mf3
-rw-r--r--toolkit/test/accessibility/makefile.mk127
-rw-r--r--toolkit/test/accessibility/news.html36
-rw-r--r--toolkit/test/accessibility/ov/ContextView.java125
-rw-r--r--toolkit/test/accessibility/ov/FocusView.java119
-rw-r--r--toolkit/test/accessibility/ov/ListeningObjectView.java60
-rw-r--r--toolkit/test/accessibility/ov/ObjectView.java77
-rw-r--r--toolkit/test/accessibility/ov/ObjectViewContainer.java166
-rw-r--r--toolkit/test/accessibility/ov/SelectionView.java230
-rw-r--r--toolkit/test/accessibility/ov/StateSetView.java249
-rw-r--r--toolkit/test/accessibility/ov/TextView.java123
-rw-r--r--toolkit/test/accessibility/ov/makefile.mk51
-rw-r--r--toolkit/test/accessibility/tools/NameProvider.java259
-rw-r--r--toolkit/test/accessibility/tools/makefile.mk42
-rw-r--r--toolkit/uiconfig/layout/delzip1
-rw-r--r--toolkit/uiconfig/layout/makefile.mk54
-rw-r--r--toolkit/uiconfig/layout/message-box.xml41
-rw-r--r--toolkit/uiconfig/layout/tab-dialog.xml20
-rw-r--r--toolkit/util/makefile.mk85
-rw-r--r--toolkit/util/makefile.pmk36
-rw-r--r--toolkit/util/toolkit.xml750
-rw-r--r--toolkit/workben/controls.cxx449
-rw-r--r--toolkit/workben/layout/.gitignore4
-rw-r--r--toolkit/workben/layout/README43
-rwxr-xr-xtoolkit/workben/layout/TEST11
-rw-r--r--toolkit/workben/layout/adjust.xml44
-rw-r--r--toolkit/workben/layout/align-test.xml30
-rw-r--r--toolkit/workben/layout/align.xml44
-rw-r--r--toolkit/workben/layout/boxtest.xml36
-rw-r--r--toolkit/workben/layout/dialogbuttons-ok.xml49
-rw-r--r--toolkit/workben/layout/dialogbuttons-reset.xml54
-rw-r--r--toolkit/workben/layout/dialogbuttons-save.xml49
-rw-r--r--toolkit/workben/layout/dialogbuttons-yes.xml49
-rw-r--r--toolkit/workben/layout/editor-normal.xml53
-rw-r--r--toolkit/workben/layout/editor.cxx1944
-rw-r--r--toolkit/workben/layout/editor.hxx48
-rw-r--r--toolkit/workben/layout/editor.xml52
-rw-r--r--toolkit/workben/layout/empty.xml26
-rw-r--r--toolkit/workben/layout/flow-container.xml48
-rw-r--r--toolkit/workben/layout/flow.xml17
-rw-r--r--toolkit/workben/layout/insert-sheet.xml57
-rw-r--r--toolkit/workben/layout/interactable-containers.xml49
-rw-r--r--toolkit/workben/layout/layout-flat.xml14
-rw-r--r--toolkit/workben/layout/layout.xml15
-rw-r--r--toolkit/workben/layout/makefile.mk151
-rw-r--r--toolkit/workben/layout/message-box.xml41
-rw-r--r--toolkit/workben/layout/more.xml19
-rw-r--r--toolkit/workben/layout/move-copy-sheet.xml21
-rw-r--r--toolkit/workben/layout/non-interactable-containers.xml41
-rw-r--r--toolkit/workben/layout/number-format.xml70
-rw-r--r--toolkit/workben/layout/numeric.xml10
-rw-r--r--toolkit/workben/layout/ooo-patch7
-rw-r--r--toolkit/workben/layout/paragraph.xml77
-rw-r--r--toolkit/workben/layout/plugin.cxx65
-rw-r--r--toolkit/workben/layout/plugin.hxx57
-rw-r--r--toolkit/workben/layout/plugin.xml29
-rw-r--r--toolkit/workben/layout/radio-groups.xml21
-rw-r--r--toolkit/workben/layout/recover.cxx110
-rw-r--r--toolkit/workben/layout/recover.hxx79
-rw-r--r--toolkit/workben/layout/recover.xml67
-rw-r--r--toolkit/workben/layout/refresh7
-rw-r--r--toolkit/workben/layout/run-s2x6
-rw-r--r--toolkit/workben/layout/scroller.xml32
-rw-r--r--toolkit/workben/layout/sequence.xml13
-rw-r--r--toolkit/workben/layout/shutdown.xml54
-rw-r--r--toolkit/workben/layout/simple-paragraph.cxx179
-rw-r--r--toolkit/workben/layout/simple-paragraph.hxx52
-rw-r--r--toolkit/workben/layout/simple-paragraph.xml11
-rw-r--r--toolkit/workben/layout/sort-options.xml40
-rw-r--r--toolkit/workben/layout/sortdlg.cxx70
-rw-r--r--toolkit/workben/layout/sortdlg.hrc83
-rw-r--r--toolkit/workben/layout/sortdlg.hxx73
-rw-r--r--toolkit/workben/layout/sortdlg.src317
-rw-r--r--toolkit/workben/layout/sortdlg.xml65
-rw-r--r--toolkit/workben/layout/splitter.xml13
-rw-r--r--toolkit/workben/layout/string-input.xml16
-rw-r--r--toolkit/workben/layout/tab-dialog.xml20
-rw-r--r--toolkit/workben/layout/tabcontrol.xml18
-rw-r--r--toolkit/workben/layout/table.xml15
-rw-r--r--toolkit/workben/layout/test.cxx366
-rw-r--r--toolkit/workben/layout/test.xml12
-rw-r--r--toolkit/workben/layout/testrc.in12
-rw-r--r--toolkit/workben/layout/tpsort.cxx1105
-rw-r--r--toolkit/workben/layout/tpsort.hxx217
-rw-r--r--toolkit/workben/layout/un-test.sh14
-rw-r--r--toolkit/workben/layout/uno.hxx106
-rw-r--r--toolkit/workben/layout/wordcount-plain.xml29
-rw-r--r--toolkit/workben/layout/wordcount-tight.xml35
-rw-r--r--toolkit/workben/layout/wordcount.xml50
-rw-r--r--toolkit/workben/layout/wordcountdialog.cxx110
-rw-r--r--toolkit/workben/layout/wordcountdialog.hxx65
-rw-r--r--toolkit/workben/layout/zoom-1.xml38
-rw-r--r--toolkit/workben/layout/zoom-2.xml39
-rw-r--r--toolkit/workben/layout/zoom-indent.xml41
-rw-r--r--toolkit/workben/layout/zoom-plain.xml20
-rw-r--r--toolkit/workben/layout/zoom.cxx622
-rw-r--r--toolkit/workben/layout/zoom.hrc53
-rw-r--r--toolkit/workben/layout/zoom.hxx123
-rw-r--r--toolkit/workben/layout/zoom.xml60
-rw-r--r--toolkit/workben/layout/zoom_def.hxx35
-rw-r--r--toolkit/workben/makefile.mk84
-rw-r--r--toolkit/workben/no_localization1
-rw-r--r--toolkit/workben/unodialog.cxx269
408 files changed, 90056 insertions, 0 deletions
diff --git a/toolkit/doc/layout/ChangeLog b/toolkit/doc/layout/ChangeLog
new file mode 100644
index 000000000000..240db833847c
--- /dev/null
+++ b/toolkit/doc/layout/ChangeLog
@@ -0,0 +1,1286 @@
+2008-03-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxwindow.cxx: Fix compile warning.
+
+2008-03-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * util/makefile.mk: Revert obsolete VERSION addition.
+
+2008-03-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/controls/dialogcontrol.cxx,
+ source/controls/unocontrol.cxx, source/helper/tkresmgr.cxx,
+ util/defs/wntmsci11: Revert weird initial patch.
+
+2008-03-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO: Doc update.
+
+2008-03-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-post.hxx, inc/layout/layout-pre.hxx,
+ inc/layout/layout.hxx, source/awt/vclxbutton.cxx,
+ source/vclcompat/wbutton.cxx, workben/layout/recover.xml: Implement
+ MoreButton. TODO: images.
+
+2008-03-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/vclcompat/wbutton.cxx: Remove redraw cruft, rename
+ redrawAlready to redraw.
+
+2008-03-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-post.hxx, source/vclcompat/wbutton.cxx: Step
+ towards cleaner redraw.
+
+2008-03-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-post.hxx, inc/layout/layout-pre.hxx,
+ inc/layout/layout.hxx, source/awt/vclxbutton.cxx,
+ source/awt/vclxbutton.hxx, source/layout/helper.cxx,
+ source/vclcompat/wbutton.cxx, workben/layout/recover.cxx,
+ workben/layout/recover.hxx: Extract AdvancedButton implementation
+ from recover.cxx into new widget.
+
+2008-03-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/layout/recover.cxx, workben/layout/recover.hxx,
+ workben/layout/recover.xml: Update recover dialog, make
+ advanced/simple switching work.
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/layout/zoom.cxx: In test mode, enable everything.
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/layout/localize.sdf: Manually add new translatable strings
+ and translations for de, nl.
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/layout/zoom.xml: Update zoom to have hbox of Zoom factor
+ and View layout alongside each other.
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/layout/zoom.cxx, workben/layout/zoom.hxx,
+ workben/layout/zoom.xml: Merge upstream's zoom.
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/vclcompat/wbutton.cxx, source/vclcompat/wrapper.hxx:
+ Nitpick, debugging aid.
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, source/vclcompat/wrapper.cxx: Implement
+ FixedLine.IsEnabled().
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * util/makefile.mk: Build lib name fix.
+
+2008-03-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-post.hxx, inc/layout/layout-pre.hxx,
+ inc/layout/layout.hxx, source/vclcompat/wcontainer.cxx,
+ workben/layout/recover.cxx, workben/layout/recover.hxx,
+ workben/layout/recover.xml: Complete VBox/HBox wrappers. Not use
+ them in recover, spacing still wrong.
+
+2008-03-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, workben/layout/recover.cxx,
+ workben/layout/recover.hxx, workben/layout/recover.xml: More
+ recovery dialog mockuping.
+
+2008-03-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/layout/box-base.cxx: Implement visibility of
+ elements/containers better.
+
+2008-03-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-post.hxx, inc/layout/layout-pre.hxx,
+ inc/layout/layout.hxx, source/layout/helper.cxx,
+ source/layout/import.cxx, source/layout/proplist.cxx,
+ source/vclcompat/wbutton.cxx, source/vclcompat/wfield.cxx,
+ source/vclcompat/wrapper.cxx, source/vclcompat/wrapper.hxx:
+ Implement FixedImage. Needed for recovery dialog.
+
+2008-02-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/layout/box-base.hxx, workben/layout/editor.cxx: Give
+ ChildData virtual distructor.
+
+2008-02-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-post.hxx, inc/layout/layout-pre.hxx,
+ inc/layout/layout.hxx, source/layout/helper.cxx,
+ source/vclcompat/makefile.mk, source/vclcompat/wrapper.cxx,
+ util/makefile.mk, workben/layout/makefile.mk,
+ workben/layout/recover.cxx, workben/layout/recover.hxx,
+ workben/layout/recover.xml, workben/layout/test.cxx: Stab at new
+ recover dialog.
+
+2008-02-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/layout/editor.cxx: Do not clear fresh container. Disable
+ debug printing.
+
+2008-02-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, workben/layout/localize.sdf: Fix localize.sdf for
+ wordcount.
+
+2008-02-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-pre.hxx, source/layout/dialogbuttonhbox.cxx: Fix
+ ID for displaying dialogs.
+
+2008-02-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, workben/layout/localize.sdf,
+ workben/layout/wordcount.xml, workben/layout/zoom.xml: Add strings
+ for all languages.
+
+2008-02-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, source/awt/vclxsplitter.cxx,
+ source/awt/vclxsplitter.hxx, source/awt/vclxtabcontrol.cxx,
+ source/awt/vclxtabcontrol.hxx, source/layout/box-base.cxx,
+ source/layout/box-base.hxx, source/layout/box.cxx,
+ source/layout/box.hxx, source/layout/container.cxx,
+ source/layout/dialogbuttonhbox.cxx,
+ source/layout/dialogbuttonhbox.hxx, source/layout/factory.cxx,
+ source/layout/flow.cxx, source/layout/helper.cxx,
+ source/layout/import.hxx, source/layout/makefile.mk,
+ source/layout/proplist.cxx, source/layout/root.cxx,
+ source/layout/table.cxx, source/layout/table.hxx,
+ source/layout/timer.cxx, source/vclcompat/wcontainer.cxx,
+ source/vclcompat/wfield.cxx, source/vclcompat/wrapper.cxx: Clean-up
+ code duplication from layout: new Box_Base class implements
+ addChild, removeChild, getChildren, getChildProperties for Box,
+ Table, VCLXSplitter, VCLXTabControl.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, source/layout/root.cxx: Document more fixmes.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, source/layout/proplist.cxx: Remove m237
+ workaround.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/layout/helper.cxx: More comment cleanups.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxtabcontrol.cxx, source/layout/box.cxx,
+ source/layout/container.cxx, source/vclcompat/wrapper.cxx:
+ Commented-out code cleanups.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout-post.hxx, inc/layout/layout-pre.hxx,
+ inc/layout/layout.hxx, inc/layout/layoutcore.hxx,
+ source/awt/forward.hxx, source/awt/vclxbutton.cxx,
+ source/awt/vclxbutton.hxx, source/awt/vclxdialog.cxx,
+ source/awt/vclxdialog.hxx, source/awt/vclxfixedline.cxx,
+ source/awt/vclxfixedline.hxx, source/awt/vclxscroller.cxx,
+ source/awt/vclxscroller.hxx, source/awt/vclxsplitter.cxx,
+ source/awt/vclxsplitter.hxx, source/awt/vclxtabcontrol.cxx,
+ source/awt/vclxtabcontrol.hxx, source/layout/bin.cxx,
+ source/layout/bin.hxx, source/layout/box.cxx,
+ source/layout/box.hxx, source/layout/container.cxx,
+ source/layout/container.hxx, source/layout/dialogbuttonhbox.cxx,
+ source/layout/dialogbuttonhbox.hxx, source/layout/factory.cxx,
+ source/layout/factory.hxx, source/layout/flow.cxx,
+ source/layout/flow.hxx, source/layout/helper.cxx,
+ source/layout/helper.hxx, source/layout/import.cxx,
+ source/layout/import.hxx, source/layout/makefile.mk,
+ source/layout/precompiled_xmlscript.hxx,
+ source/layout/proplist.cxx, source/layout/proplist.hxx,
+ source/layout/root.cxx, source/layout/root.hxx,
+ source/layout/table.cxx, source/layout/table.hxx,
+ source/layout/timer.cxx, source/layout/timer.hxx,
+ source/layout/translate.cxx, source/layout/translate.hxx,
+ source/vclcompat/makefile.mk, source/vclcompat/wbutton.cxx,
+ source/vclcompat/wcontainer.cxx, source/vclcompat/wfield.cxx,
+ source/vclcompat/wrapper.cxx, source/vclcompat/wrapper.hxx,
+ workben/layout/editor.cxx, workben/layout/editor.hxx,
+ workben/layout/makefile.mk, workben/layout/simple-paragraph.cxx,
+ workben/layout/simple-paragraph.hxx, workben/layout/test.cxx,
+ workben/layout/uno.hxx, workben/layout/zoom_def.hxx: Add licence
+ headers.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/layout/meekfile.mk: Junk meekfile.mk
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO: Update TODO.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/toolkit/awt/vclxwindows.hxx, source/awt/vclxwindow.cxx,
+ source/awt/vclxwindows.cxx: Move VCLXScrollBar's getMinimumSize()
+ from VCLXWindow's switch to method.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/toolkit/awt/vclxwindows.hxx, source/awt/vclxwindow.cxx,
+ source/awt/vclxwindows.cxx: Move VCLXMessageBox's getMinimumSize()
+ from VCLXWindow's switch to method.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, inc/toolkit/awt/vclxtopwindow.hxx,
+ source/awt/vclxdialog.cxx, source/awt/vclxdialog.hxx,
+ source/awt/vclxtopwindow.cxx: Remove code duplication from
+ VCLXDialog.
+
+2008-02-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxdialog.cxx, source/vclcompat/wbutton.cxx,
+ source/vclcompat/wcontainer.cxx, source/vclcompat/wrapper.hxx:
+ Comment cleanup.
+
+2008-02-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, source/layout/helper.hxx,
+ workben/layout/editor.cxx, workben/layout/wordcountdialog.cxx: Fix
+ remaining SUN warnings.
+
+2008-02-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, source/awt/vclxfixedline.hxx,
+ source/layout/byteseq.cxx, source/layout/helper.hxx,
+ source/layout/import.cxx, source/layout/makefile.mk,
+ source/layout/proplist.cxx, source/layout/translate.hxx,
+ source/vclcompat/wbutton.cxx, source/vclcompat/wcontainer.cxx,
+ source/vclcompat/wfield.cxx, source/vclcompat/wrapper.cxx,
+ source/vclcompat/wrapper.hxx, workben/layout/editor.cxx: Fix some
+ sunstudio12 warnings.
+
+2008-02-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * doc/layout/TODO, source/awt/makefile.mk,
+ source/awt/vclxbutton.cxx, source/awt/vclxbutton.hxx,
+ source/awt/vclxproxy.cxx, source/awt/vclxproxy.hxx,
+ source/layout/helper.cxx: Junk VCLXProxy.
+
+2008-02-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/toolkit/awt/vclxwindows.hxx,
+ inc/toolkit/helper/listenermultiplexer.hxx,
+ source/awt/vclxbutton.cxx, source/awt/vclxbutton.hxx,
+ source/awt/vclxtabcontrol.cxx, source/awt/vclxtabcontrol.hxx,
+ source/layout/helper.cxx: Hello world on AWTVCLXCancelButton() label
+ and images.
+
+2008-02-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * .gitignore, source/awt/forward.hxx, source/awt/makefile.mk,
+ source/awt/vclxdialog.cxx, source/awt/vclxdialog.hxx,
+ source/awt/vclxfixedline.cxx, source/awt/vclxfixedline.hxx,
+ source/awt/vclxscroller.cxx, source/awt/vclxscroller.hxx,
+ source/awt/vclxsplitter.cxx, source/awt/vclxsplitter.hxx,
+ source/awt/vclxtabcontrol.cxx, source/awt/vclxtabcontrol.hxx,
+ source/layout/makefile.mk, workben/layout/localize-de.sdf,
+ workben/layout/localize-nl.sdf: Cleanup of includes, namespace in
+ headers in awt.
+
+2008-02-11 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * prj/build.lst: Have workspace depend on util, fixes parallel build
+ (thanks kendy, Fridrich).
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/ooo-patch: Update ooo-patch.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/ooo-patch: Add transex3 to ooo-patch.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/ooo-patch: Add transex3 to ooo-patch & update.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/ooo-patch: Add transex3 patch export.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/de/wordcount.xml, workben/de/zoom.xml,
+ workben/nl/wordcount.xml, workben/nl/zoom.xml: Remove
+ hand-translated xml files.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, source/core/proplist.cxx: Grok translatable attributes with
+ _ prefix.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Add en-US,de,nl populated localize.sdf for zoom and wordcount.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/makefile.mk: Add compile time tralay translation rule.
+
+2008-02-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/de/wordcount.xml, workben/de/zoom.xml,
+ workben/nl/wordcount.xml, workben/nl/zoom.xml,
+ workben/wordcount.xml, workben/zoom.xml: Prefix translatable
+ attributes with _.
+
+2008-02-04 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, source/core/import.cxx, source/core/import.hxx,
+ source/core/proplist.cxx, source/core/proplist.hxx,
+ source/core/root.cxx, source/core/root.hxx, workben/zoom-1.xml,
+ workben/zoom-2.xml: Support Ivo Hinkelmann's move label/text/title
+ attribute to CONTENT transex3 hack.
+
+2008-01-10 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/nl/zoom.xml, workben/zoom.xml: Remove unnecessary ~.
+
+2008-01-10 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * prj/d.lst, workben/de/wordcount.xml, workben/de/zoom.xml,
+ workben/makefile.mk: Add manually translated de/zoom.xml and
+ de/wordcount.xml.
+
+2008-01-10 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/ooo-patch: Update patch info.
+
+2008-01-10 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/translate.cxx: Remove #if 0'ed fopen code in
+ fileExists.
+
+2008-01-10 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/test.cxx: Remove test code.
+
+2008-01-10 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, prj/d.lst, workben/makefile.mk, workben/ooo-patch: Install
+ nl/*xml files.
+
+2008-01-10 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, source/core/makefile.mk, source/core/root.cxx,
+ source/core/translate.cxx, source/core/translate.hxx,
+ workben/nl/wordcount.xml, workben/nl/zoom.xml, workben/test.cxx:
+ Implement read-right translation, cheat nl translations for zoom and
+ wordcount.
+
+2008-01-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/makefile.mk: Check for ENABLE_LAYOUT == "TRUE" (was: !=
+ ""). Disables harder, esp. on Sun.
+
+2008-01-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Add comment about Sun build problems.
+
+2008-01-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/makefile.mk: [!ENABLE_LAYOUT]: Do not compile anything in
+ workben. Also remove unnecessary not portable compiler flags.
+
+2008-01-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Put gcc flags inside GCC conditional.
+
+2008-01-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxbutton.cxx: Use plain sc_BUTTON.png names for
+ standard buttons.
+
+2008-01-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx: Remove zoom.src part from zoom-combobox patch.
+
+2008-01-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/ooo-patch: Update to m1.
+
+2008-01-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/ooo-patch: Update and add i18n TODO.
+
+2008-01-04 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, source/awt/vclxbutton.cxx: Fix l10n for default buttons.
+
+2007-12-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/ooo-patch: Update for ooo-build svn up.
+
+2007-12-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/dialogbuttonhbox.cxx, source/core/helper.cxx,
+ source/core/proplist.cxx, util/makefile.pmk, workben/makefile.mk:
+ TEST_LAYOUT cleanups and fixes.
+
+2007-12-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : [!TEST_LAYOUT]: Read *.xml from BASE_INSTALLATION/share/layout
+ only.
+
+2007-12-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wrapper.cxx: Cleanups.
+
+2007-12-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.xml: Update zoom.xml: in m241 FieldTypes:FUNIT_CUSTOM
+ == 13 (was: 11).
+
+2007-12-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/dialogbuttons-ok.xml, workben/dialogbuttons-reset.xml,
+ workben/dialogbuttons-save.xml, workben/dialogbuttons-yes.xml:
+ Remove some cruft from xml.
+
+2007-12-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/box.cxx, source/core/box.hxx,
+ source/core/container.cxx, source/core/dialogbuttonhbox.cxx,
+ source/core/dialogbuttonhbox.hxx, workben/shutdown.xml: Allow other
+ pushbuttons in dialogbuttonhbox too, sort as Action type.
+
+2007-12-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/ooo-patch: Add ooo-patch: facilitate export to ooo-build.
+
+2007-12-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, source/core/box.cxx, source/core/container.cxx,
+ workben/adjust.xml, workben/align.xml, workben/wordcount-tight.xml,
+ workben/wordcount.xml, workben/zoom-indent.xml, workben/zoom.xml:
+ Default to border=0, padding=0. Clean xml files.
+
+2007-12-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, inc/layout/layout.hxx, source/awt/vclxbutton.cxx,
+ source/awt/vclxbutton.hxx, source/awt/vclxdialog.cxx,
+ source/core/dialogbuttonhbox.cxx, source/core/dialogbuttonhbox.hxx,
+ source/wrapper/wbutton.cxx, source/wrapper/wcontainer.cxx,
+ workben/dialogbuttons-ok.xml, workben/dialogbuttons-reset.xml,
+ workben/dialogbuttons-save.xml, workben/dialogbuttons-yes.xml,
+ workben/dialogbuttons.xml, workben/editor.cxx, workben/makefile.mk:
+ Implement more buttons: Yes, No, Retry, Ignore, Reset, Apply.
+
+2007-12-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-12-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/editor.cxx, workben/test.cxx: More whitespace nits.
+
+2007-12-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/box.hxx, source/core/dialogbuttonhbox.cxx,
+ source/core/dialogbuttonhbox.hxx: Refactor dialogbuttonhbox.
+
+2007-12-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * apinotes.txt, doc/apinotes.txt, doc/notes.txt, notes.txt: Move
+ documentation to doc/.
+
+2007-12-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/table.cxx, workben/editor.cxx, workben/test.cxx,
+ workben/uno.hxx: More whitespace fixes.
+
+2007-12-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/dialogbuttonhbox.cxx: Comments and whitespace fixes.
+
+2007-12-18 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * README, TODO, source/awt/vclxbutton.hxx, source/core/box.hxx,
+ source/core/dialogbuttonhbox.cxx, source/core/dialogbuttonhbox.hxx,
+ source/core/helper.cxx, source/core/import.cxx,
+ source/core/makefile.mk, source/core/proplist.cxx,
+ workben/dialogbuttons.xml, workben/wordcount.xml, workben/zoom.xml:
+ Implement dialog button ordering.
+
+2007-12-18 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxbutton.hxx, source/core/box.hxx,
+ source/core/helper.cxx, source/core/makefile.mk,
+ source/wrapper/wrapper.hxx, workben/editor.cxx, workben/test.cxx,
+ workben/zoom.xml: First attempt at AlertHBox.
+
+2007-12-17 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-12-17 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Merge lilypond.org:vc/layout.git/
+
+2007-12-17 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, source/wrapper/wrapper.cxx: Implement
+ Dialog::SetParent, add Dialog (::Window *) constructor.
+
+2007-12-17 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Merge lilypond.org:vc/layout.git/
+
+2007-12-17 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Bugfix: update install inc/layout/*.
+
+2007-12-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Apply Michael's TODO patch.
+
+2007-12-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/helper.cxx, source/core/helper.hxx,
+ source/core/proplist.cxx, source/core/proplist.hxx: Move
+ OUSTRING_CSTR define and debugging compile fix & feature.
+
+2007-12-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/timer.cxx: Remove commented-out include.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/editor.cxx, workben/uno.hxx: Add includes for m9.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Major cleanup of includes and header namespace pollution.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, inc/layout/layout-post.hxx, inc/layout/layout.hxx,
+ source/api/com/sun/star/awt/MaxChildrenException.idl,
+ source/api/com/sun/star/awt/XDialog2.idl,
+ source/api/com/sun/star/awt/XLayoutFlow.idl,
+ source/api/com/sun/star/awt/XLayoutFlowContainer.idl,
+ source/api/com/sun/star/awt/XLayoutRoot.idl,
+ source/awt/vclxbutton.cxx, source/awt/vclxbutton.hxx,
+ source/awt/vclxdialog.cxx, source/awt/vclxdialog.hxx,
+ source/awt/vclxfixedline.cxx, source/awt/vclxfixedline.hxx,
+ source/awt/vclxproxy.cxx, source/awt/vclxproxy.hxx,
+ source/awt/vclxscroller.cxx, source/awt/vclxscroller.hxx,
+ source/awt/vclxsplitter.cxx, source/awt/vclxsplitter.hxx,
+ source/awt/vclxtabcontrol.cxx, source/awt/vclxtabcontrol.hxx,
+ source/core/bin.cxx, source/core/bin.hxx, source/core/box.cxx,
+ source/core/box.hxx, source/core/byteseq.cxx,
+ source/core/container.cxx, source/core/container.hxx,
+ source/core/factory.cxx, source/core/factory.hxx,
+ source/core/flow.cxx, source/core/flow.hxx,
+ source/core/globals.hxx, source/core/helper.cxx,
+ source/core/helper.hxx, source/core/import.cxx,
+ source/core/import.hxx, source/core/root.cxx, source/core/root.hxx,
+ source/core/table.cxx, source/core/table.hxx,
+ source/core/timeout.cxx, source/inc/layoutcore.hxx,
+ source/wrapper/wbutton.cxx, source/wrapper/wcontainer.cxx,
+ source/wrapper/wfield.cxx, source/wrapper/wimpl.hxx,
+ source/wrapper/wrapper.cxx: Whitespace and layout cleanups.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxdialog.hxx, source/core/byteseq.cxx,
+ source/core/import.hxx, source/core/root.cxx,
+ source/wrapper/wfield.cxx, source/wrapper/wimpl.hxx,
+ source/wrapper/wrapper.cxx: Cleanup: have braces on separate lines.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/uno.hxx, workben/uno.hxx: Move uno.hxx to workben, no
+ need to export it.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/uno.hxx, source/awt/vclxbutton.cxx,
+ source/awt/vclxdialog.cxx, source/awt/vclxfixedline.cxx,
+ source/awt/vclxproxy.cxx, source/awt/vclxscroller.cxx,
+ source/awt/vclxsplitter.cxx, source/awt/vclxtabcontrol.cxx,
+ source/core/bin.cxx, source/core/box.cxx, source/core/byteseq.cxx,
+ source/core/container.cxx, source/core/container.hxx,
+ source/core/flow.cxx, source/core/globals.hxx,
+ source/core/helper.cxx, source/core/import.cxx,
+ source/core/import.hxx, source/core/root.cxx,
+ source/core/table.cxx, source/core/timeout.cxx,
+ source/wrapper/wbutton.cxx, source/wrapper/wcontainer.cxx,
+ source/wrapper/wfield.cxx, source/wrapper/wimpl.hxx,
+ source/wrapper/wrapper.cxx: Use DBG_ERROR* instead of printing to
+ console.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/box.cxx, source/core/container.cxx,
+ source/core/container.hxx, source/core/helper.cxx,
+ source/core/import.cxx, source/core/table.cxx: Use DBG_ERROR instead
+ of printf for errors.
+
+2007-11-28 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, prj/build.lst: Fix dependency/concurrent make problem.
+
+2007-11-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.cxx: Update wordcountdialog.cxx from sw
+ tree.
+
+2007-11-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Move postprocessing to src2xml.
+
+2007-11-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Move src2xml postprocessing from run-s2x to src2xml.py.
+
+2007-11-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * src2xml/source/globals.py: src2xml: write progress to stderr,
+ allows progress while using stdout output.
+
+2007-11-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * prj/build.lst, prj/d.lst, workben/makefile.mk: Install xml files
+ too. Thanks Fridrich!
+
+2007-11-23 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-23 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Put Ok/Help buttons in homogenous hbox.
+
+2007-11-23 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Add extra hbox/vbox pairs to reduce cnt:padding duplication.
+
+2007-11-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : More layout-pre.hxx cpp hacks to make zoom and wordcount diffs
+ smaller.
+
+2007-11-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/makefile.mk, workben/un-test.sh: Add un-test.sh to remove
+ TEST_LAYOUT code and dist into OO.o.
+
+2007-11-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx: Remove misguided NON_LAYOUT_COMPILE_FIXES and
+ whitespace nits.
+
+2007-11-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/makefile.mk, workben/pytt, workben/run-s2x,
+ workben/un-test.sh, workben/zoom.cxx: Add un-test.sh script and dist
+ target to `distribute' dialog code to OO.o.
+
+2007-11-21 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, inc/layout/layout-post.hxx, inc/layout/layout-pre.hxx,
+ inc/layout/layout.hxx, source/awt/makefile.mk,
+ source/core/makefile.mk, source/wrapper/makefile.mk,
+ workben/makefile.mk, workben/wordcountdialog.cxx,
+ workben/wordcountdialog.hxx, workben/zoom.cxx, workben/zoom.hxx:
+ Rename USE_LAYOUT -> ENABLE_LAYOUT. Make zoom, wordcount diffs bits
+ smaller.
+
+2007-11-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Add <layout/layout-pre.hxx> <layout/layout-post.hxx> cpp
+ hacking.
+
+2007-11-20 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/run-s2x: Remove all geometry attributes.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/helper.cxx: Disable "fixedinfo" workaround.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcount.xml: Remove misguided "fixedinfo" from
+ wordcount.xml.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * .gitignore: Ingore pyc files.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcount-plain.xml, workben/wordcount-tight.xml,
+ workben/zoom-plain.xml: Add plain postprocessed output from src2xml.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Comment-out #include statements from .src files.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx, workben/zoom.xml: Use stringize to make zoom.cxx
+ diff smaller.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcount.xml, workben/wordcountdialog.cxx: Use stringize
+ to make wordcount diff smaller.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/test.cxx: Fix standalone .xml loading for test.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/run-s2x: Add run-s2x: make .xml from src2xml
+ compilable for zoom, wordcount.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, source/core/helper.cxx: Small fixedline doco fix.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcount.xml, workben/wordcountdialog.hxx: Use
+ "fixedinfo" rather than "fixedtext" in wordcountdialog.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Use "fixedtext" to when asked to create "fixedinfo".
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, source/wrapper/wrapper.cxx: Implement
+ FixedInfo.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * cenarios, source/awt/vclxdialog.cxx, source/core/root.cxx,
+ source/wrapper/wimpl.hxx, source/wrapper/wrapper.cxx: Cleanups.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/uno.hxx, source/core/factory.cxx,
+ source/core/makefile.mk, source/core/root.cxx,
+ source/core/root.hxx, source/wrapper/makefile.mk,
+ source/wrapper/wrapper.cxx, workben/makefile.mk: Remove
+ [!LAYOUT_FACTORY] branch.
+
+2007-11-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/Documento por Gravar 1: Remove Documento por Gravar 1.
+
+2007-11-16 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.xml: Tweak.
+
+2007-11-16 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : [LAYOUT_FACTORY]: Add LayoutFactory and register that for Layout
+ Serviceinfo instead of LayoutRoot.
+
+2007-11-16 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * README: Update README.
+
+2007-11-16 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Also grok TypeClass_ENUM. Set unit=11 (custom) on zoom
+ metricfield.
+
+2007-11-16 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.cxx: Typo in workben/wordcountdialog.
+ Fixes Document word count display.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcount.xml, workben/wordcountdialog.cxx,
+ workben/wordcountdialog.xml: Rename wordcountdialog.xml to
+ wordcount.xml, compile fixes from sw/...
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/import.cxx, source/core/import.hxx: Indentation fixes.
+ Move ~ElementBase destructor to cxx file.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/test.cxx: Bugfix for test default --test argument.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.xml: Wordcountdialog default text tweak.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/root.cxx, source/core/root.hxx,
+ source/wrapper/wrapper.cxx: Remove LAYOUT_WEAK and other hackerish
+ feeble attempts at second init bug.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : More attempts at tackling second init bug.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Lost of handwaving to try to destroy LayoutRoot.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/import.hxx: Add destructor for WidgetElement.
+
+2007-11-15 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Fix indentation of import.cxx.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO, workben/zoom-margin.xml, workben/zoom.xml: Tweak zoom
+ dialog. Add zoom-margin.xml.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.xml: Tweak wordcountdialog till it looks
+ nice.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.cxx: Typo.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.xml: Import workben/wordcountdialog.xml
+ straight from src2xml.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : src2xml/source/src2xml.py: also grok -I option, do not print
+ progress.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.xml: Use modaldialog for zoom.xml.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.xml, workben/zoom_def.hxx: Oops, add
+ zoom_def.hxx and wordcountdialog.xml.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/test.cxx: Refactor test program, also run wordcountdialog.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/test.cxx: Prune unused headers.
+
+2007-11-14 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx, workben/zoom.hxx: Make zoom diff even smaller,
+ import from svx.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/makefile.mk, workben/wordcountdialog.cxx,
+ workben/wordcountdialog.hxx: Make wordcountdialog compilable under
+ test and add to makefile.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/wordcountdialog.cxx, workben/wordcountdialog.hxx: Import
+ wordcountdialog.cxx, wordcountdialog.hxx.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, inc/layout/uno.hxx,
+ source/awt/globals.hxx, source/awt/vclxdialog.cxx,
+ source/awt/vclxdialog.hxx, source/awt/vclxfixedline.cxx,
+ source/awt/vclxfixedline.hxx, source/awt/vclxproxy.cxx,
+ source/awt/vclxscroller.cxx, source/awt/vclxscroller.hxx,
+ source/awt/vclxsplitter.cxx, source/awt/vclxsplitter.hxx,
+ source/awt/vclxtabcontrol.cxx, source/awt/vclxtabcontrol.hxx,
+ source/core/bin.cxx, source/core/bin.hxx, source/core/box.cxx,
+ source/core/box.hxx, source/core/byteseq.cxx,
+ source/core/container.cxx, source/core/container.hxx,
+ source/core/factory.cxx, source/core/flow.cxx,
+ source/core/flow.hxx, source/core/globals.hxx,
+ source/core/helper.cxx, source/core/helper.hxx,
+ source/core/import.cxx, source/core/import.hxx,
+ source/core/root.cxx, source/core/root.hxx, source/core/table.cxx,
+ source/core/table.hxx, source/core/timeout.cxx,
+ source/core/timeout.hxx, source/inc/layoutcore.hxx,
+ source/wrapper/wbutton.cxx, source/wrapper/wcontainer.cxx,
+ source/wrapper/wfield.cxx, source/wrapper/wrapper.cxx,
+ workben/editor.cxx, workben/editor.hxx, workben/paragraph.cxx,
+ workben/paragraph.hxx, workben/simple-paragraph.cxx,
+ workben/simple-paragraph.hxx, workben/test.cxx: Replace TAB -> 4
+ spaces.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/helper.cxx, source/wrapper/wbutton.cxx,
+ source/wrapper/wimpl.hxx, source/wrapper/wrapper.cxx: Add debug
+ printing, ~ContextImpl.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.xml: Add space in custom-unit-text.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Remove core/dialog.hxx, core/dialog.cxx.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wbutton.cxx: Make RadioButton hack more complete:
+ remove buttons from RadioButtonGroup too.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wimpl.hxx: Make WindowImpl hierarchy virtual from
+ top.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.xml: Add Id for FixedLine. Fixes warning.
+
+2007-11-13 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx: Fix comment. Import from svx.
+
+2007-11-12 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Replace XDialog2, VCXDialog, Dialog Cancel/Help/Ok by EndDialog
+ ( BUTTONID_* )
+
+2007-11-12 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Actually return the result of a dialog.
+
+2007-11-12 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx, workben/zoom.hxx: Update zoom code from svx
+ module with TEST_LAYOUT switches.
+
+2007-11-12 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/makefile.mk: Also set -DTEST_LAYOUT in makefile.
+
+2007-11-12 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wbutton.cxx: Workaround for radiobutton-unset
+ inside OOo.
+
+2007-11-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/test.cxx: Add comment about using WeakImplHelper1 for
+ standalone run.
+
+2007-11-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/uno.hxx: Compile fix for using WeakImplHelper1 in
+ UnoBootstrapLayout.
+
+2007-11-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Rename UnoBootstrapSucks to UnoBootstrapLayout and move to
+ uno.hxx header.
+
+2007-11-09 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Rename #define LAYOUT to USE_LAYOUT.
+
+2007-11-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : In-tree compile fixes for -DLAYOUT=1.
+
+2007-11-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.hxx: Make diff with svx/source/dialog/zoom.hxx
+ minimal.
+
+2007-11-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Add FixedLine member to SvxZoomDialog.
+
+2007-11-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, workben/editor.cxx: Do not set namespace in
+ header.
+
+2007-11-08 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Make diff for zoom.cxx with svx/source/dialog/zoom.cxx minimal.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wbutton.cxx: Use #if 0 rather than #if 1 and add
+ comment, easier to catch.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxdialog.cxx: Use BUTTONID_CANCEL, BUTTONID_OK from
+ msgbox.hxx rather than ERRCODE.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx: Remove debugging code.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, source/api/com/sun/star/awt/XDialog2.idl,
+ source/awt/vclxdialog.cxx, source/awt/vclxdialog.hxx,
+ source/wrapper/wbutton.cxx, source/wrapper/wrapper.cxx: Implement Ok
+ and Help alongside Cancel in XDialog2, VCLXDialog, OKButton.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Add workben/paragraph.*
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Use 'has_border' instead of 'border' for awt attributes. Also
+ put back fullsize, optimumsize, show properties.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/core/box.cxx: Spacing nits.
+
+2007-11-07 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Add Ricardo's suggestion for actual dialog.
+
+2007-11-05 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Make Window (top of layout hierarchy) virtual.
+
+2007-11-05 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Tweaks to zoom dialog.
+
+2007-11-05 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wbutton.cxx: Remove debugging code and add explicit
+ casts for mpWindow in callbacks.
+
+2007-10-31 Michael Meeks <michael@t60p.(none)>
+
+ * source/wrapper/wbutton.cxx: raw mpWindow static casting fix
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Add Kohei's converter under src2xml.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * .gitignore: Ignore more.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wbutton.cxx: Only print debugging if pointers are
+ wrong.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/zoom.cxx: Debug print.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/api/makefile.mk, source/awt/makefile.mk,
+ source/core/makefile.mk, source/wrapper/makefile.mk,
+ util/makefile.mk, workben/makefile.mk: Unification of .mk files.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Add mpWindow != &OKbutton debug code and crude fix.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Revert "Revert introduction of XDialog2."
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/api/makefile.mk, source/awt/vclxdialog.hxx,
+ source/core/dialog.cxx, source/core/dialog.hxx,
+ source/core/globals.hxx, source/core/import.cxx,
+ source/core/import.hxx, source/core/makefile.mk,
+ source/wrapper/wrapper.cxx, workben/test.cxx: Revert introduction of
+ XDialog2.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wbutton.cxx: Revert
+ 338f4229e321fa79ab3564504d1546e5010c0b0b.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/api/com/sun/star/awt/XDialog2.idl: Spacing nit.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Revert "Add GetImplementation to VCLXProxy."
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Revert "Add Click and LINK (Click) to IconButton."
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Update TODO.
+
+2007-10-30 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Implement non-dummy HelpButton.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Oops, add XDialog2 to archive.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Implement cancel in vclxdialog.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Implement default callback to ButtonImpl using XButton.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Revert "Set click handler in Button instead of ButtonImpl, add
+ debug printing."
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Revert "Attempt at using DialogImpl to hold button Click
+ handler."
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Revert "Pass a Button instead of ButtonImpl to default click
+ handler."
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Revert "Use Dialog as the Click link handler."
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, source/wrapper/wbutton.cxx: Use Dialog as
+ the Click link handler.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Pass a Button instead of ButtonImpl to default click handler.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Attempt at using DialogImpl to hold button Click handler.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Set click handler in Button instead of ButtonImpl, add debug
+ printing.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wbutton.cxx: Add non-dummy implementation of
+ CancelButtonImpl.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxdialog.cxx: Add comment about XDialog2::cancel's
+ pure virtualness.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/wrapper/wrapper.cxx: Add debug print to
+ layout::Dialog::Cancel.
+
+2007-10-29 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : if(0)'ed code that sets default handler for ButtonImpl.
+
+2007-10-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxbutton.cxx, source/awt/vclxbutton.hxx: Add Click
+ and LINK (Click) to IconButton.
+
+2007-10-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxproxy.cxx, source/awt/vclxproxy.hxx: Add
+ GetImplementation to VCLXProxy.
+
+2007-10-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * inc/layout/layout.hxx, source/api/makefile.mk,
+ source/awt/vclxdialog.cxx, source/awt/vclxdialog.hxx,
+ source/core/dialog.cxx, source/core/dialog.hxx,
+ source/core/globals.hxx, source/core/import.cxx,
+ source/core/import.hxx, source/core/makefile.mk,
+ source/wrapper/wrapper.cxx, workben/test.cxx: Add XDialog2 with
+ dummy Cancel interface. Use it instead of XDialog.
+
+2007-10-26 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * TODO: Add Michael's bug list, with progress.
+
+2007-10-25 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * : Silence non-virtual-destructor warnings the proper way.
+
+2007-10-24 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * ChangeLog: Put marker in ChangeLog to say it's discontinued.
diff --git a/toolkit/doc/layout/ChangeLog.0 b/toolkit/doc/layout/ChangeLog.0
new file mode 100644
index 000000000000..326cbe218ec6
--- /dev/null
+++ b/toolkit/doc/layout/ChangeLog.0
@@ -0,0 +1,546 @@
+2007-10-24 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * Discontinued for now. Generate from git log.
+
+2007-10-22 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * source/awt/vclxsplitter.hxx:
+ * source/awt/vclxtabcontrol.hxx:
+ * source/core/bin.cxx:
+ * source/core/bin.hxx:
+ * source/core/box.cxx:
+ * source/core/box.hxx:
+ * source/core/container.hxx:
+ * source/core/flow.cxx:
+ * source/core/flow.hxx:
+ * source/core/table.hxx (getHeightForWidth): Use sal_Int32 instead of
+ LONG. Fixes compile on x86_64.
+
+ * source/awt/vclxsplitter.cxx:
+ * source/awt/vclxscroller.cxx:
+ * source/awt/vclxdialog.cxx: Use %d, as INT is used here,
+ not LONG. Fixes compile warnings on x86_64.
+
+ * workben/refresh: FIXME: filter-out flood of
+
+ class <> has virtual functions but non-virtual destructor
+
+ for now, to make other messages visible.
+
+ * Resolve conflicts.
+
+2007-10-19 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * workben/test.cxx (MyApp::Main): Display usage () upon -h, --help.
+
+ * workben/refresh: Append "$@" so that refresh --inst FOO works.
+
+ * README: New file.
+
+ * workben/refresh: Softcode outdir. Fixes running on x86_64.
+
+ * workben/makefile.mk (APP1STDLIBS): Softcode layout library name.
+ Fixes linking on x86_64.
+
+ * workben/zoom.cxx: Another <c..> include. Fixes compiling test
+ on x86_64.
+
+2007-10-18 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * .gitignore: Ingore x86_64 output dir too.
+
+ * source/wrapper/wimpl.hxx:
+ * source/core/timeout.cxx:
+ * source/core/deck.cxx:
+ * source/core/byteseq.cxx:
+ * source/core/bin.cxx: Add some <c..> includes.
+
+2007-10-22 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * Remove two empty files.
+
+ * Deleted workben/editor_pre
+ * Deleted workben/output
+
+ * Incorporate http://www.alunos.dcc.fc.up.pt/~c0607045/trash/openoffice/layout.tgz
+
+ * Modified source/core/box.cxx
+ * Modified source/core/table.cxx
+ * Modified source/wrapper/wcontainer.cxx
+ * Modified workben/editor.cxx
+ * Modified workben/flow.xml
+ * Added cenarios
+ * Added source/Documento por Gravar 1
+ * Added source/api/com/sun/star/awt/XLayoutFlow.idl
+ * Added source/api/com/sun/star/awt/XLayoutFlowContainer.idl
+ * Added source/awt/non-interactable-containers.xml
+ * Added source/awt/vclxfactory.cxx
+ * Added source/awt/vclxfiledialog.cxx
+ * Added source/awt/vclxfiledialog.hxx
+ * Added source/awt/vclxline.cxx
+ * Added source/awt/vclxline.hxx
+ * Added source/awt/vclxpane.cxx
+ * Added source/awt/vclxpane.hxx
+ * Added source/awt/vclxradiobutton.cxx
+ * Added source/awt/vclxradiobutton.hxx
+ * Added source/gtk/vclxcommon.cxx
+ * Added source/gtk/vclxcommon.hxx
+ * Added source/gtk/vclxcontainer.cxx
+ * Added source/gtk/vclxcontainer.hxx
+ * Added source/gtk/vclxdialog.cxx
+ * Added source/gtk/vclxdialog.hxx
+ * Added source/gtk/vclxwidget.cxx
+ * Added source/gtk/vclxwidget.hxx
+ * Added workben/adjust.xml
+ * Added workben/editor-normal.xml
+ * Added workben/editor_pre
+ * Added workben/flow-container.xml
+ * Added workben/output
+ * Added workben/test.xml
+
+2007-08-20 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/wimpl.hxx (wrapperGone): fix ordering
+ issue.
+
+ * workben/editor.cxx (PropertiesList::destruct): bin,
+ use virtual destructors.
+
+ * source/core/visualcnt.cxx: set only size, not
+ position too.
+
+2007-08-20 Michael Meeks <michael.meeks@novell.com>
+
+ * merge Ricardo's nice work ...
+
+2007-08-20 Michael Meeks <michael.meeks@novell.com>
+
+ * source/core/box.cxx (getMinimumSize): calculate size
+ correctly wrt. 2x padding.
+
+2007-08-17 Michael Meeks <michael.meeks@novell.com>
+
+ * source/core/helper.cxx (findAndRemove): rename
+ border -> 'has_border' to not conflict with container /
+ widget prop of same name.
+
+ * workben/*.xml: rename all border attributes.
+
+ * source/core/box.hxx: bin bogus mnBorderWidth - use
+ the container instead.
+
+ * source/core/helper.cxx: rename 'border' to
+ 'has_border' so container borders work.
+ (anyFromString): fix type of LONG, add unsigned types &
+ re-order into TypeClass.idl sequence.
+
+ * source/awt/vclxbutton.cxx (IconButton): center
+ labels, somehow setting a graphic changes the behavior
+ of widgets with no align set.
+
+2007-08-16 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/wcontainer.cxx (Clear): get condition
+ right.
+
+ * source/core/container.cxx (setParent): cope with null
+ parents by not throwing.
+
+ * workben/editor.cxx: add Alignment ... and adapt to new
+ property code - so we get container properties.
+
+ * source/core/helper.cxx (setProperties): adapt to new
+ layoutimpl::prophlp helpers.
+ (canHandleProps, queryPropertyInfo, setProperty, getProperty):
+ impl.
+
+2007-08-16 Michael Meeks <michael.meeks@novell.com>
+
+ * source/core/*.cxx: calm down debug.
+
+ * source/core/align.cxx, box.cxx: add PROPHELPER_SET_INFO
+ to the child props too ... (doh).
+
+ * source/core/helper.hxx (PROPHELPER_SET_INFO): impl. this
+ as a macro, comment it heavily.
+ * source/core/container.hxx, box.hxx, align.hxx, bin.hxx: add
+ the macro back cf. 2007-06-07 ...
+
+ * source/core/import.cxx, source/wrapper/wimpl.hxx: calm the
+ churning debug problem down: finally can see the important
+ messages.
+
+ * workben/editor.cxx (EditorDialog): add 'maDelete' member &
+ rename 'engine->mpEngine'
+
+ * source/awt/vclxbutton.cxx (IconButton, VCLXCancelButton),
+ (VCLXHelpButton): impl.
+
+ * source/core/import.cxx (handleCornerCases): bin.
+
+2007-08-16 Michael Meeks <michael.meeks@novell.com>
+
+ * source/awt/vclxproxy.cxx (queryInterface): fixup.
+
+ * source/awt/vclxbutton.cxx: impl OKButton stub.
+
+ * source/awt/vclxproxy.cxx: gut-wrenching manual cut/paste
+ proxy creation: urgh.
+
+ * source/core/import.cxx (handleCornerCases): bin okbutton
+ corner case.
+
+2007-08-15 Michael Meeks <michael.meeks@novell.com>
+
+ * source/core/helper.cxx (setProperties): add debug for
+ dropped properties.
+
+ * source/core/container.cxx (queryInterface, acquire,
+ release): unwind nightmarish UNO lifecycle evil: not
+ implementing acquire/release is a spectacularly bad
+ idea: trashed memory gets accessed by the next queryinterface.
+
+2007-08-15 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/wrapper.cxx (GetPeer): bin debug.
+ (Clear): impl. for Ricardo.
+
+ * workben/editor.cxx (naturalSize): impl. and call post
+ construction, so we size to the total size with the added
+ widgets.
+
+ * source/core/root.hxx: remember to declare we impl.
+ XLayoutConstrains.
+
+ * workben/editor.cxx (getDepth, makeListEntryName): impl.
+ & cleanup code.
+
+ * workben/editor.hxx (class EditorEngine): bin maIdentList.
+
+2007-08-15 Michael Meeks <michael.meeks@novell.com>
+
+ * workben/editor.cxx (PropertyEntry): show the
+ widgets post construction: now appears to work
+ as nicely, if not better than before.
+
+ * source/wrapper/wcontainer.cxx (Container): add
+ warning if no peer to associate with is found.
+ (Container): actually assign mxContainer.
+
+ * source/wrapper/wbutton.cxx (SetImageAlign): impl.
+ SetImageAlign, and use it to align-left the images.
+
+ * workben/test.cxx (InitUCB): enable this.
+ (Main): set more magic environment variables: 'magic'!
+
+2007-08-14 Michael Meeks <michael.meeks@novell.com>
+
+ * workben/test.cxx: attempt to defeat stupid configmgr
+ bootstrapping evilness.
+
+ * workben/test.cxx (UnoBootstrapSucks): log component
+ instantiations, and exception text - caught config mgr.
+ not being happy.
+
+ * source/inc/layoutcore.hxx: impl. - a header for
+ sharing code from core -> wrapper.
+
+ * source/wrapper/wbutton.cxx (ImageImpl): impl.
+ and add SetImageMode method.
+
+ * source/core/helper.cxx (loadGraphic): impl.
+
+ * inc/layout/layout.hxx: add lstbox.h for
+ LISTBOX_ENTRY_NOT_FOUND & fix editor with this.
+
+ * source/core/helper.cxx (createWidget): merge
+ conflicts.
+
+2007-08-09 Michael Meeks <michael.meeks@novell.com>
+
+ * source/awt/vclxtabcontrol.?xx, source/awt/makefile.mk,
+ * utils/makefile.mk: import TabControl.
+
+ * source/core/*.cxx: put in 'layoutimpl' namespace.
+
+ * source/core/import.cxx (WidgetElement): handle
+ corner cases again.
+
+2007-08-09 Michael Meeks <michael.meeks@novell.com>
+
+ * doc/stats.ods: statistics on widget impl. & attribute
+ priorities.
+
+ * source/core/helper.cxx (createWidget): re-enable
+ handleCornerCases.
+
+ * source/core/import.cxx (handleCornerCases):
+ un-comment handle-corner-cases.
+
+2007-08-09 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt>
+
+ * latest work.
+
+2007-07-30 Michael Meeks <michael.meeks@novell.com>
+
+ * doc/vcl.txt: add notes on how fallback awt peer
+ creation happens.
+
+ * doc/awt-props.ods: try to bring some sanity to the
+ cut/paste frenzy in the awt properties.
+
+ * source/core/import.cxx (ToplevelElement): switch back
+ to the new pseudo-'root' 'XLayoutContainer' approach that
+ is cleaner & simpler.
+
+2007-07-30 Michael Meeks <michael.meeks@novell.com>
+
+ * workben/editor.cxx (createWidget): fix variable naming
+ _name -> pName; fix createContainer call signature.
+
+ * source/core/deck.cxx (setVisible): switch to queueRecalc.
+
+ * source/core/root.cxx (getChildren, removeChild): impl.
+
+ * source/core/container.cxx (getSingleChild): impl.
+ helper & upd. callers.
+
+ * Resolve conflicts with Ricardo.
+
+2007-07-26 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt>
+
+ * Added SVLXTabControl that offers XWindow and XLayoutContainer
+ interfaces for the VCL TabControl.
+ But its allocateSize() isn't being called (though sometimes it
+ is), so multi tabs are broken.
+
+ * Touched a bit XLayoutContainer interface: added getChildren()
+ and removeChildren(). And got rid of clearChildren().
+ SPECIFICATION: setParent() must be called on child when added
+ or removed to a container -- in case child implements XChild
+ -- pass null to remove.
+
+2007-07-25 Michael Meeks <michael.meeks@novell.com>
+
+ * notes.txt, doc/metricfield.txt, doc/oldnotes.txt:
+ move some of my cruft out of notes.txt
+
+ * source/core/root.cxx: made LayoutRoot implement
+ XLayoutConstrains and XLayoutContainer (a simple bin).
+
+ * source/core/timeout.cxx: do idle sizing via the
+ toplevel.
+
+ * source/core/import.cxx (~ToplevelElement): simplify
+ toplevel sizing. Tie LayoutRoot to the toplevel window:
+ ok for now.
+
+2007-07-25 Michael Meeks <michael.meeks@novell.com>
+
+ * workben/zoom.xml: update variously.
+
+ * source/core/timeout.cxx: add evil hack using VCL
+ idle handler to layout idly (not that we do re-layout
+ yet).
+
+ * source/core/container.cxx (allocateChildAt): calm
+ down debug spew.
+
+ * source/wrapper: move fields pieces from wrapper.cxx
+ to 'wfields.cxx'.
+
+ * NB. The code now depends on recent toolkit/ changes in
+ HEAD ooo-build.
+
+2007-07-13 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/*.cxx: propagate a Context* pointer
+ through to all wrapper instances; ready to implement
+ OKButton / CancelButton etc.
+
+ * source/wrapper/wbutton.cxx: split from
+ * source/wrapper/wrapper.cxx: here.
+
+ * source/core/import.cxx (handleCornerCases): impl.
+ and call - the ok/help/cancel buttons are -so- lame in
+ awt, we need to emulate them in the wrapper.
+
+2007-07-12 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/wrapper.cxx (GetPeerHandle): switch
+ to just 1 impl, with an optional nId argument too,
+ in case we need it.
+
+ * inc/layout/layout.hxx, source/wrapper/impl.hxx,
+ * source/wrapper/wrap_container.cxx,
+ * source/wrapper/wrapper.cxx: impl. new 'Box'
+ container type, also allow explicit widget
+ instantiation.
+
+ * workben/editor.cxx: re-work to use a sequence of
+ PushButtons instead of create<N> thing.
+
+2007-07-06 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt>
+
+ * a bunch of stuff touched (in special workben/editor.hxx and cxx):
+ Sorry, will try to take better care of the ChangeLog in
+ the future...
+
+ Made a first layout editor. Added temporary calls recalc()
+ and clearChildren() to the XLayoutContainer interface. :P
+ Quite hacky overall; but its already more functional than
+ was targetting for the milestone, and will be cleaning it up...
+
+ Committed part of koehin's patch: the ListBox wrapper.
+
+2007-06-22 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/wrapper.cxx: impl. NumericFormatter -
+ we still need MetricField to implement a (mis-named)
+ XCurrencyField interface though ...
+
+2007-06-22 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/wrapper.cxx (WindowImpl): add
+ get/setProperty helpers.
+ (PushButton::[Is]Check[ed]): impl.
+
+ * source/core/*: some debug calming action.
+
+ * source/wrapper/wrapper.cxx (::Dialog): get toplevel
+ widget correctly.
+ (GetPeerHandle): calm debug.
+
+2007-06-21 Michael Meeks <michael.meeks@novell.com>
+
+ * source/wrapper/wrapper.cxx (Dialog::SetText),
+
+ * source/core/import.cxx (startRootElement): check
+ the namespace & allow non-framewindow toplevels.
+ (WidgetElement): !pParent -> WindowClass_TOP.
+
+ * workben/zoom.xml: add 'group' attributes, hmm. Not
+ working that well for some reaosn.
+
+ * source/wrapper/wrapper.cxx (ButtonImpl::SetClickHdl)
+ don't add the action listener until we need to to preserve
+ VCL's semantics.
+
+2007-06-20 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt>
+
+ * source/core/import.h/cxx: added support for radio groups.
+ As agreed, a group is specified by an id. So, the xml
+ would be: <radio group="pizza" value="margarita" /> ...
+
+2007-06-20 Michael Meeks <michael.meeks@novell.com>
+
+ * source/core/import.cxx (WidgetElement): filter out 'id'
+ property and add into mrRoot.
+
+ * source/core/helper.cxx (setProperties): remove 'id' bits.
+
+2007-06-20 Michael Meeks <michael.meeks@novell.com>
+
+ * source/core/byteseq.cxx: add - gross hack, to go later.
+ * source/core/root.cxx: upd. to use it.
+
+ * workben/test.cxx: move much of the file reading /
+ stream handling evil into the core & initialize via UNO.
+
+ * workben/*: remove LAYOUT_API_TEST conditionals ...
+
+2007-06-20 Michael Meeks <michael.meeks@novell.com>
+
+ * source/core/root.[ch]xx: start of XLayoutRoot impl.
+
+ * source/core/factory.cxx: UNO component registration fun.
+
+ * workben/test.cxx: turn off zoomy bits if
+ LAYOUT_API_TEST is not set.
+
+ * source/wrapper/wrapper.cxx: impl. first cut at
+ wrapping logic; get a few things in order.
+
+2007-06-19 Michael Meeks <michael.meeks@novell.com>
+
+ * source/*: move to source/core/*
+
+ * source/wrapper: add.
+
+ * prj/build.lst: upd.
+
+2007-06-19 Michael Meeks <michael.meeks@novell.com>
+
+ * workben/zoom.[ch]xx: import cut/paste of
+ svx/source/dialog/zoom.[ch]xx - hack out svx dependencies
+ and port to:
+
+ * inc/layout/layout.hxx: new 'layout' wrapper API
+
+2007-06-08 Michael Meeks <michael.meeks@novell.com>
+
+ * source/helper.hxx: move ChildProps
+ * source/helper.hxx: to here, rename to PropHelper,
+ add include guards etc.
+
+ * source/import.?xx: substantial clean up.
+
+ * workben/*.xml: switch namespace
+
+2007-06-07 Michael Meeks <michael.meeks@novell.com>
+
+ * source/container.cxx: remove static singleton setting
+ 'getPropertSetInfo' method, and make it abstract.
+ * source/bin.cxx, source/box.cxx: implement here, so we
+ get different SetInfo for each.
+
+ * source/vbox.cxx (convertFastPropertyValue): impl. properly.
+
+ * source/import.cxx (ChildElement::startChildElement): pass
+ the right child attributes.
+ (addChildWidget): actually set properties on the container's
+ child not the widget itself.
+
+2007-06-06 Michael Meeks <michael.meeks@novell.com>
+
+ * source/makefile.mk,
+ * source/import.cxx: rename from newimport.cxx
+
+ * source/newimport.cxx (getPropAsInt): bin, obsolete.
+ (addChildWidget): add setProperties call for child props.
+ (windowResized): do size request before allocate.
+
+2007-06-06 Michael Meeks <michael.meeks@novell.com>
+
+ * source/newimport.cxx (getAttributeProps): re-factor & split.
+ (findAndRemove): this.
+
+ * source/helper.cxx (setProperties, toUnoNaming, anyFromString):
+ split from newimport.cxx.
+
+ * source/newimport.cxx (~ToplevelElement): add, so we
+ show the dialog post sizing.
+
+ * workben/*.xml: remove 'show' attribute on toplevels.
+
+2007-06-06 Michael Meeks <michael.meeks@novell.com>
+
+ * source/newimport.cxx: add hacks (missing Ricardo's
+ hierarchy parsing), to whack all children in 1 hbox.
+ We have layout at last.
+
+ * source/vbox.cxx (allocateChildAt): get PosSize flags right.
+
+ * source/newimport.cxx (startRootElement): upd.
+ (ResizeListener): impl.
+
+ * source/newimport.hxx (class ToplevelElement): add.
+
+2007-06-05 Michael Meeks <michael.meeks@novell.com>
+
+ * workben/layout.xml: add nested vbox.
+
+ * workben/layout-flat.xml: flat xml
+
+ * start a ChangeLog
+
diff --git a/toolkit/doc/layout/README b/toolkit/doc/layout/README
new file mode 100644
index 000000000000..d7ced3891273
--- /dev/null
+++ b/toolkit/doc/layout/README
@@ -0,0 +1,24 @@
+Layout engine for OpenOffice.org - Work in Progress
+
+Simple dialogs have been ported now: zoom and wordcount.
+
+New code lives in "layoutdialogs" CWS or ooo-build trunk.
+
+* Checkout layoutdialogs cws.
+
+* Configure using --enable-layout.
+
+* [d]make all
+
+* [d]make install DESTDIR=$(pwd)/ooo-layout/
+
+Integration into OOo:
+
+* After instaling, run
+
+ cd ooo-cvs/program
+ ./soffice.bin
+
+ Start a [Writer] document and choose View/Zoom or Extra/Word count.
+
+* Also See workben/layout/README. \ No newline at end of file
diff --git a/toolkit/doc/layout/TODO b/toolkit/doc/layout/TODO
new file mode 100644
index 000000000000..fdffa7fad5aa
--- /dev/null
+++ b/toolkit/doc/layout/TODO
@@ -0,0 +1,227 @@
+-*-outline-*-
+
+* CWS
+** Move everything & development into new layout-dialogs CWS
+
+** cleanups
+*** Add XRadioButton2 and layout::VCLXRadioButton with
+ {get,set}RadioGroup. Remove import.cxx RadioGroups::RadioGroup,
+ VCLXRadioButton::getFirstActionListener () and [actionListener
+ juggling in] layout::RadioButton_impl::SetClickHdl() and
+ EnableRadioCheck() layout::RadioButton_impl::Check.
+*** layout/import.hxx: what's this generator stuff?
+#if 0
+// generator
+class Widget
+*** root.hxx:
+/*
+ TODO: (ricardo) I think we should cut on LayoutRoot, stripping out its widget
+ proxy interface (just make it return the root widget).
+
+*** root.cxx:
+LayoutWidget::~LayoutWidget()
+{
+ /* should we dispose of the references...? */
+ // at least of its children... Or should root?
+*** root.cxx:
+LayoutRoot::~LayoutRoot()
+{
+// TODO: we want to delete the top level LayoutWidget...
+
+
+* portability
+** --enable-layout does not compile on Sun?
+[SunStudio12 on Linux works...]
+
+TODO: Try not including layout-pre.hxx twice, but use
+layout-pre-header.hxx and layout-pre-source.hxx (both include an
+un-multiple-inclusion-shielded layout-pre.hxx).
+
+"/export/home/fstrba/devel-cvs/ooo-build/build/ooh680-m1/layout/workben/zoom.cxx", line 412: Error: layout is not a member of layout.
+"/export/home/fstrba/devel-cvs/ooo-build/build/ooh680-m1/layout/workben/zoom.cxx", line 412: Error: Formal argument 1 of type layout::RadioButton* in call to SvxZoomDialog::UserHdl(layout::RadioButton*) is being passed RadioButton*.
+"/export/home/fstrba/devel-cvs/ooo-build/build/ooh680-m1/layout/workben/zoom.cxx", line 431: Error: layout is not a member of layout.
+"/export/home/fstrba/devel-cvs/ooo-build/build/ooh680-m1/layout/workben/zoom.cxx", line 431: Error: Formal argument 1 of type layout::MetricField* in call to SvxZoomDialog::SpinHdl(layout::MetricField*) is being passed MetricField*.
+"/export/home/fstrba/devel-cvs/ooo-build/build/ooh680-m1/layout/workben/zoom.cxx", line 441: Error: layout is not a member of layout.
+"/export/home/fstrba/devel-cvs/ooo-build/build/ooh680-m1/layout/workben/zoom.cxx", line 441: Error: Formal argument 1 of type layout::Button* in call to SvxZoomDialog::OKHdl(layout::Button*) is being passed Button*.
+6 Error(s) detected.
+
+ #412
+ ( ( layout :: layout :: RadioButton * ) pCaller ) ; } long SvxZoomDialog :: UserHdl ( layout :: RadioButton * pBtn )
+ {
+ fprintf ( ( & __iob [ 2 ] ) , "SvxZoomDialog::UserHdl\n" ) ;
+ bModified |= 1 ;
+ if ( pBtn == & aUserBtn )
+ {
+ aUserEdit . Enable ( ) ;
+ aUserEdit . GrabFocus ( ) ;
+ }
+ else
+ aUserEdit . Disable ( ) ;
+ return 0 ;
+ }
+
+** LayoutDialogs compilation errors on Windows
+in VCL headers there, need to include more headers to also get stuff like HWND defined.
+
+* code
+** features
+*** Symbols on MoreButton/AdvancedButton?
+
+*** support more widgets (as necessary)
+**** see toolkit/source/awt/vclxtoolkit.cxx and svtools/source/uno/unoiface.cxx
+**** SubDialog
+**** Pull-down menu
+**** embed custom widget
+**** embed old .src TAB
+**** have a LAYOUT TAB be embedded in an old .src dialog
+**** FileControl?
+**** roadmap?
+**** datefield?
+**** patternfield?
+**** patternbox?
+**** dockingarea?
+**** errorbox?
+**** groupbox?
+**** menubutton?
+**** messbox?
+**** simpleanimation?
+
+*** support cnt:cnt:?
+*** support using label (verb) on yes/ok no/cancel buttons for some platforms
+but keep using yes/no on Windows, eg?
+*** remove -DTEST_LAYOUT=1 from util/makefile.mk?
+
+** fixes
+*** missing properties
+ 'title' -> 'Set Zoom'
+Missing prop Title
+Missing prop ValueStep
+Missing prop Radiogroup
+Missing prop Default
+*** bug in wordcountdialog: right alignment of numbers `jump' when resizing
+ the dialog. the 0 and 00 are never exactly aligned.
+*** look into code duplication: source/core/*.
+*** Remove magic constants
+fHorAlign = fVerAlign = 0.5; --> float const [CENTER?] = 0.5;
+
+** include full translations
+*** zoom
+grep zoom.src svx/source/dialog/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "janneke\\vc\\layout-cws\\toolkit\\workben\\layout\\zoom.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SVXDLG_ZOOM_title/'
+*** wordcount
+grep wordcountdialog.src sw/source/ui/dialog/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "janneke\\vc\\layout-cws\\toolkit\\workben\\layout\\workben.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/FL_\([A-Z]*\)_label/FL_\1_text/' -e 's/\t_label/\tDLG_WORDCOUNT_title/'s
+*** sortdlg
+grep sortdlg.src ../../../sc/source/ui/src/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "janneke\\vc\\layout-cws\\toolkit\\workben\\layout\\sort-options.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_SORT_title/' | grep -E ' (nl|de|en-US) ' > localize-str.sdf
+grep sortdlg.src sc/source/ui/src/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\sort-options.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_SORT_title/' > sc/uiconfig/layout/localize-sort-options.sdf
+*** insert-sheet
+grep instbdlg.src sc/source/ui/miscdlgs/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\insert-sheet.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_INSERT_TABLE_title/' > sc/uiconfig/layout/localize-insert-sheet.sdf
+*** move-copy-sheet
+grep -E 'miscdlgs.src.*(FT_DEST|FT_INSERT|STR_NEWDOC|RID_SCDLG_MOVETAB|BTN_COPY)' sc/source/ui/src/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\move-copy-sheet.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_MOVETAB_title/' > sc/uiconfig/layout/localize-move-copy-sheet.sdf
+*** find-and-replace
+grep srchdlg.src svx/source/dialog/localize.sdf | awk -F'\t' '{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "svx\\uiconfig\\layout\\find-and-replace.xml", $3, "layout", $6 "_label", "", "", $8, "0", $10, $11, $12, "", $14, $15}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SVXDLG_SEARCH_title/' > svx/uiconfig/layout/localize-find-and-replace.sdf
+
+* i18n
+ + forget java property files nonsense
+ - dump old wiki pointers into layout/doc for reference
+ + share code with vcl/source/gdi/impimagetree.cxx
+ + 'layout.zip'?
+ + support multiple translatable attributes
+ + ? rewrite tralay from scratch (in python, perl, c++?) ?
+
+
+* distributing: [LayoutDialogs]
+git diff 5db78fc5 layout scp2 > layout-dialogs-layout.diff
+git diff 5db78fc5 |grep -v gitignore | grep 'git a'|grep -Ev 'a/(layout|scp2)/'|sed -e's@.*git a/@@' -e 's@/.*@@' | sort -u | tr '\n' ' '
+git diff 5db78fc5 $(git diff 5db78fc5 |grep -v gitignore | grep 'git a'| grep -Ev 'a/(layout|scp2)/' | sed -e's@.*git a/@@' -e 's@/.*@@' | sort -u | tr '\n' ' ') > layout-dialogs.diff
+
+Soo...
+
+m237: fc105178
+
+#git diff offapi toolkit > layout-dialogs-offapi-toolkit.diff
+
+git diff fc105178 layout | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-layout.diff
+git diff fc105178 config_office scp2 | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-config_office-scp2.diff
+git diff fc105178 svx sw | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-svx-sw.diff
+
+m241: 5e9b2546
+m241': b8e24264
+m241'': 53ddc663
+m1: fbde8234
+m1': d1f42c99
+m1'': 1a8dec5c
+m1'''': c93389f7
+
+* porting
+** Zoom dialog
+*** list of radio buttons indented: workben/zoom-indent.xml ?
+** Word Count dialog
+** Recover dialog (redesign)
+** pivotfilter dialog (Kohei?)
+** paragraph dialog
+
+
+TODO
+
+
+* play with / improve Ricardo's editor
+** broken after new uno registration
+
+ it barfs on
+
+ void selectedWidget( Widget *pWidget )
+ {
+ clear();
+
+ it looks like a window is deleted twice.
+
+** this is not meant to be a production level tool, but still,
+ it can be improved I think :-)
+
+* improve Kohei's converter (poke him on IRC (afternoons) about this)
+
+** current hack: workben/run-s2x
+
+ . Imported into layout
+
+ + Kohei wrote the start of a nice script to convert ugly,
+ obsolete resource files to nice new XML files ;-)
+ + unfortunately it is buggy.
+ + see ooo-build/scratch/layout-src2xml/*
+ + we should move this into the git repo.
+ + bug to fix: case problems in XML
+ + XML produced has wrong case items, and names are
+ different to those we (and AWT) expects ->
+ de-stdlycapsise
+ + cf. layout/source/core/helper.cxx:
+ toUnoNaming, anyFromString
+ setProperties
+ + NB. we want to have nice 'clean' looking non-stdlycaps XML
+ + also toolkit/source/awt/vclxwindows.cxx /ImplGetPropertyIds/
+ + also toolkit/source/helper/property.cxx
+ + bug to fix: property name problems
+ + often the resource name strings (cf. legacy resource
+ compiler in rsc/) don't match the awt toolkit properties
+ + ie. need to map Label="foo" to Text="foo" (or whatever).
+
+* OLD notes
+
++ Before OOoCon
+ + editor polish
+ + cut / paste
+ + export xml
+ + "import .src"
+ [ use native VCL menus ... ]
+ + dialogs:
+ + porting 'Format' dialog.
+ + wrapper code - improving ...
+ + XML fixes
+ + "load" command for shared fragments
+ + slides:
+ + UNO object hierarchy for a given window ...
+
++ Later
+ + dual-compile code under VCL & 'layout' and compare
+ event ordering (eg.).
+ + test-tool
+ + scrolled-pane impl.
+
diff --git a/toolkit/doc/layout/apinotes.txt b/toolkit/doc/layout/apinotes.txt
new file mode 100644
index 000000000000..dc5a8cfcd6d1
--- /dev/null
+++ b/toolkit/doc/layout/apinotes.txt
@@ -0,0 +1,76 @@
+Notes on API wrapper pieces ...
+
+SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) :
+ Dialog( pParent, SVX_RES( RID_SVXDLG_ZOOM ) ),
+
+What do we do ?
+ + lots of potential VCL/Svx/Sfx etc. top-levels ...
+
+ + Create the window & the 1st member: 'FooHandle' ?
+ + Multiply inherited ?
+ + object from where ?
+
+ + Default:
+ + a pseudo-Dialog / wrapper ...
+ + load using layout (etc.)
+ + register an SID table ?
+ + necessary ?
+ + SIDs ? - post it ...
+
+
+ + [ Otherwise ... hook up via a helper /
+ constructor member ... ]
+
+* Fixed:
+ + OKButton / CancelButton
+ + don't chain to PushButton::Click
+ + if there is no ClickHdl set ... [ !urgh! ...]
+
+ * FIXME:
+ other widgets ...
+ * How do we cope ? *
+ ....
+ + priorities ? Layout ?
+ + de-coupling ?
+ + native widgets ?
+ + hmm...
+ + custom widgets ?
+ + 'OKButton' ... (?) :-)
+ + 'CancelButton'
+ + 'HelpButton' ...
+ + a VCL hack ...
+ + create an 'addLayout()' method ?
+ + [ like cl's ? ]
+ + implement this ...
+
+** Lifecycle ?
+ + how do we track the 'Impl'
+ vs. the pImpl vs. (etc.)
+ + held by mutual references ?
+
+ + pointer to the widget itself passed in ?
+ + MI ?
+ + when the widget dies - just NULL the
+ listener's back-ptr ?
+
+ + Locking [!?] - how / why / what / who ?
+ + urgh ...
+ + threading bits ...
+
+ + SID table (?) ...
+ + [ necessary ? - just use the SID name as the XML attr ? ]
+ + LAYOUT_ID(a) -> "#a" - stringified ...
+
+** FIXME:
+ + we need a decent MetricField implementation
+ + it is more than a SpinField
+ + need to move the 'Border' property down (etc.)
+ + re-arrange the properties to be next to the impls.
+ in awt ...
+
+ + fix the
+
+XCurrencyField (huh)
+ needs implementing for VCLXMetricField (non-existent) ...
+ copy the code from XCurrencyField ? make a sub-class there ?
+
diff --git a/toolkit/doc/layout/metricfield.txt b/toolkit/doc/layout/metricfield.txt
new file mode 100644
index 000000000000..21ebe4b50459
--- /dev/null
+++ b/toolkit/doc/layout/metricfield.txt
@@ -0,0 +1,57 @@
+** MetricField:
+ + in vcl:
+class VCL_DLLPUBLIC CurrencyField : public SpinField, public CurrencyFormatter
+class VCL_DLLPUBLIC CurrencyFormatter : public NumericFormatter
+class VCL_DLLPUBLIC MetricFormatter : public NumericFormatter
+class VCL_DLLPUBLIC NumericFormatter : public FormatterBase
+
+MetricFormatter - very simple sal_Int64 wrapping ...
+ + no doubles ...
+ + *Could* replicate this with the same interface:
+ + prolly easier / better to add an XMetricField interface.
+
+vcl's MetricField - itself does a load of (double) casting ...
+ + to get the value it wants :-)
+ + Urgh ! ...
+
+** Can we just twist VCLXCurrencyField to this purpose ?
+ + what differences would we want ?
+ + LongCurrencyFormatter -> 'MetricFormatter' ...
+
+** Interesting !
+ + VCLXCurrencyField is based on 'LongCurrencyField' not CurrencyField ...
+ + this is really based on 'BigInt' [ curious ] - so even more precision loss.
+
+ + So ... cut/paste VCLXCurencyField -> VCLXMetricField
+
+ + Look at 'VCLXNumericField' interface ...
+ + Use 'XNumericField' instead (?)
+ + why does this just not "just work" ?
+
+ + The 'MetricField' (is also a MetricFormatter)
+ + MetricFormatter [ unusually ] has 'Unit' support
+ + API grep shows:
+ + a) requires 'fieldunit'
+ + b) has "UserValue"
+ + c) => new IDL interface required ...
+ + sub-set / expand NumericField ?
+
+ + add 'CustomConvert' ?
+ + add '[SG]etFirst'/Last
+ + Properties:
+ + 'Unit'
+ + 'CustomUnitText'
+ + 'spin-size' -> 'value-step'
+ + 'BaseValue' ...
+ + sal_Int64 ... [!?] ...
+ + CorrectedValue
+ + Want properties for the UI designer (?)
+ + move that stuff out into there ?
+ + FIXME:
+ + rationalise the 'Modify' event crud ...
+ + share the code in a base-class ...
+
+ + Wrapper:
+ + need to have static methods 'ConvertDoubleValue' etc.
+ + also 'ConvertValue' etc.
+ + GetCorrectedValue - never used ...
diff --git a/toolkit/doc/layout/notes.txt b/toolkit/doc/layout/notes.txt
new file mode 100644
index 000000000000..63bb16487a31
--- /dev/null
+++ b/toolkit/doc/layout/notes.txt
@@ -0,0 +1,117 @@
+--- How layout / hierarchy should work ---
+
+On-screen:
+
++-------------------+
+| Label: [Entry] |
+| - - - - - - - - - | |
+| [ Ok ]|
++-------------------+
+
+AWT Window hierarcy:
+ Window
+ + Label
+ + Entry
+ + Ok
+
+ ie. unchanged, and backwards compatible - a flat
+representation.
+
+Toolkit Hierachy
+
+ WindowContainer [Bin?]
+ + Vbox
+ + HBox
+ + Label
+ + Entry
+ + Alignment
+ + Ok
+
+ the layout process would happen inside the toolkit code
+(perhaps eventually genericisd itself), and the result from the
+(re-)layout process would be a set of SetPosition/SetSize calls made
+to VCL.
+
+--- code pointers ---
+
+** AWT interfaces:
+ + offapi/com/sun/star/awt/* - eg. XButton.idl
+ + 'XLayoutConstrains.idl' [ published & mis-named ! ]
+
+ + We can build 'Layout' into the AWT at the toolkit level
+ + this should be fairly easy, and wouldn't touch VCL much.
+
+** Toolkit (awt) implementation:
+ + toolkit/source/awt/vclxwindows.cxx:
+ + much of the implementation lurks in here ...
+ + The size information is in 'vclxwindows.cxx' ...
+
+ + toolkit/source/helper/unowrapper.cxx
+ + factories / code to associate UNO peers with VCL windows
+ + pWindow->
+
+--- Tests ---
+
+Integration tests:
+ cf. http://www.openoffice.org/issues/show_bug.cgi?id=78747
+
+
+--- more thoughts ---
+
+** Extra Design constraints: [!?]
+ + accessibility
+ + QA test-tool-age ... - tests ~will need re-write (unfortunately)
+
+* New functionality we would like:
+ + ShowAll (vs. Show/Hide) && HideAll ...
+
+Necessary to re- build && deliver svtools/ having delivered toolkit ...
+ rm unxlngi6.pro/slo/textwindowaccessibility.* # first ...
+
+** Layout containers:
+ + XIndexAccess ? - sorted container (?)
+
+* Consider 'XLayoutRoot' top-level ...
+ + inherit from XNameContainer - widgets by name / id ...
+ + hack a VCL dialog ?
+ + we need a handle we can pass back of some form:
+ + XWindowPeer getPeer() ... [ can use that I guess ? ]
+ + also need a service interface ?
+ + or parameters passed as Anys ? [ugh]
+
+* Decided
+ + use 'layout' by itself & small patches
+ to toolkit/ in ooo-build.
+
+* TODO:
+ + need a 'queueResize' method ...
+ + trigger on show/hide ...
+ + allocateSize should take an awt::Rectangle ...
+ + impl. XLayoutRoot
+ + special cases:
+ + radio-button-group
+ + notebook
+
+* svx/source/dialog/zoom*
+
+Michael's Todo:
+ + handle MetricField: 'unit' enum etc. - introspection ? or ...
+ + make OK/Cancel buttons function as they should ...
+ + merge layout-svtools.diff into CWS as last step before inclusion ...
+ + FixedLine:
+ + get sizing right ...
+ + hook up new virtual methods into toolkit/ (m225) - i#80754
+ + copy the crud from toolkit's custom vclxwindows.cxx
+ "calcMinimumSize" logic ...
+ + get ok/help/cancel buttons working ...
+
+ + fix / rationalise property adding in toolkit ...
+ + simplify it with the new VCLWindow base :-)
+ + simplify it ...
+ + spreadsheet ...
+ + VCLXImageConsumer - can't be instantiated itself
+ anyway ! -> bin the 'true' & just add all these
+ props unconditionally ...
+
+ + switch construction attributes into their own xmlns to
+ avoid treading on other properties ...
diff --git a/toolkit/doc/layout/oldnotes.txt b/toolkit/doc/layout/oldnotes.txt
new file mode 100644
index 000000000000..a5cb94963da0
--- /dev/null
+++ b/toolkit/doc/layout/oldnotes.txt
@@ -0,0 +1,224 @@
+* Obsolete notes ...
+
+** Form XML format:
+
+ + from the basic editor:
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Dialog1" dlg:left="204" dlg:top="148" dlg:width="136" dlg:height="115" dlg:closeable="true" dlg:moveable="true">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="OkButtonName" dlg:tab-index="0" dlg:left="86" dlg:top="92" dlg:width="44" dlg:height="19" dlg:value="OkButtonLabel"/>
+ <dlg:titledbox dlg:id="FrameControl1" dlg:tab-index="1" dlg:left="4" dlg:top="7" dlg:width="68" dlg:height="41">
+ <dlg:title dlg:value="FrameControl1"/>
+ </dlg:titledbox>
+ <dlg:scrollbar dlg:id="ScrollBar1" dlg:tab-index="2" dlg:left="82" dlg:top="10" dlg:width="45" dlg:height="24"/>
+ <dlg:scrollbar dlg:id="ScrollBar2" dlg:tab-index="3" dlg:left="107" dlg:top="43" dlg:width="21" dlg:height="37" dlg:align="vertical"/>
+ <dlg:timefield dlg:id="TimeField1" dlg:tab-index="4" dlg:left="4" dlg:top="92" dlg:width="28" dlg:height="19"/>
+ <dlg:text dlg:id="Label1" dlg:tab-index="5" dlg:left="22" dlg:top="61" dlg:width="44" dlg:height="15" dlg:value="Label1"/>
+ </dlg:bulletinboard>
+</dlg:window>
+
+ + code to read this & generate UIs is in:
+ + DTD: xmlscript/dtd/dialog.dtd
+ + xmlscript/source/xmldlg_imexp/imp_share.hxx, line 674
+ + xmlscript/source/misc/unoservices.cxx
+ xmlscript/source/xmlflat_imexp/xmlbas_import.cxx (?)
+ "com.sun.star.comp.xmlscript.XMLBasicImporter"
+ + the dialog piece seems separate ?
+ "importDialogModel" ...
+ + cf. the interesting test code ...
+ + cd xmlscript/test
+ dmake
+ ../unxlngi6.pro/bin/imexp /opt/OOInstall ./test.xml
+ + generates & renders a dialog ...
+
+ + This code has ~all we need to get a simple impl.
+ + compatibility wrappers [!]
+
+ // first create model:
+ Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), xContext ), UNO_QUERY );
+ // NB. xmldlg_addfunc.cxx not xmldlg_import.cxx [!?] ;-)
+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ),
+ xModel, xContext );
+
+ // second create view of model:
+ Reference< awt::XControl > xDlg( xMSF->createInstance(
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialog" ) ) ), UNO_QUERY );
+ xDlg->setModel( Reference< awt::XControlModel >::query( xModel ) );
+
+ // third - associate toolkit / peer ...
+ Reference< awt::XToolkit> xToolkit( xMSF->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.ExtToolkit" ) ) ), UNO_QUERY );
+ xDlg->createPeer( xToolkit, 0 );
+
+ // fourth - execute [ nasty ... ]
+ Reference< awt::XDialog > xD( xDlg, UNO_QUERY );
+ xD->execute();
+
+
+** Basic dialog editor:
+
+ + basctl/source/dlged/dlged.cxx
+ + dialog editor (?)
+ + basctl/source/basicide/basobj3.cxx
+ + basctl/source/basicide/basides3.cxx
+ + BasicIDEShell:CreateDlgWin ...
+
+
+** FIXME:
+ + createPeer - when called is always passed
+ the toplevel [ it seems ... ]
+ + we need to pass a container instead ...
+ + or have some separate hint / method ?
+ + or call the 'setChild' inside the model
+ construction bits ? [!?]
+
+UnoControlContainer::addingControl:
+ + only caller to 'setContext'
+ + sets the 'Parent' for peers ...
+
+Dialog is an UnoControlContainer ...
+ + hmm ...
+ + 'XControlContainer'
+ + perhaps just what we need ... [!]
+ + our VBox should be one ...
+
+ + Other things: tab widgets are 'UnoControlContainers' ...
+ + finally remembered: xml foo ...
+ +
+
+
+ + FIXME: it -seems- that we don't store
+ much hierarchy in the model [ any ? ]
+ + UnoControlModel -> ?
+
+ + UnoControlDialogModel - has an XNameContainer ...
+ + but ... only the UnoControl-Dialog-Model has this ...
+
+
+ + Wow - even the percieved hierarchy:
+ + 'exportDialogModel'
+ + achieved by 'getElementNames'
+ -> flat set of names ... [urgh]
+
+ + So - we need to add more structure:
+ + XNameContainers ...
+ + that we insert into [!?]
+ + we also need to retain order for packing.
+
+ + need a list of sillies to reverse / revert (?) ...
+
+ + back-compat:
+ + kill bogus nesting eg. radiogroup ...
+ [ have a group/tag instead - or hierarchical names ? ]
+ + ditto for 'titledbox' ...
+ + menulists - seem rather unrelated / bogus anyway.
+ + Add into toplevel & child ...
+
+ + copy Dialog bits into unocontrolcontainer.cxx ...
+ + re-using unocontrolcontainer ...
+
+
+** FIXME:
+ + we need property introspection on the awt widgets:
+ + but they have no property interfaces [!] -
+ interestingly the UnoControl's don't either
+ only the UnoControlModel foo ...
+ + unocontrols.cxx:
+ Uno
+ + source/helper/property.cxx
+ + has all the type information ...
+ + but no information on what properties are
+ valid for a type ... - implicit in the UnoControlModel's
+ code ...
+ + ImplGetPropertyInfos ...
+
+ + add to vclxwindow.cxx:
+ + inc/toolkit/helper/property.hxx
+ + 'getProperties' static ...
+
+** It seems that things like UnoControlComboBoxModel are missing
+ some derived properties: EchoChar (etc.)
+ UnoControlDateFieldModel - missing ... EchoChar too (?) - deliberate ?
+ + query these ... [!?]
+
+layout container - start child 'combobox'
+ missing property 46 (EchoChar)
+ missing property 48 (HardLineBreaks)
+ missing property 12 (HScroll)
+ missing property 104 (LineEndFormat)
+ missing property 10 (MultiLine)
+ missing property 13 (VScroll)
+
+ + add regression test:
+ + count number of properties ...
+
+
+TODO:
+ add 'XPropertySetInfo' to VCLXWindow:
+ + trivial to implement :-)
+ + hook it to Ricardo's parser ... [!] :-)
+
+* xmlscript
+ + xmldlg_import.cxx -
+ + xml_helper/xml_impctx.cxx - foo ...
+
+
+* plan:
+ + hard-code container hooks into the xmlscript/ parser ...
+ + create a layout object in toolkit/
+ + populate it with good things ...
+
+ + coupling to toolkit - widget instantiation: how ...
+ + ComponentInfos
+ + vclxtoolkit.cxx:
+ + has a 'hook function' for 'fnSvtCreateWindow'
+ for SVT widgets :-) [ grotesque ;-]
+ + [ wow - fetched by dlopen! ;-]
+
+ + A little app - a-la solver: using awt (?)
+ + XMessageBoxFactory ...
+ + XToolkit:
+ + CreateWindow ...
+ + ** how does the xml code generate these guys ? **
+
+ + what APIs does the xmlimporter use ? not 'createWindow' seemingly.
+
++ existing xml import uses: property bag a -lot-:
+ Reference< beans::XPropertySet > xProps(
+ _pImport->_xDialogModel, UNO_QUERY_THROW );
+ * we do _xDialogModel->insertByName (new any<XControlModel>())
+ + to build hierarchy ( cf. ~ControlImportContext )
+
+ DialogImport:
+ css::uno::Reference< css::container::XNameContainer > _xDialogModel;
+
+ Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), xContext ), UNO_QUERY );
+
+ toolkit/source/controls/dialogcontrol.cxx
+ + UnoControlButtonModel (eg.)
+ + service 'UnoControlModel' ...
+
+ + poke at 'titledbox' or 'radiogroup' to see how containment works there ...
+ + how will child widget properties work ?
+ + bug with a 'vbox' inside a 'titledbox' ...
+ + titledbox - acts as a container (interesting)
+ - offsetting child positions
+ + how will pseudo-containers eg. "radiogroup" cope ?
+
+ + propose new syntax: [ with child properties a-la glade ]:
+
+ <hbox id="baa" flange="true">
+ <child padding="0" expand="false" fill="false">
+ <radio id="foo" value="..."/>
+ </child>
+ <radio id="foo" value="..."/>
+ </hbox>
+
+ + if 'child' element omitted - default properties used ...
+ + if multiple elements in same 'child' set: all have the same props.
+
+
diff --git a/toolkit/doc/layout/vcl.txt b/toolkit/doc/layout/vcl.txt
new file mode 100644
index 000000000000..dbafbc5b148d
--- /dev/null
+++ b/toolkit/doc/layout/vcl.txt
@@ -0,0 +1,20 @@
+* How do very basic vcl widgets get peers:
+
+ + toolkit/awt/ VCLXToolkit::ImplCreateWindow
+ + calls GetComponentInterface (sal_True) - if no comp. iface.
+
+ + vcl's Window:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( BOOL bCreate = TRUE );
+
+ + vcl/inc/vcl/unowrap.hxx:
+ // Window
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> GetWindowInterface( Window* pWindow, sal_Bool bCreate ) = 0;
+ virtual void SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xIFace ) = 0;
+
+ + from svapp.cxx Application::SetUnoWrapper
+ -> toolkit/awt 'ToolkitWorkerFunction' ( extern C / dlopen linkage )
+
+ + from toolkit/source/helper/unowrapper.cxx:
+ -> CreateXWindow -> 'return new VCLXWindow'
+ ** FIXME: we need love in here too:
+ + METRICBOX eg. \ No newline at end of file
diff --git a/toolkit/inc/layout/layout-post.hxx b/toolkit/inc/layout/layout-post.hxx
new file mode 100644
index 000000000000..8ef66bf04470
--- /dev/null
+++ b/toolkit/inc/layout/layout-post.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 _LAYOUT_POST_HXX
+#define _LAYOUT_POST_HXX
+
+#if ENABLE_LAYOUT
+
+/* Allow re-inclusion for cxx file. */
+#undef _LAYOUT_PRE_HXX
+
+
+#undef AdvancedButton
+#undef ApplyButton
+#undef Box
+#undef Button
+#undef CancelButton
+#undef CheckBox
+#undef ComboBox
+#undef Container
+#undef Control
+#undef Dialog
+#undef Edit
+#undef ErrorBox
+#undef FixedImage
+#undef FixedInfo
+#undef FixedLine
+#undef FixedText
+#undef HBox
+#undef HelpButton
+#undef IgnoreButton
+#undef ImageButton
+#undef InfoBox
+#undef ListBox
+#undef MessBox
+#undef MessageBox
+#undef MetricField
+#undef MetricFormatter
+#undef MoreButton
+#undef MultiLineEdit
+#undef MultiListBox
+#undef NoButton
+#undef NumericField
+#undef NumericFormatter
+#undef OKButton
+#undef Plugin
+#undef ProgressBar
+#undef PushButton
+#undef QueryBox
+#undef RadioButton
+#undef ResetButton
+#undef RetryButton
+#undef SfxTabPage
+#undef SfxTabDialog
+#undef SpinField
+#undef TabDialog
+#undef TabControl
+#undef TabPage
+#undef Table
+#undef VBox
+#undef WarningBox
+#undef YesButton
+
+#undef SvxFontListBox
+#undef SvxLanguageBox
+
+#undef ModalDialog
+#undef ModelessDialog
+#undef ScExpandedFixedText
+#undef SfxDialog
+#undef SfxModalDialog
+#undef SfxModelessDialog
+
+#undef Window
+
+#endif /* ENABLE_LAYOUT */
+
+#endif /* _LAYOUT_POST_HXX */
diff --git a/toolkit/inc/layout/layout-pre.hxx b/toolkit/inc/layout/layout-pre.hxx
new file mode 100644
index 000000000000..09605ad440d5
--- /dev/null
+++ b/toolkit/inc/layout/layout-pre.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 _LAYOUT_PRE_HXX
+#define _LAYOUT_PRE_HXX
+
+#if ENABLE_LAYOUT
+
+///* Allow re-inclusion for next hxx file. */
+#undef _LAYOUT_POST_HXX
+
+#define AdvancedButton layout::AdvancedButton
+#define ApplyButton layout::ApplyButton
+#define Box layout::Box
+#define Button layout::Button
+#define CancelButton layout::CancelButton
+#define CheckBox layout::CheckBox
+#define ComboBox layout::ComboBox
+#define Container layout::Container
+#define Control layout::Control
+#define Dialog layout::Dialog
+#define Edit layout::Edit
+#define ErrorBox layout::ErrorBox
+#define FixedImage layout::FixedImage
+#define FixedInfo layout::FixedInfo
+#define FixedLine layout::FixedLine
+#define FixedText layout::FixedText
+#define HBox layout::HBox
+#define HelpButton layout::HelpButton
+#define IgnoreButton layout::IgnoreButton
+#define ImageButton layout::ImageButton
+#define InfoBox layout::InfoBox
+#define LocalizedString layout::LocalizedString
+#define ListBox layout::ListBox
+#define MessBox layout::MessBox
+#define MessageBox layout::MessageBox
+#define MetricField layout::MetricField
+#define MetricFormatter layout::MetricFormatter
+#define MoreButton layout::MoreButton
+#define MultiLineEdit layout::MultiLineEdit
+#define MultiListBox layout::MultiListBox
+#define NoButton layout::NoButton
+#define NumericField layout::NumericField
+#define NumericFormatter layout::NumericFormatter
+#define OKButton layout::OKButton
+#define Plugin layout::Plugin
+#define ProgressBar layout::ProgressBar
+#define PushButton layout::PushButton
+#define QueryBox layout::QueryBox
+#define RadioButton layout::RadioButton
+#define ResetButton layout::ResetButton
+#define RetryButton layout::RetryButton
+#define SfxTabDialog layout::SfxTabDialog
+#define SfxTabPage layout::SfxTabPage
+#if ENABLE_LAYOUT
+#define SvxFontListBox layout::SvxFontListBox
+#define SvxLanguageBox layout::SvxLanguageBox
+#endif
+#define SpinField layout::SpinField
+#define TabControl layout::TabControl
+#define TabPage layout::TabPage
+#define Table layout::Table
+#define VBox layout::VBox
+#define WarningBox layout::WarningBox
+#define YesButton layout::YesButton
+
+#define ModalDialog Dialog
+#define ModelessDialog Dialog
+#define ScExpandedFixedText FixedText
+#define SfxDialog Dialog
+#define SfxModalDialog Dialog
+#define SfxModelessDialog Dialog
+#define TabDialog Dialog
+
+#define Window ::Window
+
+#else
+
+#define LocalizedString String
+
+#endif /* ENABLE_LAYOUT */
+
+#endif /* _LAYOUT_PRE_HXX */
diff --git a/toolkit/inc/layout/layout.hxx b/toolkit/inc/layout/layout.hxx
new file mode 100644
index 000000000000..78c7ea29272a
--- /dev/null
+++ b/toolkit/inc/layout/layout.hxx
@@ -0,0 +1,829 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _LAYOUT_HXX
+#define _LAYOUT_HXX
+
+#include <com/sun/star/awt/XLayoutContainer.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/util/Color.hpp>
+#include <i18npool/lang.h>
+#include <toolkit/dllapi.h>
+#include <tools/gen.hxx>
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/combobox.h>
+#include <vcl/fldunit.hxx>
+#include <vcl/lstbox.h>
+#include <vcl/smartid.hxx>
+#include <vcl/wintypes.hxx>
+
+class Button;
+class ComboBox;
+class Color;
+class Control;
+class Dialog;
+class Edit;
+class Font;
+class Image;
+class ListBox;
+class MapMode;
+class MultiListBox;
+class NotifyEvent;
+class Pointer;
+class PushButton;
+class RadioButton;
+class ResId;
+struct SfxChildWinInfo;
+//class SvxFontListBox;
+//class SvxLanguageBox;
+class TabControl;
+class TabPage;
+class VCLXRadioButton;
+class VCLXWindow;
+class Window;
+
+namespace layoutimpl
+{
+class VCLXTabControl;
+}
+
+class VCLXTabControl;
+
+namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
+
+namespace layout
+{
+
+namespace css = ::com::sun::star;
+
+typedef css::uno::Reference< css::uno::XInterface > PeerHandle;
+class ContextImpl;
+class TOOLKIT_DLLPUBLIC Context
+{
+ ContextImpl *pImpl;
+public:
+ Context( char const* pPath );
+ virtual ~Context();
+ PeerHandle GetPeerHandle( char const* id, sal_uInt32 nId = 0 ) const;
+ void setToplevel( PeerHandle xToplevel );
+ PeerHandle getToplevel();
+ PeerHandle getRoot();
+};
+
+// make declaring wrappers easier ...
+#define DECL_CONSTRUCTORS(t,par,defaultWinBit) \
+ protected: \
+ explicit t( WindowImpl *pImpl ) : \
+ par( pImpl ) {} \
+ char const* GetUnoName() const; \
+ public: \
+ t( Context *context, char const* id, sal_uInt32 nId = 0 ); \
+ t( Window *parent, WinBits nStyle = defaultWinBit ); \
+ t (Window *parent, ResId const &res)
+#define DECL_GET_IMPL(t) \
+ inline t##Impl &getImpl() const
+
+#define DECL_GET_WINDOW( cls ) ::cls* Get##cls() const
+#define IMPL_GET_WINDOW( cls ) ::cls* cls::Get##cls() const { return dynamic_cast< ::cls*>( GetWindow() ); }
+
+#define DECL_GET_VCLXWINDOW( cls ) ::VCLX##cls* GetVCLX##cls() const
+#define IMPL_GET_VCLXWINDOW( cls ) ::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::VCLX##cls*>( GetVCLXWindow() ); }
+
+#define DECL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* GetVCLX##cls() const
+#define IMPL_GET_LAYOUT_VCLXWINDOW( cls ) ::layoutimpl::VCLX##cls* cls::Get##VCLX##cls() const { return dynamic_cast< ::layoutimpl::VCLX##cls*>( GetVCLXWindow() ); }
+
+// follows the VCL inheritance hierarchy ...
+
+class WindowImpl;
+class TOOLKIT_DLLPUBLIC Window
+{
+protected:
+ friend class WindowImpl;
+ WindowImpl *mpImpl;
+ static PeerHandle CreatePeer( Window *parent, WinBits nStyle,
+ char const* pName);
+
+ virtual void setRes (ResId const& res);
+
+public:
+ DECL_GET_IMPL( Window );
+ explicit Window( WindowImpl *pImpl );
+ virtual ~Window();
+
+ PeerHandle GetPeer() const;
+ Context *getContext();
+
+ void Enable( bool bEnable = true );
+ inline void Disable() { Enable( false ); }
+ void Show( bool bVisible = true );
+ inline void Hide() { Show( false ); }
+ void GrabFocus();
+ void FreeResource() {}
+
+ void SetParent( ::Window *parent );
+ virtual void ParentSet (Window *window);
+ void SetParent( Window *parent );
+
+ css::uno::Reference<css::awt::XWindow> GetRef() const;
+ VCLXWindow* GetVCLXWindow() const;
+ ::Window* GetWindow() const;
+ ::Window* GetParent() const;
+
+ void SetPointer( Pointer const& pointer );
+ Pointer const& GetPointer() const;
+ WinBits GetStyle();
+ void SetText( rtl::OUString const& str );
+ String GetText() const;
+ void SetStyle( WinBits style );
+ void SetUpdateMode( bool mode );
+ void SetHelpId( sal_uIntPtr id );
+ sal_uIntPtr GetHelpId() const;
+ void SetSmartHelpId( SmartId const&, SmartIdUpdateMode mode=SMART_SET_SMART );
+ SmartId GetSmartHelpId() const;
+ void EnterWait ();
+ void LeaveWait ();
+ bool IsWait () const;
+ //void Enable (bool enable=true, bool child=true);
+ //void Disable (bool child=true);
+ bool IsEnabled () const;
+ void EnableInput (bool enable=true, bool child=true);
+ bool IsInputEnabled () const;
+
+ bool IsVisible () const;
+ bool HasChildPathFocus (bool systemWindow=false) const;
+ void SetPosPixel (Point const&);
+ Point GetPosPixel () const;
+ void SetSizePixel (Size const&);
+ Size GetSizePixel () const;
+ void SetPosSizePixel (Point const&, Size const&);
+ sal_Int32 GetCtrlTextWidth (rtl::OUString const& str) const;
+ sal_Int32 GetTextHeight () const;
+
+ Size LogicToPixel( Size const& size ) const;
+ Size LogicToPixel( Size const& size, MapMode const& mapMode ) const;
+
+ bool HasFocus () const;
+ Font& GetFont () const;
+ void SetFont (Font const& font);
+ virtual void Invalidate (sal_uInt8 flags=0);
+};
+
+class ControlImpl;
+class TOOLKIT_DLLPUBLIC Control : public Window
+{
+ DECL_GET_IMPL( Control );
+ DECL_CONSTRUCTORS( Control, Window, 0 );
+
+public:
+ ~Control ();
+ void SetGetFocusHdl (Link const& link);
+ Link& GetGetFocusHdl ();
+ void SetLoseFocusHdl (Link const& link);
+ Link& GetLoseFocusHdl ();
+};
+
+class FixedLineImpl;
+class TOOLKIT_DLLPUBLIC FixedLine : public Control
+{
+ DECL_GET_IMPL( FixedLine );
+ DECL_CONSTRUCTORS( FixedLine, Control, WB_HORZ );
+
+public:
+ bool IsEnabled() const;
+};
+
+class FixedTextImpl;
+class TOOLKIT_DLLPUBLIC FixedText : public Control
+{
+ DECL_GET_IMPL( FixedText );
+ DECL_CONSTRUCTORS( FixedText, Control, 0 );
+
+public:
+ ~FixedText ();
+ void SetText( rtl::OUString const& rStr );
+};
+
+class FixedImageImpl;
+class TOOLKIT_DLLPUBLIC FixedImage : public Control
+{
+ DECL_GET_IMPL( FixedImage );
+ DECL_CONSTRUCTORS( FixedImage, Control, 0 );
+public:
+ void setImage( ::Image const& );
+};
+
+class FixedInfoImpl;
+class TOOLKIT_DLLPUBLIC FixedInfo : public FixedText
+{
+ DECL_GET_IMPL( FixedInfo );
+ DECL_CONSTRUCTORS( FixedInfo, FixedText, 0 );
+};
+
+class ImageImpl;
+class TOOLKIT_DLLPUBLIC Image
+{
+ ImageImpl *pImpl;
+public:
+ Image( char const* pName );
+ ~Image();
+ ImageImpl &getImpl() const { return *pImpl; }
+};
+
+class ButtonImpl;
+class TOOLKIT_DLLPUBLIC Button : public Control
+{
+ DECL_GET_IMPL( Button );
+ DECL_CONSTRUCTORS( Button, Control, 0 );
+ DECL_GET_WINDOW (Button);
+
+public:
+ ~Button ();
+ static String GetStandardText (sal_uInt16 button_type);
+ void SetText( rtl::OUString const& rStr );
+ bool SetModeImage (Image const& image);
+ bool SetModeImage (::Image const& image, BmpColorMode mode=BMP_COLOR_NORMAL);
+ void SetImageAlign( ImageAlign eAlign );
+
+ void SetClickHdl( Link const& rLink );
+ virtual void Click() /* pure virtual? */;
+ Link& GetClickHdl ();
+};
+
+class PushButtonImpl;
+class TOOLKIT_DLLPUBLIC PushButton : public Button
+{
+ DECL_GET_IMPL( PushButton );
+ DECL_CONSTRUCTORS( PushButton, Button, 0 );
+ DECL_GET_WINDOW (PushButton);
+
+public:
+ ~PushButton ();
+ void Check( bool bCheck=true );
+ bool IsChecked() const;
+
+ void Toggle();
+ void SetToggleHdl( Link const& rLink );
+};
+
+class TOOLKIT_DLLPUBLIC OKButton : public PushButton
+{
+ DECL_CONSTRUCTORS( OKButton, PushButton, WB_DEFBUTTON );
+};
+class TOOLKIT_DLLPUBLIC CancelButton : public PushButton
+{
+ DECL_CONSTRUCTORS( CancelButton, PushButton, 0 );
+};
+class TOOLKIT_DLLPUBLIC YesButton : public PushButton
+{
+ DECL_CONSTRUCTORS( YesButton, PushButton, WB_DEFBUTTON );
+};
+class TOOLKIT_DLLPUBLIC NoButton : public PushButton
+{
+ DECL_CONSTRUCTORS( NoButton, PushButton, 0 );
+};
+class TOOLKIT_DLLPUBLIC RetryButton : public PushButton
+{
+ DECL_CONSTRUCTORS( RetryButton, PushButton, 0 );
+};
+class TOOLKIT_DLLPUBLIC IgnoreButton : public PushButton
+{
+ DECL_CONSTRUCTORS( IgnoreButton, PushButton, 0 );
+};
+class TOOLKIT_DLLPUBLIC ResetButton : public PushButton
+{
+ DECL_CONSTRUCTORS( ResetButton, PushButton, 0 );
+};
+class TOOLKIT_DLLPUBLIC ApplyButton : public PushButton
+{
+ DECL_CONSTRUCTORS( ApplyButton, PushButton, 0 );
+};
+class TOOLKIT_DLLPUBLIC HelpButton : public PushButton
+{
+ DECL_CONSTRUCTORS( HelpButton, PushButton, 0 );
+};
+class TOOLKIT_DLLPUBLIC ImageButton : public PushButton
+{
+ DECL_CONSTRUCTORS( ImageButton, PushButton, 0 );
+};
+
+class AdvancedButtonImpl;
+class TOOLKIT_DLLPUBLIC AdvancedButton : public PushButton
+{
+ DECL_CONSTRUCTORS( AdvancedButton, PushButton, 0 );
+ DECL_GET_IMPL( AdvancedButton );
+
+ void AddAdvanced( Window* w );
+ void AddSimple( Window* w );
+ void RemoveAdvanced( Window* w );
+ void RemoveSimple( Window* w );
+
+ void SetAdvancedText (rtl::OUString const& text);
+ void SetSimpleText (rtl::OUString const& text);
+ rtl::OUString GetAdvancedText () const;
+ rtl::OUString GetSimpleText () const;
+ void SetDelta (int);
+};
+
+class MoreButtonImpl;
+class TOOLKIT_DLLPUBLIC MoreButton : public AdvancedButton
+{
+ DECL_CONSTRUCTORS( MoreButton, AdvancedButton, 0 );
+ DECL_GET_IMPL( MoreButton );
+ void AddWindow( Window* w );
+ void RemoveWindow( Window* w );
+
+ void SetMoreText (rtl::OUString const& text);
+ void SetLessText (rtl::OUString const& text);
+ rtl::OUString GetMoreText () const;
+ rtl::OUString GetLessText () const;
+};
+
+class RadioButtonImpl;
+class TOOLKIT_DLLPUBLIC RadioButton : public Button
+{
+ DECL_GET_IMPL( RadioButton );
+ DECL_CONSTRUCTORS( RadioButton, Button, 0 );
+ DECL_GET_WINDOW( RadioButton );
+ DECL_GET_VCLXWINDOW( RadioButton );
+public:
+ ~RadioButton ();
+ void Check( bool bCheck=true );
+ bool IsChecked() const;
+
+ void Toggle();
+ void SetToggleHdl( Link const& rLink );
+};
+
+class CheckBoxImpl;
+class TOOLKIT_DLLPUBLIC CheckBox : public Button
+{
+ DECL_GET_IMPL( CheckBox );
+ DECL_CONSTRUCTORS( CheckBox, Button, 0 );
+
+public:
+ ~CheckBox ();
+ void Check( bool bCheck=true );
+ bool IsChecked() const;
+
+ void Toggle();
+ void SetToggleHdl( Link const& rLink );
+};
+
+class EditImpl;
+class TOOLKIT_DLLPUBLIC Edit : public Control
+{
+ DECL_GET_IMPL( Edit );
+ DECL_CONSTRUCTORS( Edit, Control, WB_BORDER );
+ DECL_GET_WINDOW (Edit);
+
+public:
+ ~Edit ();
+ void SetText( rtl::OUString const& rStr );
+ String GetText() const;
+ void SetModifyHdl( Link const& rLink );
+ void SetSelection( Selection const& rSelection );
+};
+
+class MultiLineEditImpl;
+class TOOLKIT_DLLPUBLIC MultiLineEdit : public Edit
+{
+ DECL_GET_IMPL( MultiLineEdit );
+ DECL_CONSTRUCTORS( MultiLineEdit, Edit, WB_LEFT|WB_BORDER );
+};
+
+class SpinFieldImpl;
+class TOOLKIT_DLLPUBLIC SpinField : public Edit
+{
+ DECL_GET_IMPL( SpinField );
+ DECL_CONSTRUCTORS( SpinField, Edit, 0 );
+};
+
+class FormatterBaseImpl;
+class TOOLKIT_DLLPUBLIC FormatterBase
+{
+protected:
+ FormatterBaseImpl *mpFormatImpl;
+ FormatterBase( FormatterBaseImpl *pFormatImpl );
+};
+
+class NumericFormatterImpl;
+class TOOLKIT_DLLPUBLIC NumericFormatter : public FormatterBase
+{
+protected:
+ explicit NumericFormatter( FormatterBaseImpl *pImpl );
+ NumericFormatterImpl &getFormatImpl() const;
+public:
+ void SetMin( sal_Int64 nNewMin );
+ void SetMax( sal_Int64 nNewMax );
+ void SetFirst( sal_Int64 nNewFirst );
+ void SetLast( sal_Int64 nNewLast );
+ void SetSpinSize( sal_Int64 nNewSize );
+
+ void SetValue( sal_Int64 nNewValue );
+ sal_Int64 GetValue() const;
+};
+
+class NumericFieldImpl;
+class TOOLKIT_DLLPUBLIC NumericField : public SpinField, public NumericFormatter
+{
+ DECL_GET_IMPL( NumericField );
+public:
+ NumericField( Context *context, char const* id, sal_uInt32 nId=0 );
+ NumericField( Window *parent, WinBits nStyle );
+};
+
+class MetricFormatterImpl;
+// Different inheritance to save code
+class TOOLKIT_DLLPUBLIC MetricFormatter : public FormatterBase
+{
+ protected:
+ explicit MetricFormatter( FormatterBaseImpl *pImpl );
+ MetricFormatterImpl &getFormatImpl() const;
+public:
+ void SetMin( sal_Int64 nNewMin, FieldUnit nUnit=FUNIT_NONE );
+ void SetMax( sal_Int64 nNewMax, FieldUnit nUnit=FUNIT_NONE );
+ void SetFirst( sal_Int64 nNewFirst, FieldUnit nUnit=FUNIT_NONE );
+ void SetLast( sal_Int64 nNewLast, FieldUnit nUnit=FUNIT_NONE );
+ void SetValue( sal_Int64 nNewValue, FieldUnit nUnit=FUNIT_NONE );
+ sal_Int64 GetValue( FieldUnit nUnit=FUNIT_NONE ) const;
+
+ void SetSpinSize( sal_Int64 nNewSize );
+};
+
+class MetricFieldImpl;
+class TOOLKIT_DLLPUBLIC MetricField : public SpinField, public MetricFormatter
+{
+ DECL_GET_IMPL( MetricField );
+public:
+ MetricField( Context *context, char const* id, sal_uInt32 nId=0 );
+ MetricField( Window *parent, WinBits nStyle );
+};
+
+class ComboBoxImpl;
+class TOOLKIT_DLLPUBLIC ComboBox : public Edit
+{
+ DECL_GET_IMPL( ComboBox );
+ DECL_GET_WINDOW (ComboBox );
+ DECL_CONSTRUCTORS( ComboBox, Edit, 0 );
+
+public:
+ ~ComboBox ();
+ sal_uInt16 InsertEntry( String const& rStr, sal_uInt16 nPos=COMBOBOX_APPEND );
+ void RemoveEntry( String const& rStr );
+ void RemoveEntry( sal_uInt16 nPos );
+ void Clear();
+
+ sal_uInt16 GetEntryPos( String const& rStr ) const;
+ String GetEntry( sal_uInt16 nPos ) const;
+ sal_uInt16 GetEntryCount() const;
+
+ void SetClickHdl( Link const& rLink );
+ void SetSelectHdl( Link const& rLink );
+ void EnableAutocomplete (bool enable, bool matchCase=false );
+};
+
+class ListBoxImpl;
+class TOOLKIT_DLLPUBLIC ListBox : public Control
+{
+ DECL_GET_IMPL( ListBox );
+ DECL_CONSTRUCTORS( ListBox, Control, WB_BORDER );
+ DECL_GET_WINDOW (ListBox);
+
+public:
+ ~ListBox ();
+ sal_uInt16 InsertEntry( String const& rStr, sal_uInt16 nPos=LISTBOX_APPEND );
+
+ void RemoveEntry( String const& rStr );
+ void RemoveEntry( sal_uInt16 nPos );
+ void Clear();
+
+ sal_uInt16 GetEntryPos( String const& rStr ) const;
+ String GetEntry( sal_uInt16 nPos ) const;
+ sal_uInt16 GetEntryCount() const;
+
+ void SelectEntry( String const& rStr, bool bSelect=true );
+ void SelectEntryPos( sal_uInt16 nPos, bool bSelect=true );
+
+ sal_uInt16 GetSelectEntryCount() const;
+ String GetSelectEntry( sal_uInt16 nSelIndex=0 ) const;
+ sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex=0 ) const;
+
+ void SetSelectHdl (Link const& link);
+ Link& GetSelectHdl ();
+
+ void SetClickHdl (Link const& link);
+ Link& GetClickHdl ();
+
+ void SetDoubleClickHdl (Link const& link);
+ Link& GetDoubleClickHdl ();
+
+ void SetEntryData (sal_uInt16 pos, void* data);
+ void* GetEntryData (sal_uInt16 pos) const;
+
+ virtual void SetNoSelection ();
+};
+
+class MultiListBoxImpl;
+class TOOLKIT_DLLPUBLIC MultiListBox : public ListBox
+{
+ DECL_GET_IMPL( MultiListBox );
+ DECL_CONSTRUCTORS( MultiListBox, ListBox, 0 );
+ DECL_GET_WINDOW( MultiListBox );
+};
+
+class DialogImpl;
+class TOOLKIT_DLLPUBLIC Dialog : public Context, public Window
+{
+ DECL_GET_WINDOW (Dialog);
+
+public:
+ DECL_GET_IMPL (Dialog);
+ Dialog( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
+ Dialog( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
+ ~Dialog ();
+ virtual short Execute();
+ void EndDialog( long nResult=0 );
+ void SetText( rtl::OUString const& rStr );
+ void SetTitle (rtl::OUString const& rStr );
+ bool Close ();
+ long Notify (NotifyEvent & event);
+
+ // Sxf*Dialog
+ bool bConstruct;
+ void Initialize (SfxChildWinInfo*);
+};
+
+#define DECL_MESSAGE_BOX_CTORS(Name)\
+ public:\
+ Name##Box (::Window *parent, char const* message,\
+ char const* yes=0, char const* no=0, sal_uIntPtr help_id=0,\
+ char const* xml_file="message-box.xml", char const* id="message-box");\
+ Name##Box (::Window *parent, rtl::OUString const& message,\
+ rtl::OUString yes=String (),\
+ rtl::OUString no=String (),\
+ sal_uIntPtr help_id=0,\
+ char const* xml_file="message-box.xml", char const* id="message-box");\
+ Name##Box (::Window *parent, WinBits, char const* message,\
+ char const* yes=0, char const* no=0, sal_uIntPtr help_id=0,\
+ char const* xml_file="message-box.xml", char const* id="message-box");\
+ Name##Box (::Window *parent, WinBits, rtl::OUString const& message,\
+ rtl::OUString yes=String (),\
+ rtl::OUString no=String (),\
+ sal_uIntPtr help_id=0,\
+ char const* xml_file="message-box.xml", char const* id="message-box")\
+
+class TOOLKIT_DLLPUBLIC MessageBox : public Dialog
+{
+ DECL_MESSAGE_BOX_CTORS(Message);
+
+protected:
+ FixedImage imageError;
+ FixedImage imageInfo;
+ FixedImage imageQuery;
+ FixedImage imageWarning;
+ FixedText messageText;
+ CancelButton cancelButton;
+ HelpButton helpButton;
+ IgnoreButton ignoreButton;
+ NoButton noButton;
+ RetryButton retryButton;
+ YesButton yesButton;
+
+ void bits_init (WinBits bits, rtl::OUString const& message,
+ rtl::OUString yes, rtl::OUString, sal_uIntPtr help_id);
+ void init (rtl::OUString const& message,
+ rtl::OUString const& yes, rtl::OUString const& no, sal_uIntPtr help_id);
+ void init (char const* message, char const* yes, char const* no, sal_uIntPtr help_id);
+};
+
+#define CLASS_MESSAGE_BOX(Name)\
+ class TOOLKIT_DLLPUBLIC Name##Box : public MessageBox\
+ {\
+ DECL_MESSAGE_BOX_CTORS (Name);\
+ }
+
+//CLASS_MESSAGE_BOX (Mess);
+typedef MessageBox MessBox;
+CLASS_MESSAGE_BOX (Error);
+CLASS_MESSAGE_BOX (Info);
+CLASS_MESSAGE_BOX (Query);
+CLASS_MESSAGE_BOX (Warning);
+
+#undef CLASS_MESSAGE_BOX
+
+#undef TAB_APPEND
+
+class TabControlImpl;
+class TOOLKIT_DLLPUBLIC TabControl : public Control
+{
+//#ifndef TAB_APPEND
+#define TAB_APPEND 0xFFFF
+//#endif /* !TAB_APPEND */
+
+ DECL_GET_IMPL (TabControl);
+ DECL_CONSTRUCTORS (TabControl, Control, 0);
+ DECL_GET_WINDOW (TabControl);
+ DECL_GET_LAYOUT_VCLXWINDOW (TabControl);
+
+public:
+ ~TabControl ();
+ void InsertPage (sal_uInt16 id, rtl::OUString const& title, sal_uInt16 pos=TAB_APPEND);
+ void RemovePage (sal_uInt16 id);
+ sal_uInt16 GetPageCount () const;
+ sal_uInt16 GetPageId (sal_uInt16 pos) const;
+ sal_uInt16 GetPagePos (sal_uInt16 id) const;
+ void SetCurPageId (sal_uInt16 id);
+ sal_uInt16 GetCurPageId () const;
+ void SetTabPage (sal_uInt16 id, ::TabPage* page);
+ ::TabPage* GetTabPage (sal_uInt16 id) const;
+ void SetActivatePageHdl (Link const& link);
+ Link& GetActivatePageHdl () const;
+ void SetDeactivatePageHdl (Link const& link);
+ Link& GetDeactivatePageHdl () const;
+ void SetTabPageSizePixel (Size const& size);
+ Size GetTabPageSizePixel () const;
+};
+
+class TabPageImpl;
+class TOOLKIT_DLLPUBLIC TabPage : public Context, public Window
+{
+ DECL_GET_IMPL( TabPage );
+public:
+ static ::Window* global_parent;
+ static TabControl* global_tabcontrol;
+
+ TabPage( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
+ TabPage( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0 );
+ ~TabPage();
+ DECL_GET_WINDOW( TabPage );
+ virtual void ActivatePage();
+ virtual void DeactivatePage();
+};
+
+class ProgressBarImpl;
+class TOOLKIT_DLLPUBLIC ProgressBar : public Control
+{
+ DECL_GET_IMPL( ProgressBar );
+ DECL_CONSTRUCTORS( ProgressBar, Control, WB_BORDER );
+public:
+ void SetForegroundColor( css::util::Color color );
+ void SetBackgroundColor( css::util::Color color );
+ void SetValue( sal_Int32 i );
+ void SetRange( sal_Int32 min, sal_Int32 max );
+ sal_Int32 GetValue();
+};
+
+// -----------------------------------------------------------------
+// layout container / helper wrappers
+// -----------------------------------------------------------------
+
+class TOOLKIT_DLLPUBLIC Container
+{
+protected:
+ css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
+ Container( rtl::OUString const& rName, sal_Int32 nBorder );
+public:
+ Container( Context const* context, char const* id );
+
+ void Add( Window *pWindow );
+ void Add( Container *pContainer );
+
+ void Remove( Window *pWindow );
+ void Remove( Container *pContainer );
+ void Clear();
+ // we can't really do a GetChildren() as they don't have a common class,
+ // besides we would need to keep track of children, uh
+
+ void ShowAll( bool bVisible );
+ void Show();
+ void Hide();
+
+ css::uno::Reference< css::awt::XLayoutContainer > getImpl()
+ { return mxContainer; }
+};
+
+class TOOLKIT_DLLPUBLIC Table : public Container
+{
+protected:
+ Table( sal_Int32 nBorder, sal_Int32 nColumns );
+public:
+ Table( Context const* context, char const* id );
+ void Add( Window *pWindow, bool bXExpand, bool bYExpand,
+ sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 );
+ void Add( Container *pContainer, bool bXExpand, bool bYExpand,
+ sal_Int32 nXSpan=1, sal_Int32 nYSpan=1 );
+
+private:
+ void setProps( css::uno::Reference< css::awt::XLayoutConstrains > xChild,
+ bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan );
+};
+
+class TOOLKIT_DLLPUBLIC Box : public Container
+{
+protected:
+ Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous );
+public:
+ Box( Context const* context, char const* id );
+ void Add( Window *pWindow, bool bExpand, bool bFill, sal_Int32 nPadding);
+ void Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding);
+
+private:
+ void setProps( css::uno::Reference< css::awt::XLayoutConstrains > xChild,
+ bool bXExpand, bool bYExpand, sal_Int32 nPadding );
+};
+
+class TOOLKIT_DLLPUBLIC HBox : public Box
+{
+public:
+ HBox( Context const* context, char const* id );
+ HBox( sal_Int32 nBorder, bool bHomogeneous );
+};
+class TOOLKIT_DLLPUBLIC VBox : public Box
+{
+public:
+ VBox( Context const* context, char const* id );
+ VBox( sal_Int32 nBorder, bool bHomogeneous );
+};
+
+class PluginImpl;
+class TOOLKIT_DLLPUBLIC Plugin : public Control
+{
+ DECL_GET_IMPL( Plugin );
+ //DECL_CONSTRUCTORS( Plugin, Control, 0 );
+public:
+ ::Control *mpPlugin;
+ Plugin( Context *context, char const* id, ::Control *plugin );
+};
+
+class LocalizedStringImpl;
+class TOOLKIT_DLLPUBLIC LocalizedString : public Window
+{
+ DECL_GET_IMPL( LocalizedString );
+
+public:
+ LocalizedString( Context *context, char const* id );
+
+ rtl::OUString operator= (rtl::OUString const&);
+ rtl::OUString operator+= (sal_Unicode );
+ rtl::OUString operator+= (rtl::OUString const&);
+
+ operator rtl::OUString ();
+ operator rtl::OUString const& ();
+ operator String();
+ String getString ();
+ rtl::OUString getOUString ();
+ String GetToken (USHORT i, sal_Char c);
+};
+
+class InPlugImpl;
+class TOOLKIT_DLLPUBLIC InPlug : public Context, public Window
+{
+ DECL_GET_IMPL (InPlug);
+
+public:
+ InPlug ( Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0);
+ InPlug ( ::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId=0);
+
+ void ParentSet (Window *window);
+};
+
+} // end namespace layout
+
+#if ENABLE_LAYOUT
+#define LAYOUT_NS layout::
+#define LAYOUT_DIALOG_PARENT\
+ VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY ) )->GetWindow()
+#define LAYOUT_THIS_WINDOW( this ) this->GetWindow ()
+#else /* !ENABLE_LAYOUT */
+#define LAYOUT_NS
+#define LAYOUT_DIALOG_PARENT this
+#define LAYOUT_THIS_WINDOW( this ) this
+#endif /* !ENABLE_LAYOUT */
+
+#endif /* _LAYOUT_HXX */
diff --git a/toolkit/inc/makefile.mk b/toolkit/inc/makefile.mk
new file mode 100644
index 000000000000..41100071a4d8
--- /dev/null
+++ b/toolkit/inc/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+PRJ=..
+
+PRJNAME=toolkit
+TARGET=inc
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
+.IF "$(ENABLE_PCH)"!=""
+ALLTAR : \
+ $(SLO)$/precompiled.pch \
+ $(SLO)$/precompiled_ex.pch
+
+.ENDIF # "$(ENABLE_PCH)"!=""
+
diff --git a/toolkit/inc/pch/precompiled_toolkit.cxx b/toolkit/inc/pch/precompiled_toolkit.cxx
new file mode 100644
index 000000000000..b448e489dc90
--- /dev/null
+++ b/toolkit/inc/pch/precompiled_toolkit.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_toolkit.hxx"
+
diff --git a/toolkit/inc/pch/precompiled_toolkit.hxx b/toolkit/inc/pch/precompiled_toolkit.hxx
new file mode 100644
index 000000000000..386bd6803ca4
--- /dev/null
+++ b/toolkit/inc/pch/precompiled_toolkit.hxx
@@ -0,0 +1,349 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): Generated on 2006-09-01 17:50:14.373372
+
+#ifdef PRECOMPILED_HEADERS
+//---MARKER---
+#include "sal/config.h"
+#include "sal/types.h"
+
+#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/XAccessible.hpp"
+#include "com/sun/star/accessibility/XAccessibleAction.hpp"
+#include "com/sun/star/accessibility/XAccessibleComponent.hpp"
+#include "com/sun/star/accessibility/XAccessibleContext.hpp"
+#include "com/sun/star/accessibility/XAccessibleEditableText.hpp"
+#include "com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp"
+#include "com/sun/star/accessibility/XAccessibleEventListener.hpp"
+#include "com/sun/star/accessibility/XAccessibleExtendedComponent.hpp"
+#include "com/sun/star/accessibility/XAccessibleKeyBinding.hpp"
+#include "com/sun/star/accessibility/XAccessibleSelection.hpp"
+#include "com/sun/star/accessibility/XAccessibleStateSet.hpp"
+#include "com/sun/star/accessibility/XAccessibleText.hpp"
+#include "com/sun/star/accessibility/XAccessibleValue.hpp"
+#include "com/sun/star/awt/AdjustmentType.hpp"
+#include "com/sun/star/awt/CharSet.hpp"
+#include "com/sun/star/awt/DeviceCapability.hpp"
+#include "com/sun/star/awt/DockingEvent.hpp"
+#include "com/sun/star/awt/EndDockingEvent.hpp"
+#include "com/sun/star/awt/EndPopupModeEvent.hpp"
+#include "com/sun/star/awt/FocusEvent.hpp"
+#include "com/sun/star/awt/FontDescriptor.hpp"
+#include "com/sun/star/awt/FontPitch.hpp"
+#include "com/sun/star/awt/FontSlant.hpp"
+#include "com/sun/star/awt/FontStrikeout.hpp"
+#include "com/sun/star/awt/FontType.hpp"
+#include "com/sun/star/awt/FontUnderline.hpp"
+#include "com/sun/star/awt/FontWeight.hpp"
+#include "com/sun/star/awt/FontWidth.hpp"
+#include "com/sun/star/awt/ImagePosition.hpp"
+#include "com/sun/star/awt/KeyEvent.hpp"
+#include "com/sun/star/awt/KeyModifier.hpp"
+#include "com/sun/star/awt/LineEndFormat.hpp"
+#include "com/sun/star/awt/MouseButton.hpp"
+#include "com/sun/star/awt/MouseEvent.hpp"
+#include "com/sun/star/awt/Point.hpp"
+#include "com/sun/star/awt/PosSize.hpp"
+#include "com/sun/star/awt/Rectangle.hpp"
+#include "com/sun/star/awt/ScrollBarOrientation.hpp"
+#include "com/sun/star/awt/SimpleFontMetric.hpp"
+#include "com/sun/star/awt/Size.hpp"
+#include "com/sun/star/awt/Style.hpp"
+#include "com/sun/star/awt/SystemDependentXWindow.hpp"
+#include "com/sun/star/awt/TextAlign.hpp"
+#include "com/sun/star/awt/VclWindowPeerAttribute.hpp"
+#include "com/sun/star/awt/VisualEffect.hpp"
+#include "com/sun/star/awt/WindowAttribute.hpp"
+#include "com/sun/star/awt/WindowClass.hpp"
+#include "com/sun/star/awt/WindowEvent.hpp"
+#include "com/sun/star/awt/XActionListener.hpp"
+#include "com/sun/star/awt/XAdjustmentListener.hpp"
+#include "com/sun/star/awt/XBitmap.hpp"
+#include "com/sun/star/awt/XButton.hpp"
+#include "com/sun/star/awt/XCheckBox.hpp"
+#include "com/sun/star/awt/XComboBox.hpp"
+#include "com/sun/star/awt/XControl.hpp"
+#include "com/sun/star/awt/XControlContainer.hpp"
+#include "com/sun/star/awt/XControlModel.hpp"
+#include "com/sun/star/awt/XCurrencyField.hpp"
+#include "com/sun/star/awt/XDataTransferProviderAccess.hpp"
+#include "com/sun/star/awt/XDateField.hpp"
+#include "com/sun/star/awt/XDevice.hpp"
+#include "com/sun/star/awt/XDialog.hpp"
+#include "com/sun/star/awt/XDisplayBitmap.hpp"
+#include "com/sun/star/awt/XDockableWindow.hpp"
+#include "com/sun/star/awt/XExtendedToolkit.hpp"
+#include "com/sun/star/awt/XFileDialog.hpp"
+#include "com/sun/star/awt/XFixedText.hpp"
+#include "com/sun/star/awt/XFocusListener.hpp"
+#include "com/sun/star/awt/XFont.hpp"
+#include "com/sun/star/awt/XGraphics.hpp"
+#include "com/sun/star/awt/XImageButton.hpp"
+#include "com/sun/star/awt/XImageConsumer.hpp"
+#include "com/sun/star/awt/XImageProducer.hpp"
+#include "com/sun/star/awt/XInfoPrinter.hpp"
+#include "com/sun/star/awt/XItemEventBroadcaster.hpp"
+#include "com/sun/star/awt/XItemListener.hpp"
+#include "com/sun/star/awt/XKeyListener.hpp"
+#include "com/sun/star/awt/XLayoutConstrains.hpp"
+#include "com/sun/star/awt/XListBox.hpp"
+#include "com/sun/star/awt/XMenuBar.hpp"
+#include "com/sun/star/awt/XMenuExtended.hpp"
+#include "com/sun/star/awt/XMenuListener.hpp"
+#include "com/sun/star/awt/XMessageBox.hpp"
+#include "com/sun/star/awt/XMouseListener.hpp"
+#include "com/sun/star/awt/XMouseMotionListener.hpp"
+#include "com/sun/star/awt/XNumericField.hpp"
+#include "com/sun/star/awt/XPaintListener.hpp"
+#include "com/sun/star/awt/XPatternField.hpp"
+#include "com/sun/star/awt/XPointer.hpp"
+#include "com/sun/star/awt/XPopupMenu.hpp"
+#include "com/sun/star/awt/XPrinter.hpp"
+#include "com/sun/star/awt/XPrinterPropertySet.hpp"
+#include "com/sun/star/awt/XPrinterServer.hpp"
+#include "com/sun/star/awt/XProgressBar.hpp"
+#include "com/sun/star/awt/XProgressMonitor.hpp"
+#include "com/sun/star/awt/XRadioButton.hpp"
+#include "com/sun/star/awt/XRegion.hpp"
+#include "com/sun/star/awt/XReschedule.hpp"
+#include "com/sun/star/awt/XScrollBar.hpp"
+#include "com/sun/star/awt/XSpinField.hpp"
+#include "com/sun/star/awt/XSpinListener.hpp"
+#include "com/sun/star/awt/XSpinValue.hpp"
+#include "com/sun/star/awt/XSystemChildFactory.hpp"
+#include "com/sun/star/awt/XSystemDependentWindowPeer.hpp"
+#include "com/sun/star/awt/XTabController.hpp"
+#include "com/sun/star/awt/XTabControllerModel.hpp"
+#include "com/sun/star/awt/XTextArea.hpp"
+#include "com/sun/star/awt/XTextComponent.hpp"
+#include "com/sun/star/awt/XTextEditField.hpp"
+#include "com/sun/star/awt/XTextLayoutConstrains.hpp"
+#include "com/sun/star/awt/XTextListener.hpp"
+#include "com/sun/star/awt/XTimeField.hpp"
+#include "com/sun/star/awt/XToggleButton.hpp"
+#include "com/sun/star/awt/XToolkit.hpp"
+#include "com/sun/star/awt/XTopWindow.hpp"
+#include "com/sun/star/awt/XTopWindowListener.hpp"
+#include "com/sun/star/awt/XUnoControlContainer.hpp"
+#include "com/sun/star/awt/XVclContainer.hpp"
+#include "com/sun/star/awt/XVclContainerListener.hpp"
+#include "com/sun/star/awt/XVclContainerPeer.hpp"
+#include "com/sun/star/awt/XVclWindowPeer.hpp"
+#include "com/sun/star/awt/XView.hpp"
+#include "com/sun/star/awt/XWindow.hpp"
+#include "com/sun/star/awt/XWindow2.hpp"
+#include "com/sun/star/awt/XWindowListener.hpp"
+#include "com/sun/star/awt/XWindowListener2.hpp"
+#include "com/sun/star/awt/XWindowPeer.hpp"
+#include "com/sun/star/beans/PropertyAttribute.hpp"
+#include "com/sun/star/beans/PropertyChangeEvent.hpp"
+#include "com/sun/star/beans/PropertyState.hpp"
+#include "com/sun/star/beans/PropertyStateChangeEvent.hpp"
+#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/beans/PropertyValues.hpp"
+#include "com/sun/star/beans/XFastPropertySet.hpp"
+#include "com/sun/star/beans/XMultiPropertySet.hpp"
+#include "com/sun/star/beans/XPropertiesChangeListener.hpp"
+#include "com/sun/star/beans/XPropertyAccess.hpp"
+#include "com/sun/star/beans/XPropertyChangeListener.hpp"
+#include "com/sun/star/beans/XPropertyContainer.hpp"
+#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/beans/XPropertySetInfo.hpp"
+#include "com/sun/star/beans/XPropertyState.hpp"
+#include "com/sun/star/beans/XVetoableChangeListener.hpp"
+#include "com/sun/star/container/XContainer.hpp"
+#include "com/sun/star/container/XContainerListener.hpp"
+#include "com/sun/star/container/XIndexContainer.hpp"
+#include "com/sun/star/container/XNameContainer.hpp"
+#include "com/sun/star/datatransfer/clipboard/XClipboard.hpp"
+#include "com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp"
+#include "com/sun/star/embed/EmbedMapUnits.hpp"
+#include "com/sun/star/graphic/XGraphic.hpp"
+#include "com/sun/star/graphic/XGraphicProvider.hpp"
+#include "com/sun/star/io/XInputStream.hpp"
+#include "com/sun/star/io/XMarkableStream.hpp"
+#include "com/sun/star/io/XPersistObject.hpp"
+#include "com/sun/star/lang/DisposedException.hpp"
+#include "com/sun/star/lang/EventObject.hpp"
+#include "com/sun/star/lang/Locale.hpp"
+#include "com/sun/star/lang/SystemDependent.hpp"
+#include "com/sun/star/lang/XComponent.hpp"
+#include "com/sun/star/lang/XEventListener.hpp"
+#include "com/sun/star/lang/XInitialization.hpp"
+#include "com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "com/sun/star/lang/XTypeProvider.hpp"
+#include "com/sun/star/lang/XUnoTunnel.hpp"
+#include "com/sun/star/registry/XRegistryKey.hpp"
+#include "com/sun/star/registry/XSimpleRegistry.hpp"
+#include "com/sun/star/script/ScriptEventDescriptor.hpp"
+#include "com/sun/star/script/XScriptEventsSupplier.hpp"
+#include "com/sun/star/style/VerticalAlignment.hpp"
+#include "com/sun/star/uno/Reference.h"
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.h"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/uno/XInterface.hpp"
+#include "com/sun/star/util/Date.hpp"
+#include "com/sun/star/util/XChangesListener.hpp"
+#include "com/sun/star/util/XChangesNotifier.hpp"
+#include "com/sun/star/util/XCloneable.hpp"
+#include "com/sun/star/util/XModeChangeBroadcaster.hpp"
+#include "com/sun/star/util/XNumberFormatsSupplier.hpp"
+
+#include "comphelper/IdPropArrayHelper.hxx"
+#include "comphelper/accessiblecomponenthelper.hxx"
+#include "comphelper/accessiblecontexthelper.hxx"
+#include "comphelper/accessibleeventnotifier.hxx"
+#include "comphelper/accessiblekeybindinghelper.hxx"
+#include "comphelper/accessibletexthelper.hxx"
+#include "comphelper/accessiblewrapper.hxx"
+#include "comphelper/accimplaccess.hxx"
+#include "comphelper/asyncnotification.hxx"
+#include "comphelper/broadcasthelper.hxx"
+#include "comphelper/componentcontext.hxx"
+#include "comphelper/container.hxx"
+#include "comphelper/processfactory.hxx"
+#include "comphelper/propertycontainer.hxx"
+#include "comphelper/regpathhelper.hxx"
+#include "comphelper/sequence.hxx"
+#include "comphelper/stl_types.hxx"
+#include "comphelper/types.hxx"
+#include "comphelper/uno3.hxx"
+
+#include "cppuhelper/bootstrap.hxx"
+#include "cppuhelper/compbase2.hxx"
+#include "cppuhelper/compbase3.hxx"
+#include "cppuhelper/compbase6.hxx"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implbase1.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/implbase3.hxx"
+#include "cppuhelper/implbase4.hxx"
+#include "cppuhelper/implbase6.hxx"
+#include "cppuhelper/implbase7.hxx"
+#include "cppuhelper/interfacecontainer.h"
+#include "cppuhelper/interfacecontainer.hxx"
+#include "cppuhelper/propshlp.hxx"
+#include "cppuhelper/queryinterface.hxx"
+#include "cppuhelper/servicefactory.hxx"
+#include "cppuhelper/typeprovider.hxx"
+#include "cppuhelper/weak.hxx"
+#include "cppuhelper/weakagg.hxx"
+#include "cppuhelper/weakref.hxx"
+
+#include "osl/conditn.hxx"
+#include "osl/diagnose.h"
+#include "osl/module.h"
+#include "osl/mutex.hxx"
+
+#include "rtl/instance.hxx"
+#include "rtl/memory.h"
+#include "rtl/process.h"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "rtl/uuid.h"
+
+
+#include "sot/exchange.hxx"
+#include "sot/formats.hxx"
+
+
+#include "toolkit/awt/vclxbitmap.hxx"
+#include "toolkit/awt/vclxgraphics.hxx"
+#include "toolkit/awt/vclxpointer.hxx"
+#include "toolkit/awt/vclxprinter.hxx"
+#include "toolkit/awt/vclxregion.hxx"
+#include "toolkit/controls/accessiblecontrolcontext.hxx"
+#include "toolkit/controls/stdtabcontroller.hxx"
+#include "toolkit/controls/stdtabcontrollermodel.hxx"
+#include "toolkit/dllapi.h"
+#include "toolkit/helper/convert.hxx"
+#include "toolkit/helper/emptyfontdescriptor.hxx"
+#include "toolkit/helper/macros.hxx"
+#include "toolkit/helper/mutexandbroadcasthelper.hxx"
+#include "toolkit/helper/mutexhelper.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/solarrelease.hxx"
+#include "toolkit/helper/tkresmgr.hxx"
+#include "toolkit/helper/unomemorystream.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+
+#include "tools/color.hxx"
+#include "tools/date.hxx"
+#include "tools/debug.hxx"
+#include "tools/diagnose_ex.h"
+#include "tools/gen.hxx"
+#include "tools/link.hxx"
+#include "tools/list.hxx"
+#include "tools/poly.hxx"
+#include "tools/simplerm.hxx"
+#include "tools/solar.h"
+#include "tools/stream.hxx"
+#include "tools/string.hxx"
+#include "tools/table.hxx"
+#include "tools/time.hxx"
+#include "tools/urlobj.hxx"
+
+#include "uno/data.h"
+
+#include "unotools/accessiblerelationsethelper.hxx"
+#include "unotools/accessiblestatesethelper.hxx"
+#include "unotools/configmgr.hxx"
+#include "unotools/localedatawrapper.hxx"
+
+#include "vcl/bitmap.hxx"
+#include "vcl/bitmapex.hxx"
+#include "vcl/controllayout.hxx"
+#include "vcl/font.hxx"
+#include "vcl/gradient.hxx"
+#include "vcl/image.hxx"
+#include "vcl/imgcons.hxx"
+#include "vcl/jobset.hxx"
+#include "vcl/mapunit.hxx"
+#include "vcl/menu.hxx"
+#include "vcl/metric.hxx"
+#include "vcl/outdev.hxx"
+#include "vcl/pointr.hxx"
+#include "vcl/print.hxx"
+#include "vcl/region.hxx"
+#include "vcl/svapp.hxx"
+#include "vcl/unohelp.hxx"
+#include "vcl/unohelp2.hxx"
+#include "vcl/vclenum.hxx"
+#include "vcl/virdev.hxx"
+
+#include "vos/mutex.hxx"
+//---MARKER---
+#endif
+
diff --git a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx
new file mode 100644
index 000000000000..12e7b10d8330
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+#define _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/accimplaccess.hxx>
+#include <comphelper/accessiblecomponenthelper.hxx>
+
+#include <tools/gen.hxx> // Size
+#include <tools/link.hxx> // Size
+
+class Window;
+class VCLXWindow;
+class VclSimpleEvent;
+class VclWindowEvent;
+
+namespace utl {
+class AccessibleRelationSetHelper;
+class AccessibleStateSetHelper;
+}
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleComponent
+// ----------------------------------------------------
+
+typedef ::comphelper::OAccessibleExtendedComponentHelper AccessibleExtendedComponentHelper_BASE;
+
+typedef ::cppu::ImplHelper1<
+ ::com::sun::star::lang::XServiceInfo > VCLXAccessibleComponent_BASE;
+
+class VCLExternalSolarLock;
+
+class TOOLKIT_DLLPUBLIC VCLXAccessibleComponent
+ :public AccessibleExtendedComponentHelper_BASE
+ ,public ::comphelper::OAccessibleImplementationAccess
+ ,public VCLXAccessibleComponent_BASE
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> mxWindow;
+ VCLXWindow* mpVCLXindow;
+
+ ULONG nDummy1;
+ ULONG nDummy2;
+ void* pDummy1;
+ VCLExternalSolarLock* m_pSolarLock;
+
+protected:
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+ DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
+ virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent );
+
+public:
+ VCLXAccessibleComponent( VCLXWindow* pVCLXindow );
+ ~VCLXAccessibleComponent();
+
+ VCLXWindow* GetVCLXWindow() const { return mpVCLXindow; }
+ Window* GetWindow() const;
+
+ virtual void SAL_CALL disposing();
+
+ // ::com::sun::star::uno::XInterface
+ DECLARE_XINTERFACE()
+ // ::com::sun::star::lang::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);
+
+ // ::com::sun::star::accessibility::XAccessibleContext
+ sal_Int32 SAL_CALL getAccessibleChildCount( ) 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);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::accessibility::XAccessibleComponent
+ ::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);
+ ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ 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);
+
+ // ::com::sun::star::accessibility::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:
+ // base class overridables
+ ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ /** we may be reparented (if external components use OAccessibleImplementationAccess base class),
+ so this method here returns the parent in the VCL world, in opposite to the parent
+ an external component gave us
+ @precond
+ the caller must ensure thread safety, i.e. our mutex must be locked
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getVclParent() const;
+};
+
+/* ----------------------------------------------------------
+ Accessibility only for the Window hierarchy!
+ Maybe derived classes must overwrite these Accessibility interfaces:
+
+ // XAccessibleContext:
+ sal_Int16 getAccessibleRole() => VCL Window::GetAccessibleRole()
+ OUString getAccessibleDescription() => VCL Window::GetAccessibleDescription
+ OUString getAccessibleName() => VCL Window::GetAccessibleText() => Most windows return Window::GetText()
+ Reference< XAccessibleRelationSet > getAccessibleRelationSet()
+ Reference< XAccessibleStateSet > getAccessibleStateSet() => overload FillAccessibleStateSet( ... )
+
+---------------------------------------------------------- */
+
+
+#endif // _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxbitmap.hxx b/toolkit/inc/toolkit/awt/vclxbitmap.hxx
new file mode 100644
index 000000000000..7712372dfaee
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxbitmap.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 _TOOLKIT_AWT_VCLXBITMAP_HXX_
+#define _TOOLKIT_AWT_VCLXBITMAP_HXX_
+
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/XDisplayBitmap.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/bitmapex.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXBitmap
+// ----------------------------------------------------
+
+class VCLXBitmap : public ::com::sun::star::awt::XBitmap,
+ public ::com::sun::star::awt::XDisplayBitmap,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ BitmapEx maBitmap;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+
+public:
+ void SetBitmap( const BitmapEx& rBmp ) { maBitmap = rBmp; }
+ const BitmapEx& GetBitmap() const { return maBitmap; }
+
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXBitmap* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XBitmap
+ ::com::sun::star::awt::Size SAL_CALL getSize() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getDIB() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXBITMAP_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxcontainer.hxx b/toolkit/inc/toolkit/awt/vclxcontainer.hxx
new file mode 100644
index 000000000000..b854844ae7f1
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxcontainer.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 _TOOLKIT_AWT_VCLXCONTAINER_HXX_
+#define _TOOLKIT_AWT_VCLXCONTAINER_HXX_
+
+
+#include <com/sun/star/awt/XVclContainer.hpp>
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXContainer
+// ----------------------------------------------------
+
+class VCLXContainer : public ::com::sun::star::awt::XVclContainer,
+ public ::com::sun::star::awt::XVclContainerPeer,
+ public VCLXWindow
+{
+public:
+ VCLXContainer();
+ ~VCLXContainer();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclContainer
+ void SAL_CALL addVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > SAL_CALL getWindows( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclContainerPeer
+ void SAL_CALL enableDialogControl( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTabOrder( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& WindowOrder, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Tabs, sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Windows ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXCONTAINER_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxdevice.hxx b/toolkit/inc/toolkit/awt/vclxdevice.hxx
new file mode 100644
index 000000000000..62753a36136d
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxdevice.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 _TOOLKIT_AWT_VCLXDEVICE_HXX_
+#define _TOOLKIT_AWT_VCLXDEVICE_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weak.hxx>
+#include <vos/mutex.hxx>
+
+// #include <com/sun/star/awt/XTextConstraints.hpp>
+#include <com/sun/star/awt/XUnitConversion.hpp>
+
+class OutputDevice;
+class VirtualDevice;
+
+// ----------------------------------------------------
+// class VCLXDevice
+// ----------------------------------------------------
+
+// For using nDummy, no incompatible update, add a BOOL bCreatedWithToolkitMember later...
+#define FLAGS_CREATEDWITHTOOLKIT 0x00000001
+
+class TOOLKIT_DLLPUBLIC VCLXDevice : public ::com::sun::star::awt::XDevice,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+/* public ::com::sun::star::awt::XTextConstraints,*/
+ public ::com::sun::star::awt::XUnitConversion,
+ public ::cppu::OWeakObject
+{
+ friend class VCLXGraphics;
+
+private:
+ NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex
+ OutputDevice* mpOutputDevice;
+
+public:
+ void* pDummy;
+ sal_uInt32 nFlags;
+
+protected:
+ NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; }
+ void DestroyOutputDevice();
+
+public:
+ VCLXDevice();
+ ~VCLXDevice();
+
+ void SetOutputDevice( OutputDevice* pOutDev ) { mpOutputDevice = pOutDev; }
+ OutputDevice* GetOutputDevice() const { return mpOutputDevice; }
+
+ void SetCreatedWithToolkit( sal_Bool bCreatedWithToolkit );
+ sal_Bool IsCreatedWithToolkit() const;
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXDevice* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL createGraphics( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > SAL_CALL getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont( const ::com::sun::star::awt::FontDescriptor& aDescriptor ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > SAL_CALL createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > SAL_CALL createDisplayBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& Bitmap ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextConstraints
+ // ::sal_Int32 SAL_CALL getTextWidth( const ::rtl::OUString& Text ) throw (::com::sun::star::uno::RuntimeException);
+ // ::sal_Int32 SAL_CALL getTextHeight( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XUnitConversion
+ ::com::sun::star::awt::Point SAL_CALL convertPointToLogic( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Point SAL_CALL convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+
+};
+
+// ----------------------------------------------------
+// class VCLXVirtualDevice
+// ----------------------------------------------------
+
+class VCLXVirtualDevice : public VCLXDevice
+{
+private:
+ VirtualDevice* mpVDev;
+
+public:
+ ~VCLXVirtualDevice();
+
+ void SetVirtualDevice( VirtualDevice* pVDev ) { SetOutputDevice( (OutputDevice*)pVDev ); }
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXDEVICE_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxfont.hxx b/toolkit/inc/toolkit/awt/vclxfont.hxx
new file mode 100644
index 000000000000..e912f2d13114
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxfont.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXFONT_HXX_
+#define _TOOLKIT_AWT_VCLXFONT_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XFont2.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/metric.hxx>
+
+// ----------------------------------------------------
+// class VCLXFont
+// ----------------------------------------------------
+
+class TOOLKIT_DLLPUBLIC VCLXFont : public ::com::sun::star::awt::XFont2,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice;
+ Font maFont;
+ FontMetric* mpFontMetric;
+
+protected:
+ BOOL ImplAssertValidFontMetric();
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+public:
+ VCLXFont();
+ ~VCLXFont();
+
+ void Init( ::com::sun::star::awt::XDevice& rxDev, const Font& rFont );
+ const Font& GetFont() const { return maFont; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXFont* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XFont
+ ::com::sun::star::awt::FontDescriptor SAL_CALL getFontDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getCharWidth( sal_Unicode c ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getStringWidth( const ::rtl::OUString& str ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getStringWidthArray( const ::rtl::OUString& str, ::com::sun::star::uno::Sequence< sal_Int32 >& rDXArray ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getKernPairs( ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars1, ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars2, ::com::sun::star::uno::Sequence< sal_Int16 >& rnKerns ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XFont2
+ sal_Bool SAL_CALL hasGlyphs( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+#endif // _TOOLKIT_AWT_VCLXFONT_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxgraphics.hxx b/toolkit/inc/toolkit/awt/vclxgraphics.hxx
new file mode 100644
index 000000000000..5fda9ac947ee
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxgraphics.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_AWT_VCLXGRAPHICS_HXX_
+#define _TOOLKIT_AWT_VCLXGRAPHICS_HXX_
+
+
+#include <com/sun/star/awt/XGraphics.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weak.hxx>
+#include <vos/mutex.hxx>
+
+#include <vcl/font.hxx>
+#include <tools/color.hxx>
+#include <vcl/vclenum.hxx>
+
+class OutputDevice;
+class Region;
+
+
+#define INITOUTDEV_FONT 0x0001
+#define INITOUTDEV_COLORS 0x0002
+#define INITOUTDEV_RASTEROP 0x0004
+#define INITOUTDEV_CLIPREGION 0x0008
+#define INITOUTDEV_ALL 0xFFFF
+
+
+// ----------------------------------------------------
+// class VCLXGraphics
+// ----------------------------------------------------
+
+class VCLXGraphics : public ::com::sun::star::awt::XGraphics,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice> mxDevice; // nur um bei getDevice() immer das gleiche zurueckzugeben
+
+ OutputDevice* mpOutputDevice;
+ Font maFont;
+ Color maTextColor;
+ Color maTextFillColor;
+ Color maLineColor;
+ Color maFillColor;
+ RasterOp meRasterOp;
+ Region* mpClipRegion;
+
+protected:
+ NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; }
+
+public:
+ VCLXGraphics();
+ ~VCLXGraphics();
+
+ void Init( OutputDevice* pOutDev );
+ void InitOutputDevice( sal_uInt16 nFlags );
+
+ void SetOutputDevice( OutputDevice* pOutDev );
+ OutputDevice* GetOutputDevice() const { return mpOutputDevice; }
+
+ const Font& GetFont() const { return maFont; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXGraphics* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XGraphics
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL getDevice( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::SimpleFontMetric SAL_CALL getFontMetric() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& xNewFont ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectFont( const ::com::sun::star::awt::FontDescriptor& aDescription ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setRasterOp( ::com::sun::star::awt::RasterOperation ROP ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& Clipping ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& xClipping ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL push( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL pop( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& xSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& xBitmapHandle, sal_Int32 SourceX, sal_Int32 SourceY, sal_Int32 SourceWidth, sal_Int32 SourceHeight, sal_Int32 DestX, sal_Int32 DestY, sal_Int32 DestWidth, sal_Int32 DestHeight ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPixel( sal_Int32 X, sal_Int32 Y ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawLine( sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawRoundedRect( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawEllipse( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawArc( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawPie( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int32 X1, sal_Int32 Y1, sal_Int32 X2, sal_Int32 Y2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawChord( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nX1, sal_Int32 nY1, sal_Int32 nX2, sal_Int32 nY2 ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawGradient( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 Height, const ::com::sun::star::awt::Gradient& aGradient ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawText( sal_Int32 X, sal_Int32 Y, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL drawTextArray( sal_Int32 X, sal_Int32 Y, const ::rtl::OUString& Text, const ::com::sun::star::uno::Sequence< sal_Int32 >& Longs ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXGRAPHICS_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxmenu.hxx b/toolkit/inc/toolkit/awt/vclxmenu.hxx
new file mode 100644
index 000000000000..c675ad1d4bd9
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxmenu.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXMENU_HXX_
+#define _TOOLKIT_AWT_VCLXMENU_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XMenuBarExtended.hpp>
+#include <com/sun/star/awt/XPopupMenuExtended.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <tools/list.hxx>
+#include <tools/link.hxx>
+
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+class Menu;
+class MenuBar;
+class VclSimpleEvent;
+
+DECLARE_LIST( PopupMenuRefList, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >* )
+
+// ----------------------------------------------------
+// class VCLXMenu
+// ----------------------------------------------------
+
+class TOOLKIT_DLLPUBLIC VCLXMenu : public ::com::sun::star::awt::XMenuBarExtended,
+ public ::com::sun::star::awt::XPopupMenuExtended,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ Menu* mpMenu;
+ MenuListenerMultiplexer maMenuListeners;
+ PopupMenuRefList maPopupMenueRefs;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+ DECL_LINK( MenuEventListener, VclSimpleEvent* );
+
+ void ImplCreateMenu( BOOL bPopup );
+
+public:
+ VCLXMenu();
+ VCLXMenu( Menu* pMenu );
+ ~VCLXMenu();
+
+
+ Menu* GetMenu() const { return mpMenu; }
+ BOOL IsPopupMenu() const;
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXMenu* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XMenu
+ void SAL_CALL addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& aPopupMenu ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > SAL_CALL getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPopupMenu
+ void SAL_CALL insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent, const ::com::sun::star::awt::Rectangle& Area, sal_Int16 Direction ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XMenuBar
+
+ // ::com::sun::star::awt::XMenuExtended
+ virtual void SAL_CALL setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ========================================================================
+ // ========================================================================
+ // ========================================================================
+
+ // XMenuExtended2 Methods
+ virtual ::sal_Bool SAL_CALL isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clear( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::MenuItemType SAL_CALL getItemType( ::sal_Int16 nItemPos ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL hideDisabledEntries( ::sal_Bool bHide ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XMenuBarExtended Methods
+
+ // XPopupMenuExtended Methods
+ virtual ::sal_Bool SAL_CALL isInExecute( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endExecute( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::MenuLogo SAL_CALL getLogo( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enableAutoMnemonics( ::sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAcceleratorKeyEvent( ::sal_Int16 nItemId, const ::com::sun::star::awt::KeyEvent& aKeyEvent ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::KeyEvent SAL_CALL getAcceleratorKeyEvent( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTipHelpText( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemImage( ::sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL getItemImage( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getItemImageAngle( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isItemImageInMirrorMode( ::sal_Int16 nItemId ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::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);
+
+};
+
+// ----------------------------------------------------
+// class VCLXMenuBar
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC VCLXMenuBar : public VCLXMenu
+{
+public:
+ VCLXMenuBar();
+ VCLXMenuBar( MenuBar* pMenuBar );
+};
+
+// ----------------------------------------------------
+// class VCLXPopupMenu
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC VCLXPopupMenu : public VCLXMenu
+{
+public:
+ VCLXPopupMenu();
+};
+
+#endif // _TOOLKIT_AWT_VCLXMENU_HXX_
diff --git a/toolkit/inc/toolkit/awt/vclxpointer.hxx b/toolkit/inc/toolkit/awt/vclxpointer.hxx
new file mode 100644
index 000000000000..2dd694f6e742
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxpointer.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXPOINTER_HXX_
+#define _TOOLKIT_AWT_VCLXPOINTER_HXX_
+
+
+#include <com/sun/star/awt/XPointer.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <vcl/pointr.hxx>
+
+// ----------------------------------------------------
+// class VCLXPointer
+// ----------------------------------------------------
+
+class VCLXPointer : public ::com::sun::star::awt::XPointer,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ Pointer maPointer;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+public:
+ VCLXPointer();
+ ~VCLXPointer();
+
+ const Pointer& GetPointer() const { return maPointer; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXPointer* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPointer
+ void SAL_CALL setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getType( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXPOINTER_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxprinter.hxx b/toolkit/inc/toolkit/awt/vclxprinter.hxx
new file mode 100644
index 000000000000..a7991d38a387
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxprinter.hxx
@@ -0,0 +1,225 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_AWT_VCLXPRINTER_HXX_
+#define _TOOLKIT_AWT_VCLXPRINTER_HXX_
+
+
+#include <com/sun/star/awt/XPrinterPropertySet.hpp>
+#include <com/sun/star/awt/XPrinter.hpp>
+#include <com/sun/star/awt/XPrinterServer.hpp>
+#include <com/sun/star/awt/XInfoPrinter.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+#include "vcl/oldprintadaptor.hxx"
+
+// Fuer den Drucker relevante Properties:
+/*
+ sal_Bool Horizontal
+ sal_uInt16 CopyCount;
+ sal_Bool Collate;
+ String FormDescriptor;
+ sal_uInt16 Orientation; // PORTRAIT, LANDSCAPE
+*/
+
+// ----------------------------------------------------
+// class VCLXPrinterPropertySet
+// ----------------------------------------------------
+
+class VCLXPrinterPropertySet : public ::com::sun::star::awt::XPrinterPropertySet,
+ public ::com::sun::star::lang::XTypeProvider,
+ public MutexAndBroadcastHelper,
+ public ::cppu::OPropertySetHelper
+{
+protected:
+ boost::shared_ptr<Printer> mpPrinter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > mxPrnDevice;
+
+ sal_Int16 mnOrientation;
+ sal_Bool mbHorizontal;
+public:
+ VCLXPrinterPropertySet( const String& rPrinterName );
+ virtual ~VCLXPrinterPropertySet();
+
+ Printer* GetPrinter() const { return mpPrinter.get(); }
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > GetDevice();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::setPropertyValue( rPropertyName, aValue ); }
+ ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return OPropertySetHelper::getPropertyValue( rPropertyName ); }
+ void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::addPropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::removePropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::addVetoableChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { OPropertySetHelper::removeVetoableChangeListener( rPropertyName, rxListener ); }
+
+ // ::cppu::OPropertySetHelper
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+ using cppu::OPropertySetHelper::getFastPropertyValue;
+ void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+ // ::com::sun::star::awt::XPrinterPropertySet
+ void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXPrinter
+// ----------------------------------------------------
+
+class VCLXPrinter: public ::com::sun::star::awt::XPrinter,
+ public VCLXPrinterPropertySet,
+ public ::cppu::OWeakObject
+{
+ boost::shared_ptr<vcl::OldStylePrintAdaptor> mpListener;
+ JobSetup maInitJobSetup;
+public:
+ VCLXPrinter( const String& rPrinterName );
+ ~VCLXPrinter();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::beans::XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertySetInfo(); }
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
+ ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
+ void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
+
+ // ::com::sun::star::awt::XPrinterPropertySet
+ void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getFormDescriptions(); }
+ void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getBinarySetup(); }
+ void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setBinarySetup( data ); }
+
+ // ::com::sun::star::awt::XPrinter
+ sal_Bool SAL_CALL start( const ::rtl::OUString& nJobName, sal_Int16 nCopies, sal_Bool nCollate ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL terminate( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXInfoPrinter
+// ----------------------------------------------------
+
+class VCLXInfoPrinter: public ::com::sun::star::awt::XInfoPrinter,
+ public VCLXPrinterPropertySet,
+ public ::cppu::OWeakObject
+{
+public:
+ VCLXInfoPrinter( const String& rPrinterName );
+ ~VCLXInfoPrinter();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::beans::XPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertySetInfo(); }
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); }
+ ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); }
+ void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); }
+ void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& rxListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); }
+
+ // ::com::sun::star::awt::XPrinterPropertySet
+ void SAL_CALL setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); }
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getFormDescriptions(); }
+ void SAL_CALL selectForm( const ::rtl::OUString& aFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::selectForm( aFormDescription ); }
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException) { return VCLXPrinterPropertySet::getBinarySetup(); }
+ void SAL_CALL setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) { VCLXPrinterPropertySet::setBinarySetup( data ); }
+
+ // ::com::sun::star::awt::XInfoPrinter
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createDevice( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ----------------------------------------------------
+// class VCLXPrinterServer
+// ----------------------------------------------------
+
+class VCLXPrinterServer : public ::com::sun::star::awt::XPrinterServer,
+ public ::cppu::OWeakObject
+{
+public:
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPrinterServer
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > SAL_CALL createPrinter( const ::rtl::OUString& printerName ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > SAL_CALL createInfoPrinter( const ::rtl::OUString& printerName ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXPRINTER_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxregion.hxx b/toolkit/inc/toolkit/awt/vclxregion.hxx
new file mode 100644
index 000000000000..3e95c880558b
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxregion.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXREGION_HXX_
+#define _TOOLKIT_AWT_VCLXREGION_HXX_
+
+
+#include <com/sun/star/awt/XRegion.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <vcl/region.hxx>
+
+// ----------------------------------------------------
+// class VCLXRegion
+// ----------------------------------------------------
+
+class VCLXRegion : public ::com::sun::star::awt::XRegion,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+ Region maRegion;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+public:
+ VCLXRegion();
+ ~VCLXRegion();
+
+ void SetRegion( const Region& rRegion ) { maRegion = rRegion; }
+ const Region& GetRegion() const { return maRegion; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXRegion* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XRegion
+ ::com::sun::star::awt::Rectangle SAL_CALL getBounds() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > SAL_CALL getRectangles() throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+
+
+#endif // _TOOLKIT_AWT_VCLXREGION_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxspinbutton.hxx b/toolkit/inc/toolkit/awt/vclxspinbutton.hxx
new file mode 100644
index 000000000000..f855b6efb948
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxspinbutton.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TOOLKIT_AWT_VCLXSPINBUTTON_HXX
+#define TOOLKIT_AWT_VCLXSPINBUTTON_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/awt/XSpinValue.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= VCLXSpinButton
+ //====================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSpinValue
+ > VCLXSpinButton_Base;
+
+ class VCLXSpinButton :public VCLXWindow
+ ,public VCLXSpinButton_Base
+ {
+ private:
+ AdjustmentListenerMultiplexer maAdjustmentListeners;
+
+ public:
+ VCLXSpinButton();
+
+ protected:
+ ~VCLXSpinButton( );
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XSpinValue
+ virtual void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValue( sal_Int32 n ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMinimum( sal_Int32 minValue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaximum( sal_Int32 maxValue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMinimum( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaximum( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSpinIncrement( sal_Int32 spinIncrement ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSpinIncrement( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getOrientation( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+ private:
+ VCLXSpinButton( const VCLXSpinButton& ); // never implemented
+ VCLXSpinButton& operator=( const VCLXSpinButton& ); // never implemented
+ };
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif // TOOLKIT_INC_TOOLKIT_AWT_VCLXSPINBUTTON_HXX
+
diff --git a/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx
new file mode 100644
index 000000000000..5448bfaff320
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxsystemdependentwindow.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_
+#define _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_
+
+
+#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+// ----------------------------------------------------
+// class VCLXSystemDependendtWindow
+// ----------------------------------------------------
+
+class VCLXSystemDependentWindow : public ::com::sun::star::awt::XSystemDependentWindowPeer,
+ public VCLXWindow
+{
+public:
+ VCLXSystemDependentWindow();
+ ~VCLXSystemDependentWindow();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XSystemDependendtWindowPeer
+ ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXSYSTEMDEPENDENTWINDOW_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx
new file mode 100644
index 000000000000..3f37ac58200f
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
+#define _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/XSystemChildFactory.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XDataTransferProviderAccess.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/awt/XExtendedToolkit.hpp>
+#include <com/sun/star/awt/XReschedule.hpp>
+#include <com/sun/star/awt/XMessageBoxFactory.hpp>
+#include <cppuhelper/compbase7.hxx>
+#include "cppuhelper/interfacecontainer.hxx"
+#include <osl/mutex.hxx>
+#include <osl/module.h>
+#include <tools/link.hxx>
+#include <vcl/wintypes.hxx>
+
+#include <toolkit/dllapi.h>
+
+TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt16 nCompType );
+
+class Window;
+class VCLXWindow;
+class VclSimpleEvent;
+
+namespace com {
+namespace sun {
+namespace star {
+namespace lang {
+ struct EventObject;
+}
+namespace awt {
+ struct WindowDescriptor;
+ class XDataTransfer;
+} } } }
+
+extern "C" {
+ typedef Window* (SAL_CALL *FN_SvtCreateWindow)( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor* pDescriptor, Window* pParent, WinBits nWinBits );
+}
+
+
+// ----------------------------------------------------
+// class VCLXTOOLKIT
+// ----------------------------------------------------
+
+class VCLXToolkit_Impl
+{
+protected:
+ ::osl::Mutex maMutex;
+};
+
+class VCLXToolkit : public VCLXToolkit_Impl,
+ public cppu::WeakComponentImplHelper7<
+ ::com::sun::star::awt::XToolkit,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::awt::XSystemChildFactory,
+ ::com::sun::star::awt::XMessageBoxFactory,
+ ::com::sun::star::awt::XDataTransferProviderAccess,
+ ::com::sun::star::awt::XExtendedToolkit,
+ ::com::sun::star::awt::XReschedule >
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxClipboard;
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > mxSelection;
+
+ oslModule hSvToolsLib;
+ FN_SvtCreateWindow fnSvtCreateWindow;
+
+ ::cppu::OInterfaceContainerHelper m_aTopWindowListeners;
+ ::cppu::OInterfaceContainerHelper m_aKeyHandlers;
+ ::cppu::OInterfaceContainerHelper m_aFocusListeners;
+ ::Link m_aEventListenerLink;
+ ::Link m_aKeyListenerLink;
+ bool m_bEventListener;
+ bool m_bKeyListener;
+
+ DECL_LINK(eventListenerHandler, ::VclSimpleEvent const *);
+
+ DECL_LINK(keyListenerHandler, ::VclSimpleEvent const *);
+
+ void callTopWindowListeners(
+ ::VclSimpleEvent const * pEvent,
+ void (SAL_CALL ::com::sun::star::awt::XTopWindowListener::* pFn)(
+ ::com::sun::star::lang::EventObject const &));
+
+ long callKeyHandlers(::VclSimpleEvent const * pEvent, bool bPressed);
+
+ void callFocusListeners(::VclSimpleEvent const * pEvent, bool bGained);
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+ virtual void SAL_CALL disposing();
+
+ Window* ImplCreateWindow( VCLXWindow** ppNewComp, const ::com::sun::star::awt::WindowDescriptor& rDescriptor, Window* pParent, WinBits nWinBits );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplCreateWindow( const ::com::sun::star::awt::WindowDescriptor& Descriptor, WinBits nWinBits );
+
+public:
+
+ VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+ ~VCLXToolkit();
+
+ // ::com::sun::star::awt::XToolkit
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getWorkArea( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL createWindow( const ::com::sun::star::awt::WindowDescriptor& Descriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > SAL_CALL createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& Descriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > SAL_CALL createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > SAL_CALL createRegion( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XSystemChildFactory
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL createSystemChild( const ::com::sun::star::uno::Any& Parent, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XMessageBoxFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > SAL_CALL createMessageBox( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& aParent, const ::com::sun::star::awt::Rectangle& aPosSize, const ::rtl::OUString& aType, ::sal_Int32 aButtons, const ::rtl::OUString& aTitle, const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDataTransfer
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL getDragGestureRecognizer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > SAL_CALL getDragSource( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > SAL_CALL getDropTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XExtendedToolkit:
+
+ virtual ::sal_Int32 SAL_CALL getTopWindowCount()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >
+ SAL_CALL getTopWindow(::sal_Int32 nIndex)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >
+ SAL_CALL getActiveTopWindow()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addTopWindowListener(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XTopWindowListener > const & rListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removeTopWindowListener(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XTopWindowListener > const & rListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addKeyHandler(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XKeyHandler > const & rHandler)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removeKeyHandler(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XKeyHandler > const & rHandler)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addFocusListener(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener > const & rListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL removeFocusListener(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener > const & rListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL fireFocusGained(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > const & source)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL fireFocusLost(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > const & source)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XReschedule:
+ virtual void SAL_CALL reschedule()
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+};
+
+#endif // _TOOLKIT_AWT_VCLXTOOLKIT_HXX_
diff --git a/toolkit/inc/toolkit/awt/vclxtopwindow.hxx b/toolkit/inc/toolkit/awt/vclxtopwindow.hxx
new file mode 100644
index 000000000000..d8e467b01499
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtopwindow.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 _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
+#define _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
+
+#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
+#include <com/sun/star/awt/XTopWindow2.hpp>
+#include <com/sun/star/awt/XMenuBar.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <toolkit/awt/vclxcontainer.hxx>
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XTopWindow2
+ > VCLXTopWindow_XBase;
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSystemDependentWindowPeer
+ > VCLXTopWindow_SBase;
+
+class TOOLKIT_DLLPUBLIC VCLXTopWindow_Base :public VCLXTopWindow_XBase
+ ,public VCLXTopWindow_SBase
+{
+private:
+ const bool m_bWHWND;
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar> mxMenuBar;
+
+ bool isSystemDependentWindowPeer() const { return m_bWHWND; }
+
+ virtual ::vos::IMutex& GetMutexImpl() = 0;
+ virtual Window* GetWindowImpl() = 0;
+ virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl() = 0;
+
+ VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer );
+
+public:
+ virtual ~VCLXTopWindow_Base();
+
+ // XInterface equivalents
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ // XTypeProvider equivalents
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XSystemDependentWindowPeer
+ ::com::sun::star::uno::Any SAL_CALL getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTopWindow
+ void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL toFront() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL toBack() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTopWindow2
+ virtual ::sal_Bool SAL_CALL getIsMaximized() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIsMaximized( ::sal_Bool _ismaximized ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getIsMinimized() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIsMinimized( ::sal_Bool _isminimized ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDisplay() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
+};
+
+// ----------------------------------------------------
+// class VCLXTopWindow
+// ----------------------------------------------------
+
+class VCLXTopWindow: public VCLXTopWindow_Base,
+ public VCLXContainer
+{
+protected:
+ virtual vos::IMutex& GetMutexImpl();
+ virtual Window* GetWindowImpl();
+ virtual ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl();
+
+public:
+ VCLXTopWindow(bool bWHWND = false);
+ ~VCLXTopWindow();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+
+
+
+#endif // _TOOLKIT_AWT_VCLXTOPWINDOW_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxwindow.hxx b/toolkit/inc/toolkit/awt/vclxwindow.hxx
new file mode 100644
index 000000000000..97f36850dff9
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_AWT_VCLXWINDOW_HXX_
+#define _TOOLKIT_AWT_VCLXWINDOW_HXX_
+
+#include <toolkit/dllapi.h>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XView.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/awt/XDockableWindow.hpp>
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase8.hxx>
+#include <osl/mutex.hxx>
+
+#include <tools/gen.hxx> // Size
+#include <tools/link.hxx>
+
+#include <stdarg.h>
+#include <list>
+
+class Window;
+class VclSimpleEvent;
+class VclWindowEvent;
+struct AccessibilityInfos;
+struct SystemParentData;
+
+namespace toolkit
+{
+ class IAccessibleFactory;
+}
+
+
+// ----------------------------------------------------
+// class VCLXWINDOW
+// ----------------------------------------------------
+
+class UnoPropertyArrayHelper;
+class VCLXWindowImpl;
+typedef ::cppu::ImplInheritanceHelper8 < VCLXDevice
+ , ::com::sun::star::awt::XWindow2
+ , ::com::sun::star::awt::XVclWindowPeer
+ , ::com::sun::star::awt::XLayoutConstrains
+ , ::com::sun::star::awt::XView
+ , ::com::sun::star::awt::XDockableWindow
+ , ::com::sun::star::accessibility::XAccessible
+ , ::com::sun::star::lang::XEventListener
+ , ::com::sun::star::beans::XPropertySetInfo
+ > VCLXWindow_Base;
+
+class TOOLKIT_DLLPUBLIC VCLXWindow : public VCLXWindow_Base
+{
+private:
+ VCLXWindowImpl* mpImpl;
+
+ UnoPropertyArrayHelper *GetPropHelper();
+
+protected:
+ Size ImplCalcWindowSize( const Size& rOutSz ) const;
+ DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+ void SetSynthesizingVCLEvent( sal_Bool b );
+ BOOL IsSynthesizingVCLEvent() const;
+
+ void SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle );
+
+ ::toolkit::IAccessibleFactory& getAccessibleFactory();
+
+ // helper ...
+ static void PushPropertyIds( std::list< sal_uInt16 > &aIds, int nFirstId, ...);
+ // for use in controls/
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds,
+ bool bWithDefaults = false );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds );
+
+ ::cppu::OInterfaceContainerHelper& GetContainerListeners();
+ ::cppu::OInterfaceContainerHelper& GetTopWindowListeners();
+
+public:
+ VCLXWindow( bool bWithDefaultProps = false );
+ ~VCLXWindow();
+
+ virtual void SetWindow( Window* pWindow );
+ Window* GetWindow() const { return (Window*)GetOutputDevice(); }
+
+ void suspendVclEventListening( );
+ void resumeVclEventListening( );
+
+ void notifyWindowRemoved( Window& _rWindow );
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static VCLXWindow* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFocus( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rrxListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindowPeer
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > SAL_CALL getToolkit( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& Pointer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBackground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL invalidate( sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL invalidateRect( const ::com::sun::star::awt::Rectangle& Rect, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ sal_Bool SAL_CALL isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Peer ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isDesignMode( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setForeground( sal_Int32 Color ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setControlFont( const ::com::sun::star::awt::FontDescriptor& aFont ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::accessibility::XAccessible
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDockableWindow
+ void SAL_CALL addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isFloating( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL lock( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL unlock( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isLocked( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL startPopupMode( const ::com::sun::star::awt::Rectangle& WindowRect ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow2
+ void SAL_CALL setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getOutputSize( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isVisible( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isActive( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEnabled( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL hasFocus( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySetInfo
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ ::sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _TOOLKIT_AWT_VCLXWINDOW_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/vclxwindows.hxx b/toolkit/inc/toolkit/awt/vclxwindows.hxx
new file mode 100644
index 000000000000..c334e4d9af65
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -0,0 +1,1164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+#define _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+
+#include <toolkit/dllapi.h>
+
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <com/sun/star/beans/XVetoableChangeListener.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/XPropertyAccess.hpp>
+#include <com/sun/star/beans/XPropertyContainer.hpp>
+#include <com/sun/star/beans/PropertyStateChangeEvent.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <com/sun/star/awt/XFileDialog.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XProgressMonitor.hpp>
+#include <com/sun/star/awt/TextAlign.hpp>
+#include <com/sun/star/awt/XScrollBar.hpp>
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/awt/XMessageBox.hpp>
+#include <com/sun/star/awt/XTextEditField.hpp>
+#include <com/sun/star/awt/Style.hpp>
+#include <com/sun/star/awt/XTimeField.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XSpinField.hpp>
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#include <com/sun/star/awt/XNumericField.hpp>
+#ifndef _COM_SUN_STAR_AWT_XMetricFIELD_HPP_
+#include <com/sun/star/awt/XMetricField.hpp>
+#endif
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XToggleButton.hpp>
+#include <com/sun/star/awt/XPointer.hpp>
+#include <com/sun/star/awt/XTextArea.hpp>
+#include <com/sun/star/awt/XImageButton.hpp>
+#include <com/sun/star/awt/XFixedHyperlink.hpp>
+#include <com/sun/star/awt/XFixedText.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/awt/XRadioButton.hpp>
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#include <com/sun/star/awt/XPatternField.hpp>
+#include <com/sun/star/awt/XDateField.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XImageConsumer.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+#include "toolkit/awt/vclxwindow.hxx"
+#include "toolkit/awt/vclxtopwindow.hxx"
+#include <cppuhelper/implbase1.hxx>
+
+#include <vcl/pointr.hxx>
+#include <vcl/imgcons.hxx>
+#include <vcl/image.hxx>
+
+class Button;
+class CheckBox;
+class RadioButton;
+class ListBox;
+class ScrollBar;
+class Edit;
+class Menu;
+class ComboBox;
+class FormatterBase;
+class SpinField;
+class ToolBox;
+class VclSimpleEvent;
+class VclMenuEvent;
+
+// ----------------------------------------------------
+// class VCLXImageConsumer
+// deriving from VCLXWindow and XImageConsumer
+// ----------------------------------------------------
+
+
+typedef ::cppu::ImplInheritanceHelper1< VCLXWindow, ::com::sun::star::awt::XImageConsumer > VCLXImageConsumer_Base;
+class TOOLKIT_DLLPUBLIC VCLXImageConsumer : public VCLXImageConsumer_Base
+{
+private:
+ /// implements our XImageConsumer functionality
+ ImageConsumer maImageConsumer;
+ /// the image we currently display
+ Image maImage;
+
+protected:
+ BitmapEx GetBitmap() const { return maImage.GetBitmapEx(); }
+
+protected:
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XImageConsumer
+ void SAL_CALL init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByBytes( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int8 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPixelsByLongs( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, const ::com::sun::star::uno::Sequence< sal_Int32 >& aProducerData, sal_Int32 nOffset, sal_Int32 nScanSize ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer >& xProducer ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+protected:
+ void ImplUpdateImage( sal_Bool bGetNewImage );
+
+protected:
+ /** forward our bitmap to our window
+ @precond
+ our mutex is locked
+ @precond
+ GetWindow is not <NULL/>
+ @see GetBitmap
+ */
+ virtual void ImplSetNewImage();
+public:
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+
+};
+
+// ----------------------------------------------------
+// class VCLXButton
+// ----------------------------------------------------
+typedef ::cppu::ImplInheritanceHelper2 < VCLXImageConsumer
+ , ::com::sun::star::awt::XButton
+ , ::com::sun::star::awt::XToggleButton
+ > VCLXButton_Base;
+class VCLXButton :public VCLXButton_Base
+{
+private:
+ ::rtl::OUString maActionCommand;
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+public:
+ VCLXButton();
+ ~VCLXButton();
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XToggleButton
+ // ::com::sun::star::awt::XItemEventBroadcaster
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXImageControl
+// ----------------------------------------------------
+class VCLXImageControl : public VCLXImageConsumer
+{
+public:
+ VCLXImageControl();
+ ~VCLXImageControl();
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+protected:
+ virtual void ImplSetNewImage();
+};
+
+// ----------------------------------------------------
+// class VCLXCheckBox
+// ----------------------------------------------------
+class VCLXCheckBox : public ::com::sun::star::awt::XCheckBox,
+ public ::com::sun::star::awt::XButton,
+ public VCLXImageConsumer
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+public:
+ VCLXCheckBox();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XCheckBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Int16 n ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton:
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXRadioButton
+// ----------------------------------------------------
+class VCLXRadioButton : public ::com::sun::star::awt::XRadioButton,
+ public ::com::sun::star::awt::XButton,
+ public VCLXImageConsumer
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+protected:
+ void ImplClickedOrToggled( BOOL bToggled );
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+public:
+ VCLXRadioButton();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XRadioButton
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton:
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getFirstActionListener ();
+};
+
+// ----------------------------------------------------
+// class VCLXMessageBox
+// ----------------------------------------------------
+class VCLXMessageBox : public ::com::sun::star::awt::XMessageBox,
+ public VCLXTopWindow
+{
+public:
+ VCLXMessageBox();
+ ~VCLXMessageBox();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XMessageBox
+ void SAL_CALL setCaptionText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getCaptionText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMessageText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getMessageText( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize() throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+
+
+// ----------------------------------------------------
+// class VCLXDialog
+// ----------------------------------------------------
+class VCLXDialog : public ::com::sun::star::awt::XDialog,
+ public VCLXTopWindow
+{
+public:
+ VCLXDialog();
+ ~VCLXDialog();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDialog
+ void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getTitle( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL endExecute( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+// ----------------------------------------------------
+// class VCLXTabPage
+// ----------------------------------------------------
+class VCLXTabPage : public VCLXContainer
+{
+public:
+ VCLXTabPage();
+ ~VCLXTabPage();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDevice,
+ ::com::sun::star::awt::DeviceInfo SAL_CALL getInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+// ----------------------------------------------------
+// class VCLXFixedHyperlink
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC VCLXFixedHyperlink :
+ public ::com::sun::star::awt::XFixedHyperlink,
+ public VCLXWindow
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+public:
+ VCLXFixedHyperlink();
+ ~VCLXFixedHyperlink();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XFixedHyperlink
+ void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXFixedText
+// ----------------------------------------------------
+class VCLXFixedText : public ::com::sun::star::awt::XFixedText,
+ public VCLXWindow
+{
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+public:
+ VCLXFixedText();
+ ~VCLXFixedText();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XFixedText
+ void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXScrollBar
+// ----------------------------------------------------
+class VCLXScrollBar : public ::com::sun::star::awt::XScrollBar,
+ public VCLXWindow
+{
+private:
+ AdjustmentListenerMultiplexer maAdjustmentListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+public:
+ VCLXScrollBar();
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XScrollbar
+ void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMaximum( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLineIncrement( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getBlockIncrement( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getVisibleSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getOrientation( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // why isn't this part of the XScrollbar?
+ void SAL_CALL setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMinimum( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize() throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::awt::Size SAL_CALL implGetMinimumSize( Window* p ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXEdit
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC VCLXEdit : public ::com::sun::star::awt::XTextComponent,
+ public ::com::sun::star::awt::XTextEditField,
+ public ::com::sun::star::awt::XTextLayoutConstrains,
+ public VCLXWindow
+{
+private:
+ TextListenerMultiplexer maTextListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+
+public:
+ VCLXEdit();
+
+ TextListenerMultiplexer& GetTextListeners() { return maTextListeners; }
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextComponent
+ void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertText( const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Selection SAL_CALL getSelection( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEditable( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getMaxTextLen( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextEditField:
+ void SAL_CALL setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXListBox
+// ----------------------------------------------------
+class VCLXListBox : public ::com::sun::star::awt::XListBox,
+ public ::com::sun::star::awt::XTextLayoutConstrains,
+ public VCLXWindow
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+ void ImplCallItemListeners();
+
+public:
+ VCLXListBox();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XListBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getSelectedItemPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedItem( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemsPos( const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isMutipleMode( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXComboBox
+// ----------------------------------------------------
+class VCLXComboBox : public ::com::sun::star::awt::XComboBox,
+ public VCLXEdit
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+
+
+public:
+ VCLXComboBox();
+ ~VCLXComboBox();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XComboBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXSpinField
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC VCLXSpinField : public ::com::sun::star::awt::XSpinField,
+ public VCLXEdit
+{
+private:
+ SpinListenerMultiplexer maSpinListeners;
+
+protected:
+ void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+
+public:
+ VCLXSpinField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XSpinField
+ void SAL_CALL addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL up( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL down( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL first( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL last( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXFormattedSpinField
+// ----------------------------------------------------
+class VCLXFormattedSpinField : public VCLXSpinField
+{
+private:
+ FormatterBase* mpFormatter;
+
+protected:
+ FormatterBase* GetFormatter() const { return GetWindow() ? mpFormatter : NULL; }
+
+public:
+ VCLXFormattedSpinField();
+ ~VCLXFormattedSpinField();
+
+ void SetFormatter( FormatterBase* pFormatter ) { mpFormatter = pFormatter; }
+
+ void setStrictFormat( sal_Bool bStrict );
+ sal_Bool isStrictFormat();
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXDateField
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC VCLXDateField : public ::com::sun::star::awt::XDateField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXDateField();
+ ~VCLXDateField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XDateField
+ void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXTimeField
+// ----------------------------------------------------
+class VCLXTimeField : public ::com::sun::star::awt::XTimeField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXTimeField();
+ ~VCLXTimeField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTimeField
+ void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXNumericField
+// ----------------------------------------------------
+class VCLXNumericField : public ::com::sun::star::awt::XNumericField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXNumericField();
+ ~VCLXNumericField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XNumericField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXMetricField
+// ----------------------------------------------------
+class MetricFormatter;
+class MetricField;
+class VCLXMetricField : public ::com::sun::star::awt::XMetricField,
+ public VCLXFormattedSpinField
+{
+ MetricFormatter *GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException);
+ MetricField *GetMetricField() throw(::com::sun::star::uno::RuntimeException);
+ void CallListeners();
+public:
+ VCLXMetricField();
+ ~VCLXMetricField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XMetricField
+ virtual void SAL_CALL setValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setUserValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getValue( ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getCorrectedValue( ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMin( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getMin( ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMax( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getMax( ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFirst( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getFirst( ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLast( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getLast( ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSpinSize( ::sal_Int64 Value ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL getSpinSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDecimalDigits( ::sal_Int16 nDigits ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getDecimalDigits( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setStrictFormat( ::sal_Bool bStrict ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isStrictFormat( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXCurrencyField
+// ----------------------------------------------------
+class VCLXCurrencyField : public ::com::sun::star::awt::XCurrencyField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXCurrencyField();
+ ~VCLXCurrencyField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XCurrencyField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXPatternField
+// ----------------------------------------------------
+class VCLXPatternField : public ::com::sun::star::awt::XPatternField,
+ public VCLXFormattedSpinField
+{
+public:
+ VCLXPatternField();
+ ~VCLXPatternField();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::awt::XPatternField
+ void SAL_CALL setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getString( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::VclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &aIds );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+};
+
+// ----------------------------------------------------
+// class VCLXToolBox
+// ----------------------------------------------------
+class VCLXToolBox : public VCLXWindow
+{
+private:
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ CreateAccessibleContext();
+
+public:
+ VCLXToolBox();
+ ~VCLXToolBox();
+};
+
+#endif // _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+
diff --git a/toolkit/inc/toolkit/awt/xsimpleanimation.hxx b/toolkit/inc/toolkit/awt/xsimpleanimation.hxx
new file mode 100644
index 000000000000..dc8fbe4506ed
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/xsimpleanimation.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 TOOLKIT_AWT_XSIMPLEANIMATION_HXX
+#define TOOLKIT_AWT_XSIMPLEANIMATION_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/awt/XSimpleAnimation.hpp>
+
+//........................................................................
+namespace toolkit
+{
+ class Throbber_Impl;
+//........................................................................
+
+ //====================================================================
+ //= XSimpleAnimation
+ //====================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSimpleAnimation
+ > XSimpleAnimation_Base;
+
+ class XSimpleAnimation :public VCLXWindow
+ ,public XSimpleAnimation_Base
+ {
+ private:
+ //::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > maImageList;
+ sal_Bool mbRepeat;
+ sal_Int32 mnStepTime;
+
+ Throbber_Impl *mpThrobber;
+
+ public:
+ XSimpleAnimation();
+
+ protected:
+ ~XSimpleAnimation();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XSimpleAnimation
+ virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageList( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& ImageList )
+ throw (::com::sun::star::uno::RuntimeException);
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+ private:
+ XSimpleAnimation( const XSimpleAnimation& ); // never implemented
+ XSimpleAnimation& operator=( const XSimpleAnimation& ); // never implemented
+ };
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif // TOOLKIT_INC_TOOLKIT_AWT_XSIMPLEANIMATION_HXX
+
diff --git a/toolkit/inc/toolkit/awt/xthrobber.hxx b/toolkit/inc/toolkit/awt/xthrobber.hxx
new file mode 100644
index 000000000000..511f3f76ecf6
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/xthrobber.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 TOOLKIT_AWT_XTHROBBER_HXX
+#define TOOLKIT_AWT_XTHROBBER_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/awt/XThrobber.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+ class Throbber_Impl;
+
+ //====================================================================
+ //= XThrobber
+ //====================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XThrobber
+ > XThrobber_Base;
+
+ class XThrobber :public VCLXWindow
+ ,public XThrobber_Base
+ {
+ private:
+ Throbber_Impl *mpThrobber;
+ void SAL_CALL InitImageList() throw(::com::sun::star::uno::RuntimeException);
+
+ public:
+ XThrobber();
+
+ protected:
+ ~XThrobber();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XThrobber
+ virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+ private:
+ XThrobber( const XThrobber& ); // never implemented
+ XThrobber& operator=( const XThrobber& ); // never implemented
+ };
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif // TOOLKIT_AWT_XTHROBBER_HXX
+
diff --git a/toolkit/inc/toolkit/controls/accessiblecontrolcontext.hxx b/toolkit/inc/toolkit/controls/accessiblecontrolcontext.hxx
new file mode 100644
index 000000000000..bc5f1e1295a2
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/accessiblecontrolcontext.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_ACCESSIBLE_CONTROL_CONTEXT_HXX
+#define TOOLKIT_ACCESSIBLE_CONTROL_CONTEXT_HXX
+
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <comphelper/accimplaccess.hxx>
+#include <comphelper/uno3.hxx>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+
+class Window;
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= OAccessibleControlContext
+ //====================================================================
+
+ typedef ::comphelper::OAccessibleComponentHelper OAccessibleControlContext_Base;
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XEventListener
+ > OAccessibleControlContext_IBase;
+
+ /** class implementing the AccessibleContext for an UNO control - to be used in design mode of the control.
+ <p><b>life time control<b/><br/>
+ This control should be held weak by the creator (an UNO control), it itself holds a hard reference to the
+ control model, and a weak reference to the control. The reference to the model is freed when the model
+ is beeing disposed.</p>
+ */
+ class OAccessibleControlContext
+ :public ::comphelper::OAccessibleImplementationAccess
+ ,public OAccessibleControlContext_Base
+ ,public OAccessibleControlContext_IBase
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xControlModel; // the model of the control which's context we implement
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ m_xModelPropsInfo; // the cached property set info of the model
+
+ protected:
+ /// ctor. @see Init
+ OAccessibleControlContext();
+ ~OAccessibleControlContext();
+
+ /** late ctor
+ */
+ void Init(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+
+ // OCommonAccessibleComponent overridables
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException);
+
+ public:
+ /** creates an accessible context for an uno control
+ @param _rxCreator
+ the uno control's XAccessible interface. This must be an XControl, from which an XControlModel
+ can be retrieved.
+ */
+ static OAccessibleControlContext* create(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxCreator
+ ) SAL_THROW( ( ) );
+
+ protected:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ 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::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 ::com::sun::star::uno::Any SAL_CALL getAccessibleKeyBinding( ) 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);
+
+ // XEventListener
+ using comphelper::OAccessibleContextHelper::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ // retrieves the value of a string property from the model, if the property is present
+ ::rtl::OUString getModelStringProperty( const sal_Char* _pPropertyName ) SAL_THROW( ( ) );
+
+ // starts listening at the control model (currently for disposal only)
+ void startModelListening( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+ // stops listening at the control model
+ void stopModelListening( ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+
+ Window* implGetWindow( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >* _pxUNOWindow = NULL ) const;
+ };
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_ACCESSIBLE_CONTROL_CONTEXT_HXX
+
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
new file mode 100644
index 000000000000..b6a0e66b2430
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TOOLKIT_DIALOG_CONTROL_HXX
+#define TOOLKIT_DIALOG_CONTROL_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/util/XChangesNotifier.hpp>
+#include <com/sun/star/util/XChangesListener.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <cppuhelper/implbase6.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/macros.hxx"
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <list>
+
+// ----------------------------------------------------
+// class UnoControlDialogModel
+// ----------------------------------------------------
+typedef UnoControlModel UnoControlDialogModel_Base;
+typedef ::cppu::ImplHelper6 < ::com::sun::star::lang::XMultiServiceFactory
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XNameContainer
+ , ::com::sun::star::awt::XTabControllerModel
+ , ::com::sun::star::util::XChangesNotifier
+ , ::com::sun::star::beans::XPropertyChangeListener
+ > UnoControlDialogModel_IBase;
+
+class UnoControlDialogModel : public UnoControlDialogModel_IBase
+ , public UnoControlDialogModel_Base
+{
+public:
+ // would like to make this typedef private, too, but the Forte 7 compiler does have
+ // problems with this .....
+ typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >, ::rtl::OUString >
+ UnoControlModelHolder;
+private:
+ typedef ::std::list< UnoControlModelHolder > UnoControlModelHolderList;
+
+ // for grouping control models (XTabControllerModel::getGroupXXX)
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >
+ ModelGroup;
+ typedef ::std::vector< ModelGroup > AllGroups;
+
+ friend struct CloneControlModel;
+ friend struct FindControlModel;
+ friend struct CompareControlModel;
+
+private:
+ ContainerListenerMultiplexer maContainerListeners;
+ ::cppu::OInterfaceContainerHelper maChangeListeners;
+ UnoControlModelHolderList maModels;
+
+ AllGroups maGroups;
+ sal_Bool mbGroupsUpToDate;
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
+
+public:
+ UnoControlDialogModel();
+ UnoControlDialogModel( const UnoControlDialogModel& rModel );
+ ~UnoControlDialogModel();
+
+ UnoControlModel* Clone() const;
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlModel::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAcces
+ ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XIndexContainer, XIndexReplace, XIndexAcces
+ // void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+ // sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException) = 0;
+ // ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+ // void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+ // void SAL_CALL removeByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException) = 0;
+
+ // ::com::sun::star::container::XNameContainer, XNameReplace, XNameAccess
+ void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeByName( const ::rtl::OUString& Name ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XMultiServiceFactory
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTabControllerModel
+ virtual sal_Bool SAL_CALL getGroupControl( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGroupCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XChangesNotifier
+ virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ using cppu::OPropertySetHelper::disposing;
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlDialogModel,UnoControlDialogModel_Base, szServiceName2_UnoControlDialogModel )
+
+protected:
+ void startControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
+ void stopControlListening( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxChildModel );
+
+ void implNotifyTabModelChange( const ::rtl::OUString& _rAccessor );
+
+ void implUpdateGroupStructure();
+};
+
+// ----------------------------------------------------
+// class UnoDialogControl
+// ----------------------------------------------------
+typedef ::cppu::ImplHelper6 < ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::awt::XTopWindow
+ , ::com::sun::star::awt::XDialog
+ , ::com::sun::star::util::XChangesListener
+ , ::com::sun::star::util::XModifyListener
+ , ::com::sun::star::awt::XWindowListener
+ > UnoDialogControl_IBase;
+
+class ResourceListener :public ::com::sun::star::util::XModifyListener,
+ public ::cppu::OWeakObject,
+ public ::cppu::BaseMutex
+{
+ public:
+ ResourceListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& xListener );
+ virtual ~ResourceListener();
+
+ void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver >& rResource );
+ void stopListening();
+
+ // 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 ();
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) 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);
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > m_xResource;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener;
+ bool m_bListening;
+};
+
+class UnoDialogControl :public UnoControlContainer
+ ,public UnoDialogControl_IBase
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
+ TopWindowListenerMultiplexer maTopWindowListeners;
+ bool mbWindowListener;
+ bool mbSizeModified;
+ bool mbPosModified;
+
+protected:
+
+ void ImplInsertControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel, const ::rtl::OUString& rName );
+ void ImplRemoveControl( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel );
+ void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
+ void ImplUpdateResourceResolver();
+ void ImplStartListingForResourceEvents();
+
+public:
+
+ UnoDialogControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlContainer::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTopWindow
+ void SAL_CALL addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL toFront( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL toBack( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& xMenu ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindowListener
+ virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainerListener
+ void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XDialog
+ void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoDialogControl, szServiceName2_UnoControlDialog )
+
+protected:
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
+
+protected:
+ virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+ virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+};
+
+
+#endif // TOOLKIT_DIALOG_CONTROL_HXX
diff --git a/toolkit/inc/toolkit/controls/eventcontainer.hxx b/toolkit/inc/toolkit/controls/eventcontainer.hxx
new file mode 100644
index 000000000000..d0b7adbbe497
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/eventcontainer.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+
+#include <osl/diagnose.h>
+#ifndef _COM_SUN_STAR_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XCONTAINER_HPP_
+#include <com/sun/star/container/XContainer.hpp>
+#endif
+
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <hash_map>
+#include <cppuhelper/implbase2.hxx>
+typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
+ ::com::sun::star::container::XContainer > NameContainerHelper;
+
+
+namespace toolkit
+{
+
+// Hashtable to optimize
+struct hashName_Impl
+{
+ size_t operator()(const ::rtl::OUString Str) const
+ {
+ return (size_t)Str.hashCode();
+ }
+};
+
+struct eqName_Impl
+{
+ sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
+ {
+ return ( Str1 == Str2 );
+ }
+};
+
+typedef std::hash_map
+<
+ ::rtl::OUString,
+ sal_Int32,
+ hashName_Impl,
+ eqName_Impl
+>
+NameContainerNameMap;
+
+
+class NameContainer_Impl : public NameContainerHelper
+{
+ NameContainerNameMap mHashMap;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > mNames;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > mValues;
+ sal_Int32 mnElementCount;
+ ::com::sun::star::uno::Type mType;
+
+ ContainerListenerMultiplexer maContainerListeners;
+
+public:
+ NameContainer_Impl( ::com::sun::star::uno::Type const & aType )
+ : mnElementCount( 0 ),
+ mType( aType ),
+ maContainerListeners( *this )
+ {
+ }
+
+ // Methods XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameReplace
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XNameContainer
+ virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // Methods XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+class ScriptEventContainer : public NameContainer_Impl
+{
+public:
+ ScriptEventContainer( void );
+};
+
+
+} // namespace toolkit_namecontainer
+
diff --git a/toolkit/inc/toolkit/controls/formattedcontrol.hxx b/toolkit/inc/toolkit/controls/formattedcontrol.hxx
new file mode 100644
index 000000000000..f589dabd47aa
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/formattedcontrol.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TOOLKIT_FORMATTED_CONTROL_HXX
+#define TOOLKIT_FORMATTED_CONTROL_HXX
+
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+#include <com/sun/star/util/XNumberFormatter.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ // ===================================================================
+ // = UnoControlFormattedFieldModel
+ // ===================================================================
+ class UnoControlFormattedFieldModel : public UnoControlModel
+ {
+ protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ ::com::sun::star::uno::Any m_aCachedFormat;
+ bool m_bRevokedAsClient;
+ bool m_bSettingValueAndText;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
+ m_xCachedFormatter;
+
+ protected:
+ sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any& rConvertedValue,
+ ::com::sun::star::uno::Any& rOldValue,
+ sal_Int32 nPropId,
+ const ::com::sun::star::uno::Any& rValue
+ ) throw (::com::sun::star::lang::IllegalArgumentException);
+
+ void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ ) throw (::com::sun::star::uno::Exception);
+
+ public:
+ UnoControlFormattedFieldModel();
+ UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlFormattedFieldModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlFormattedFieldModel, UnoControlModel, szServiceName2_UnoControlFormattedFieldModel )
+
+ protected:
+ ~UnoControlFormattedFieldModel();
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // UnoControlModel
+ virtual void ImplNormalizePropertySequence(
+ const sal_Int32 _nCount, /// the number of entries in the arrays
+ sal_Int32* _pHandles, /// the handles of the properties to set
+ ::com::sun::star::uno::Any* _pValues, /// the values of the properties to set
+ sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
+ ) const SAL_THROW(());
+ private:
+ void impl_updateTextFromValue_nothrow();
+ void impl_updateCachedFormatter_nothrow();
+ void impl_updateCachedFormatKey_nothrow();
+ };
+
+ // ===================================================================
+ // = UnoFormattedFieldControl
+ // ===================================================================
+ class UnoFormattedFieldControl : public UnoSpinFieldControl
+ {
+ public:
+ UnoFormattedFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFormattedFieldControl, UnoEditControl, szServiceName2_UnoControlFormattedField )
+ };
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_FORMATTED_CONTROL_HXX
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
new file mode 100644
index 000000000000..05b3016e690a
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_HELPERS_GEOMETRYCONTROLMODEL_HXX_
+#define _TOOLKIT_HELPERS_GEOMETRYCONTROLMODEL_HXX_
+
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/propagg.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <com/sun/star/script/XScriptEventsSupplier.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <comphelper/stl_types.hxx>
+
+FORWARD_DECLARE_INTERFACE( lang, XMultiServiceFactory )
+FORWARD_DECLARE_INTERFACE( script, XNameContainer )
+
+//........................................................................
+// namespace toolkit
+// {
+//........................................................................
+
+ //====================================================================
+ //= OGeometryControlModel_Base
+ //====================================================================
+ typedef ::cppu::WeakAggComponentImplHelper2 < ::com::sun::star::util::XCloneable
+ , ::com::sun::star::script::XScriptEventsSupplier
+ > OGCM_Base;
+ class OGeometryControlModel_Base
+ :public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::comphelper::OPropertySetAggregationHelper
+ ,public ::comphelper::OPropertyContainer
+ ,public OGCM_Base
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ m_xAggregate;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ mxEventContainer;
+
+ // <properties>
+ sal_Int32 m_nPosX;
+ sal_Int32 m_nPosY;
+ sal_Int32 m_nWidth;
+ sal_Int32 m_nHeight;
+ ::rtl::OUString m_aName;
+ sal_Int16 m_nTabIndex;
+ sal_Int32 m_nStep;
+ ::rtl::OUString m_aTag;
+ ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceResolver > m_xStrResolver;
+ // </properties>
+
+ sal_Bool m_bCloneable;
+
+ protected:
+ virtual ::com::sun::star::uno::Any ImplGetDefaultValueByHandle(sal_Int32 nHandle) const;
+ virtual ::com::sun::star::uno::Any ImplGetPropertyValueByHandle(sal_Int32 nHandle) const;
+ virtual void ImplSetPropertyValueByHandle(sal_Int32 nHandle, const :: com::sun::star::uno::Any& aValue);
+
+ protected:
+ /**
+ @param _pAggregateInstance
+ the object to be aggregated. The refcount of the instance given MUST be 0!
+ */
+ OGeometryControlModel_Base(::com::sun::star::uno::XAggregation* _pAggregateInstance);
+
+ /**
+ @param _rxAggregateInstance
+ is the object to be aggregated. Must be aquired excatly once (by the reference object given).<br/>
+ Will be reset to NULL upon leaving
+ */
+ OGeometryControlModel_Base(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
+
+ /** releases the aggregation
+ <p>Can be used if in a derived class, an exception has to be thrown after this base class here already
+ did the aggregation</p>
+ */
+ void releaseAggregation();
+
+ protected:
+ ~OGeometryControlModel_Base();
+
+ // XAggregation
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _aType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // 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);
+
+ // OPropertySetHelper overridables
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue,
+ sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue)
+ throw (::com::sun::star::uno::Exception);
+
+ using comphelper::OPropertySetAggregationHelper::getFastPropertyValue;
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& _rValue, sal_Int32 _nHandle) const;
+
+ // OPropertyStateHelper overridables
+ virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
+ virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
+ virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+
+ // OPropertySetAggregationHelper overridables
+ using OPropertySetAggregationHelper::getInfoHelper;
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XScriptEventsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ SAL_CALL getEvents( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XCloneable implementation - to be overwritten
+ virtual OGeometryControlModel_Base* createClone_Impl(
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance) = 0;
+
+ // XComponent
+ using comphelper::OPropertySetAggregationHelper::disposing;
+ virtual void SAL_CALL disposing();
+
+ private:
+ void registerProperties();
+ };
+
+ //====================================================================
+ //= OTemplateInstanceDisambiguation
+ //====================================================================
+ template <class CONTROLMODEL>
+ class OTemplateInstanceDisambiguation
+ {
+ };
+
+ //====================================================================
+ //= OGeometryControlModel
+ //====================================================================
+ /* example for usage:
+ Reference< XAggregation > xIFace = new ::toolkit::OGeometryControlModel< UnoControlButtonModel > ();
+ */
+ template <class CONTROLMODEL>
+ class OGeometryControlModel
+ :public OGeometryControlModel_Base
+ ,public ::comphelper::OAggregationArrayUsageHelper< OTemplateInstanceDisambiguation< CONTROLMODEL > >
+ {
+ public:
+ OGeometryControlModel();
+
+ private:
+ OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
+
+ protected:
+ // OAggregationArrayUsageHelper overridables
+ virtual void fillProperties(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _rProps,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _rAggregateProps
+ ) const;
+
+ // OPropertySetAggregationHelper overridables
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OGeometryControlModel_Base
+ virtual OGeometryControlModel_Base* createClone_Impl(
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //====================================================================
+ //= OCommonGeometryControlModel
+ //====================================================================
+ /** allows to extend an arbitrary <type scope="com.sun.star.awt">UnoControlModel</type> with geometry
+ information.
+ */
+ class OCommonGeometryControlModel
+ :public OGeometryControlModel_Base
+ ,public ::comphelper::OIdPropertyArrayUsageHelper< OCommonGeometryControlModel >
+ {
+ private:
+ ::rtl::OUString m_sServiceSpecifier; // the service specifier of our aggregate
+ sal_Int32 m_nPropertyMapId; // our unique property info id, used to look up in s_aAggregateProperties
+
+ public:
+ /** instantiate the model
+
+ @param _rxAgg
+ the instance to aggregate. Must support the <type scope="com.sun.star.awt">UnoControlModel</type>
+ (this is not checked here)
+ */
+ OCommonGeometryControlModel(
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAgg,
+ const ::rtl::OUString& _rxServiceSpecifier
+ );
+
+ // OIdPropertyArrayUsageHelper overridables
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
+
+ // OPropertySetAggregationHelper overridables
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OGeometryControlModel_Base
+ virtual OGeometryControlModel_Base* createClone_Impl(
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance);
+
+ // XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue)
+ throw (::com::sun::star::uno::Exception);
+ };
+
+#include "toolkit/controls/geometrycontrolmodel_impl.hxx"
+
+//........................................................................
+// } // namespace toolkit
+//........................................................................
+
+#endif // _TOOLKIT_HELPERS_GEOMETRYCONTROLMODEL_HXX_
diff --git a/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx
new file mode 100644
index 000000000000..d6491877c7ad
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.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.
+ *
+ ************************************************************************/
+
+// no include protection. This is included from within geometrycontrolmodel.hxx only
+
+//====================================================================
+//= OGeometryControlModel
+//====================================================================
+//--------------------------------------------------------------------
+template <class CONTROLMODEL>
+OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel()
+ :OGeometryControlModel_Base(new CONTROLMODEL)
+{
+}
+
+//--------------------------------------------------------------------
+template <class CONTROLMODEL>
+OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance)
+ :OGeometryControlModel_Base(_rxAggregateInstance)
+{
+}
+
+//--------------------------------------------------------------------
+template <class CONTROLMODEL>
+::cppu::IPropertyArrayHelper& SAL_CALL OGeometryControlModel<CONTROLMODEL>::getInfoHelper()
+{
+ return *this->getArrayHelper();
+}
+
+//--------------------------------------------------------------------
+template <class CONTROLMODEL>
+void OGeometryControlModel<CONTROLMODEL>::fillProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _rProps, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _rAggregateProps) const
+{
+ // our own properties
+ OPropertyContainer::describeProperties(_rProps);
+ // the aggregate properties
+ if (m_xAggregateSet.is())
+ _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties();
+}
+
+//--------------------------------------------------------------------
+template <class CONTROLMODEL>
+::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL OGeometryControlModel<CONTROLMODEL>::getImplementationId( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ static ::cppu::OImplementationId * pId = NULL;
+ if ( !pId )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static ::cppu::OImplementationId s_aId;
+ pId = &s_aId;
+ }
+ }
+ return pId->getImplementationId();
+}
+
+//--------------------------------------------------------------------
+template <class CONTROLMODEL>
+OGeometryControlModel_Base* OGeometryControlModel<CONTROLMODEL>::createClone_Impl(
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable >& _rxAggregateInstance)
+{
+ return new OGeometryControlModel<CONTROLMODEL>(_rxAggregateInstance);
+}
+
+
diff --git a/toolkit/inc/toolkit/controls/roadmapcontrol.hxx b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
new file mode 100644
index 000000000000..7ac858a6a7b7
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TOOLKIT_ROADMAP_CONTROL_HXX
+#define TOOLKIT_ROADMAP_CONTROL_HXX
+
+
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/controls/roadmapentry.hxx>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/awt/XItemEventBroadcaster.hpp>
+#include <com/sun/star/awt/XImageConsumer.hpp>
+#include <com/sun/star/awt/XImageProducer.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/implbase4.hxx>
+#endif
+
+
+
+#include <comphelper/uno3.hxx>
+
+typedef UnoControlModel UnoControlRoadmapModel_Base;
+
+
+typedef ::cppu::ImplHelper4 < ::com::sun::star::lang::XSingleServiceFactory
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XIndexContainer
+ , ::com::sun::star::awt::XImageProducer
+ > UnoControlRoadmapModel_IBase;
+
+
+
+typedef UnoControlBase UnoControlRoadmap_Base;
+typedef ::cppu::ImplHelper4 < ::com::sun::star::awt::XItemEventBroadcaster
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::beans::XPropertyChangeListener
+ > UnoControlRoadmap_IBase;
+
+
+
+
+typedef ::cppu::ImplHelper2< ::com::sun::star::container::XContainerListener,
+ ::com::sun::star::awt::XItemEventBroadcaster> SVTXRoadmap_Base;
+
+
+//........................................................................
+
+namespace toolkit{
+//........................................................................
+ 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::container;
+
+
+ // ===================================================================
+ // = UnoControlRoadmapModel
+ // ===================================================================
+ class UnoControlRoadmapModel : public UnoControlRoadmapModel_Base,
+ public UnoControlRoadmapModel_IBase
+
+ {
+ private:
+// PropertyChangeListenerMultiplexer maPropertyListeners;
+
+ typedef ::std::vector< Reference< XInterface > > RoadmapItemHolderList;
+
+ std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maImageListeners;
+
+ ContainerListenerMultiplexer maContainerListeners;
+ RoadmapItemHolderList maRoadmapItems;
+
+ void MakeRMItemValidation( sal_Int32 Index, Reference< XInterface > xRoadmapItem );
+ ContainerEvent GetContainerEvent(sal_Int32 Index, Reference< XInterface > );
+ void SetRMItemDefaultProperties( const sal_Int32 _Index, Reference< XInterface > );
+ sal_Int16 GetCurrentItemID( Reference< XPropertySet > xPropertySet );
+ sal_Int32 GetUniqueID();
+
+
+ protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ public:
+ UnoControlRoadmapModel();
+ UnoControlRoadmapModel( const UnoControlRoadmapModel& rModel ) :
+ UnoControlRoadmapModel_Base( rModel ),
+ UnoControlRoadmapModel_IBase( rModel ),
+ maContainerListeners( *this ) {}
+ UnoControlModel* Clone() const { return new UnoControlRoadmapModel( *this ); }
+
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlModel, szServiceName2_UnoControlRoadmapModel )
+
+// void ImplPropertyChanged( sal_uInt16 nPropId );
+
+ sal_Int32 SAL_CALL getCount() throw (RuntimeException);
+ virtual Any SAL_CALL getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
+
+ virtual void SAL_CALL insertByIndex( sal_Int32 Index, const Any & _Element) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
+ virtual void SAL_CALL removeByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const Any & _Element) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
+
+ virtual void SAL_CALL addContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const Reference< XContainerListener >& xListener ) throw (RuntimeException);
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlModel::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { UnoControlModel::acquire(); }
+ void SAL_CALL release() throw() { UnoControlModel::release(); }
+
+
+ // ::com::sun::star::awt::XImageProducer
+ void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ virtual Reference< XInterface > SAL_CALL createInstance( ) throw (Exception, RuntimeException);
+ virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
+
+ virtual Type SAL_CALL getElementType() throw (RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
+
+ };
+
+
+ // ===================================================================
+ // = UnoRoadmapControl
+ // ===================================================================
+ class UnoRoadmapControl : public UnoControlRoadmap_Base,
+ public UnoControlRoadmap_IBase
+ {
+ private:
+ ItemListenerMultiplexer maItemListeners;
+ public:
+ UnoRoadmapControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& rEvent )throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addItemListener( const Reference< XItemListener >& l ) throw (RuntimeException);
+ virtual void SAL_CALL removeItemListener( const Reference< XItemListener >& l ) throw (RuntimeException);
+
+
+ virtual void SAL_CALL itemStateChanged( const ItemEvent& rEvent ) throw (RuntimeException);
+
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
+
+ void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+ DECLARE_XINTERFACE()
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoRoadmapControl, UnoControlBase, szServiceName2_UnoControlRoadmap )
+ };
+
+//........................................................................
+} // toolkit
+//........................................................................
+
+
+
+#endif // _TOOLKIT_ROADMAP_CONTROL_HXX
diff --git a/toolkit/inc/toolkit/controls/roadmapentry.hxx b/toolkit/inc/toolkit/controls/roadmapentry.hxx
new file mode 100644
index 000000000000..6f43f0510465
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/roadmapentry.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 _TOOLKIT_ROADMAPENTRY_HXX_
+#define _TOOLKIT_ROADMAPENTRY_HXX_
+
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+
+#define RM_PROPERTY_ID_LABEL 1
+#define RM_PROPERTY_ID_ID 2
+#define RM_PROPERTY_ID_ENABLED 4
+#define RM_PROPERTY_ID_INTERACTIVE 5
+
+typedef ::cppu::WeakImplHelper1 < ::com::sun::star::lang::XServiceInfo
+ > ORoadmapEntry_Base;
+
+class ORoadmapEntry :public ORoadmapEntry_Base
+ ,public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::comphelper::OPropertyContainer
+ ,public ::comphelper::OPropertyArrayUsageHelper< ORoadmapEntry >
+{
+
+public:
+ ORoadmapEntry();
+
+protected:
+ DECLARE_XINTERFACE() // merge XInterface implementations
+ DECLARE_XTYPEPROVIDER() // merge XTypeProvider implementations
+
+ /// @see ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
+ SAL_CALL getPropertySetInfo()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+
+ 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);
+
+
+ // other stuff
+ // ...
+ // (e.g. DECLARE_SERVICE_INFO();)
+
+protected:
+ // <properties>
+ ::rtl::OUString m_sLabel;
+ sal_Int32 m_nID;
+ sal_Bool m_bEnabled;
+ sal_Bool m_bInteractive;
+
+ // </properties>
+};
+
+#endif
+
diff --git a/toolkit/inc/toolkit/controls/stdtabcontroller.hxx b/toolkit/inc/toolkit/controls/stdtabcontroller.hxx
new file mode 100644
index 000000000000..9dc5ae1a2d5a
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/stdtabcontroller.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_
+#define _TOOLKIT_CONTROLS_STDTABCONTROLLER_HXX_
+
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/awt/XTabController.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weakagg.hxx>
+#include <osl/mutex.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+
+class StdTabController : public ::com::sun::star::awt::XTabController,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ::osl::Mutex maMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > mxModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > mxControlContainer;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+ sal_Bool ImplCreateComponentSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rControls, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rModels, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& rComponents, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>* pTabStops, sal_Bool bPeerComponent ) const;
+ // wenn rModels kuerzer als rControls ist, werden nur die rModels entsprechenden Elemente geliefert und die korrespondierenden Elemente aus rControls entfernt
+ void ImplActivateControl( sal_Bool bFirst ) const;
+
+public:
+ StdTabController();
+ ~StdTabController();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > FindControl( ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > >& rCtrls, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > & rxCtrlModel );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XTabController
+ void SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel > SAL_CALL getModel( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >& Container ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > SAL_CALL getContainer( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL autoTabOrder( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activateTabOrder( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activateFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activateLast( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO( StdTabController, szServiceName2_TabController )
+};
+
+
+
+#endif // _TOOLKIT_AWT_STDTABCONTROLLER_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx
new file mode 100644
index 000000000000..d49fa720d5fd
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/stdtabcontrollermodel.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
+#define _TOOLKIT_CONTROLS_STDTABCONTROLLERMODEL_HXX_
+
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/awt/XTabControllerModel.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/weakagg.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <osl/mutex.hxx>
+
+#include <tools/list.hxx>
+#include <tools/gen.hxx>
+
+struct UnoControlModelEntry;
+
+DECLARE_LIST( UnoControlModelEntryListBase, UnoControlModelEntry* )
+
+class UnoControlModelEntryList : public UnoControlModelEntryListBase
+{
+private:
+ ::rtl::OUString maGroupName;
+
+public:
+ UnoControlModelEntryList();
+ ~UnoControlModelEntryList();
+
+ const ::rtl::OUString& GetName() const { return maGroupName; }
+ void SetName( const ::rtl::OUString& rName ) { maGroupName = rName; }
+
+ void Reset();
+ void DestroyEntry( sal_uInt32 nEntry );
+};
+
+struct UnoControlModelEntry
+{
+ sal_Bool bGroup;
+ union
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >* pxControl;
+ UnoControlModelEntryList* pGroup;
+ };
+};
+
+// Keine Referenz halten, nur temporaer fuer AutoTabOrder
+struct ComponentEntry
+{
+ ::com::sun::star::awt::XWindow* pComponent;
+ Point aPos;
+};
+
+DECLARE_LIST( ComponentEntryList, ComponentEntry* )
+
+#define CONTROLPOS_NOTFOUND 0xFFFFFFFF
+
+class StdTabControllerModel : public ::com::sun::star::awt::XTabControllerModel,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::io::XPersistObject,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ::osl::Mutex maMutex;
+ UnoControlModelEntryList maControls;
+ sal_Bool mbGroupControl;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+ sal_uInt32 ImplGetControlCount( const UnoControlModelEntryList& rList ) const;
+ void ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** pRefs, const UnoControlModelEntryList& rList ) const;
+ void ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const;
+ sal_uInt32 ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const;
+
+public:
+ StdTabControllerModel();
+ ~StdTabControllerModel();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTabControllerModel
+ sal_Bool SAL_CALL getGroupControl( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getGroupCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, ::rtl::OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getGroupByName( const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO( StdTabControllerModel, szServiceName2_TabControllerModel )
+};
+
+
+
+#endif // _TOOLKIT_HELPER_STDTABCONTROLLERMODEL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/tkscrollbar.hxx b/toolkit/inc/toolkit/controls/tkscrollbar.hxx
new file mode 100644
index 000000000000..78795aa240c2
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tkscrollbar.hxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TOOLKIT_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
+#define TOOLKIT_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <com/sun/star/awt/XScrollBar.hpp>
+#include <com/sun/star/awt/XAdjustmentListener.hpp>
+#include <com/sun/star/awt/AdjustmentType.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= UnoControlScrollBarModel
+ //====================================================================
+ class UnoControlScrollBarModel : public UnoControlModel
+ {
+ protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ public:
+ UnoControlScrollBarModel();
+ UnoControlScrollBarModel( const UnoControlScrollBarModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlScrollBarModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlScrollBarModel, UnoControlModel, szServiceName2_UnoControlScrollBarModel )
+ };
+
+ //====================================================================
+ //= UnoControlScrollBarModel
+ //====================================================================
+ class UnoScrollBarControl : public UnoControlBase,
+ public ::com::sun::star::awt::XAdjustmentListener,
+ public ::com::sun::star::awt::XScrollBar
+ {
+ private:
+ AdjustmentListenerMultiplexer maAdjustmentListeners;
+
+ public:
+ UnoScrollBarControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XAdjustmentListener
+ void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XScrollBar
+ void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMaximum( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLineIncrement( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getBlockIncrement( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getVisibleSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getOrientation( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoScrollBarControl, UnoControlBase, szServiceName2_UnoControlScrollBar )
+ };
+
+
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif // TOOLKIT_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
diff --git a/toolkit/inc/toolkit/controls/tksimpleanimation.hxx b/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
new file mode 100644
index 000000000000..697d1679af45
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
@@ -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.
+ *
+ ************************************************************************/
+#ifndef TOOLKIT_CONTROLS_TKSIMPLEANIMATION_HXX
+#define TOOLKIT_CONTROLS_TKSIMPLEANIMATION_HXX
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/XSimpleAnimation.hpp>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= UnoSimpleAnimationControlModel
+ //====================================================================
+ class UnoSimpleAnimationControlModel : public UnoControlModel
+ {
+ protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ public:
+ UnoSimpleAnimationControlModel();
+ UnoSimpleAnimationControlModel( const UnoSimpleAnimationControlModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoSimpleAnimationControlModel( *this ); }
+
+ // XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+ //====================================================================
+ //= UnoSimpleAnimationControl
+ //====================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSimpleAnimation
+ > UnoSimpleAnimationControl_Base;
+
+ class UnoSimpleAnimationControl :public UnoControlBase
+ ,public UnoSimpleAnimationControl_Base
+ {
+ private:
+
+ public:
+ UnoSimpleAnimationControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ DECLARE_UNO3_AGG_DEFAULTS( UnoSimpleAnimationControl, UnoControlBase );
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XSimpleAnimation
+ virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageList( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& ImageList )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif // TOOLKIT_CONTROLS_TKSIMPLEANIMATION_HXX
diff --git a/toolkit/inc/toolkit/controls/tkspinbutton.hxx b/toolkit/inc/toolkit/controls/tkspinbutton.hxx
new file mode 100644
index 000000000000..48c602f76cfc
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tkspinbutton.hxx
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TOOLKIT_CONTROLS_TKSPINBUTTON_HXX
+#define TOOLKIT_CONTROLS_TKSPINBUTTON_HXX
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <com/sun/star/awt/XSpinValue.hpp>
+#include <com/sun/star/awt/XAdjustmentListener.hpp>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= UnoSpinButtonModel
+ //====================================================================
+ class UnoSpinButtonModel : public UnoControlModel
+ {
+ protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ public:
+ UnoSpinButtonModel();
+ UnoSpinButtonModel( const UnoSpinButtonModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoSpinButtonModel( *this ); }
+
+ // XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+ //====================================================================
+ //= UnoSpinButtonControl
+ //====================================================================
+
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::XAdjustmentListener
+ , ::com::sun::star::awt::XSpinValue
+ > UnoSpinButtonControl_Base;
+
+ class UnoSpinButtonControl :public UnoControlBase
+ ,public UnoSpinButtonControl_Base
+ {
+ private:
+ AdjustmentListenerMultiplexer maAdjustmentListeners;
+
+ public:
+ UnoSpinButtonControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ DECLARE_UNO3_AGG_DEFAULTS( UnoSpinButtonControl, UnoControlBase );
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XAdjustmentListener
+ void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XSpinValue
+ virtual void SAL_CALL addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValue( sal_Int32 value ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMinimum( sal_Int32 minValue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaximum( sal_Int32 maxValue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMinimum( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getMaximum( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSpinIncrement( sal_Int32 spinIncrement ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSpinIncrement( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setOrientation( sal_Int32 orientation ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getOrientation( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif // TOOLKIT_CONTROLS_TKSPINBUTTON_HXX
diff --git a/toolkit/inc/toolkit/controls/tkthrobber.hxx b/toolkit/inc/toolkit/controls/tkthrobber.hxx
new file mode 100644
index 000000000000..d6c3a3d8a511
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tkthrobber.hxx
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 TOOLKIT_CONTROLS_TKTHROBBER_HXX
+#define TOOLKIT_CONTROLS_TKTHROBBER_HXX
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/XThrobber.hpp>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= UnoThrobberControlModel
+ //====================================================================
+ class UnoThrobberControlModel : public UnoControlModel
+ {
+ protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ public:
+ UnoThrobberControlModel();
+ UnoThrobberControlModel( const UnoThrobberControlModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoThrobberControlModel( *this ); }
+
+ // XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+ //====================================================================
+ //= UnoThrobberControl
+ //====================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XThrobber
+ > UnoThrobberControl_Base;
+
+ class UnoThrobberControl :public UnoControlBase
+ ,public UnoThrobberControl_Base
+ {
+ private:
+
+ public:
+ UnoThrobberControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ DECLARE_UNO3_AGG_DEFAULTS( UnoThrobberControl, UnoControlBase );
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XThrobber
+ virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif // TOOLKIT_CONTROLS_TKTHROBBER_HXX
diff --git a/toolkit/inc/toolkit/controls/unocontrol.hxx b/toolkit/inc/toolkit/controls/unocontrol.hxx
new file mode 100644
index 000000000000..578b5070e8e8
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrol.hxx
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
+#define _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XWindow2.hpp>
+#ifndef _COM_SUN_STAR_AWT_XView_HPP_
+#include <com/sun/star/awt/XView.hpp>
+#endif
+#include <com/sun/star/beans/XPropertiesChangeListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <cppuhelper/weakagg.hxx>
+#include <osl/mutex.hxx>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase7.hxx>
+#include <com/sun/star/util/XModeChangeBroadcaster.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+
+
+struct UnoControlComponentInfos
+{
+ sal_Bool bVisible;
+ sal_Bool bEnable;
+ long nX, nY, nWidth, nHeight;
+ sal_uInt16 nFlags;
+ float nZoomX, nZoomY;
+
+ UnoControlComponentInfos()
+ {
+ bVisible = sal_True;
+ bEnable = sal_True;
+ nX = nY = nWidth = nHeight = 0;
+ nFlags = 0; // POSSIZE_POSSIZE;
+ nZoomX = nZoomY = 1.0f;
+ }
+};
+
+struct UnoControl_Data;
+// ----------------------------------------------------
+// class UnoControl
+// ----------------------------------------------------
+typedef ::cppu::WeakAggImplHelper7 < ::com::sun::star::awt::XControl
+ , ::com::sun::star::awt::XWindow2
+ , ::com::sun::star::awt::XView
+ , ::com::sun::star::beans::XPropertiesChangeListener
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::accessibility::XAccessible
+ , ::com::sun::star::util::XModeChangeBroadcaster
+ > UnoControl_Base;
+
+class TOOLKIT_DLLPUBLIC UnoControl : public UnoControl_Base
+{
+private:
+ ::osl::Mutex maMutex;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > mxPeer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > mxVclWindowPeer; // just to avoid the query_interface thing
+
+protected:
+ EventListenerMultiplexer maDisposeListeners;
+ WindowListenerMultiplexer maWindowListeners;
+ FocusListenerMultiplexer maFocusListeners;
+ KeyListenerMultiplexer maKeyListeners;
+ MouseListenerMultiplexer maMouseListeners;
+ MouseMotionListenerMultiplexer maMouseMotionListeners;
+ PaintListenerMultiplexer maPaintListeners;
+ ::cppu::OInterfaceContainerHelper maModeChangeListeners;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > mxModel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > mxGraphics;
+
+ ::com::sun::star::uno::WeakReferenceHelper
+ maAccessibleContext; /// our most recent XAccessibleContext instance
+
+ sal_Bool mbDisposePeer;
+ sal_Bool mbRefeshingPeer;
+ sal_Bool mbCreatingPeer;
+ sal_Bool mbCreatingCompatiblePeer;
+ sal_Bool mbDesignMode;
+
+ UnoControlComponentInfos maComponentInfos;
+ UnoControl_Data* mpData;
+
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > getParentPeer() const;
+ void updateFromModel();
+ void peerCreated();
+ bool ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer );
+ virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+ virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc );
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents );
+
+ void ImplLockPropertyChangeNotification( const ::rtl::OUString& rPropertyName, bool bLock );
+ void ImplLockPropertyChangeNotifications( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, bool bLock );
+
+ void disposeAccessibleContext();
+
+ inline void setPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& _xPeer)
+ {
+ mxPeer = _xPeer;
+ mxVclWindowPeer = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >(mxPeer,::com::sun::star::uno::UNO_QUERY); // just to avoid the query_interface thing
+ }
+
+ virtual sal_Bool requiresNewPeer( const ::rtl::OUString& _rPropertyName ) const;
+
+public:
+ UnoControl();
+ ~UnoControl();
+
+ UnoControlComponentInfos& GetComponentInfos() { return maComponentInfos; }
+
+
+ virtual ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow2
+ virtual void SAL_CALL setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getOutputSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isVisible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isActive( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isEnabled( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasFocus( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getPosSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEnable( sal_Bool Enable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFocus( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XView
+ sal_Bool SAL_CALL setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& aDevice ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > SAL_CALL getGraphics( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setZoom( float fZoomX, float fZoomY ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL setContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Context ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isDesignMode( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ ::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);
+
+ // XModeChangeBroadcaster
+ virtual void SAL_CALL addModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModeChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeModeChangeApproveListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModeChangeApproveListener >& _rxListener ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ // ::com::sun::star::beans::XPropertiesChangeListener
+ void SAL_CALL propertiesChange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_CONTROLS_UNOCONTROL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolbase.hxx b/toolkit/inc/toolkit/controls/unocontrolbase.hxx
new file mode 100644
index 000000000000..60dcc040e0e7
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolbase.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 _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
+#define _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
+
+#include <com/sun/star/awt/Size.hpp>
+
+#include <toolkit/controls/unocontrol.hxx>
+
+// ----------------------------------------------------
+// class UnoControlBase
+// ----------------------------------------------------
+
+class UnoControlBase : public UnoControl
+{
+protected:
+ sal_Bool ImplHasProperty( sal_uInt16 nProp );
+ sal_Bool ImplHasProperty( const ::rtl::OUString& aPropertyName );
+ void ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis );
+ void ImplSetPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Bool bUpdateThis );
+ ::com::sun::star::uno::Any ImplGetPropertyValue( const ::rtl::OUString& aPropertyName );
+
+ sal_Bool ImplGetPropertyValue_BOOL( sal_uInt16 nProp );
+ sal_Int16 ImplGetPropertyValue_INT16( sal_uInt16 nProp );
+ sal_uInt16 ImplGetPropertyValue_UINT16( sal_uInt16 nProp );
+ sal_Int32 ImplGetPropertyValue_INT32( sal_uInt16 nProp );
+ sal_uInt32 ImplGetPropertyValue_UINT32( sal_uInt16 nProp );
+ double ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp );
+ ::rtl::OUString ImplGetPropertyValue_UString( sal_uInt16 nProp );
+
+ // XLayoutConstrains (nur wenn das Control es unterstuetzt!)
+ ::com::sun::star::awt::Size Impl_getMinimumSize();
+ ::com::sun::star::awt::Size Impl_getPreferredSize();
+ ::com::sun::star::awt::Size Impl_calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize );
+
+ // XTextLayoutConstrains (nur wenn das Control es unterstuetzt!)
+ ::com::sun::star::awt::Size Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines );
+ void Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines );
+};
+
+
+
+#endif // _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
new file mode 100644
index 000000000000..1175d0e85abb
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
+#define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
+
+
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XUnoControlContainer.hpp>
+#include <com/sun/star/container/XContainer.hpp>
+#include <com/sun/star/container/XIdentifierContainer.hpp>
+
+#include <toolkit/controls/unocontrol.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+#include <cppuhelper/implbase4.hxx>
+
+class UnoControlHolderList;
+
+// ----------------------------------------------------
+// class UnoControlContainer
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
+ , ::com::sun::star::awt::XUnoControlContainer
+ , ::com::sun::star::awt::XControlContainer
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XIdentifierContainer
+ > UnoControlContainer_Base;
+
+class UnoControlContainer : public UnoControlContainer_Base
+{
+private:
+ UnoControlHolderList* mpControls;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > maTabControllers;
+ ContainerListenerMultiplexer maCListeners;
+
+protected:
+ void ImplActivateTabControllers();
+
+public:
+ UnoControlContainer();
+ UnoControlContainer( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer );
+ ~UnoControlContainer();
+
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XEventListener
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XContainer
+ void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XIdentifierContainer
+ virtual ::sal_Int32 SAL_CALL insert( const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XIdentifierReplace
+ virtual void SAL_CALL removeByIdentifier( ::sal_Int32 Identifier ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL replaceByIdentifer( ::sal_Int32 Identifier, const ::com::sun::star::uno::Any& aElement ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XIdentifierAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIdentifier( ::sal_Int32 Identifierr ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getIdentifiers( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControlContainer
+ void SAL_CALL setStatusText( const ::rtl::OUString& StatusText ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > > SAL_CALL getControls( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL getControl( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addControl( const ::rtl::OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& Control ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XUnoControlContainer
+ void SAL_CALL setTabControllers( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > >& TabControllers ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > > SAL_CALL getTabControllers( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTabController( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController >& TabController ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XWindow
+ void SAL_CALL setVisible( sal_Bool Visible ) throw(::com::sun::star::uno::RuntimeException);
+
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlContainer, UnoControlBase, szServiceName2_UnoControlContainer )
+
+protected:
+ virtual void removingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+ virtual void addingControl( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl );
+
+private:
+ /** adds the control to the container, does necessary notifications, and the like
+ @param _rxControl
+ the control to add. Must not be <NULL/>
+ @param _pName
+ Pointer to a name for the control. Might be <NULL/>, in this case an auotmatic name is generated
+ @return
+ the ID of the newly added control
+ */
+ sal_Int32 impl_addControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
+ const ::rtl::OUString* _pName = NULL
+ );
+
+ /** removes the given control from the container, including necessary notifications and the like
+ @param _nId
+ the ID of the control to remove
+ @param _rxControl
+ the control itself. Must be the one which is stored under the given ID. This parameter could also be
+ obtained inside the method, but callers usually have obtained it, anyway.
+ @param _pNameAccessor
+ the name which the control was registered for. Might be <NULL/>, in this case
+ container event broadcasts use the ID as accessor.
+ */
+ void impl_removeControl(
+ sal_Int32 _nId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
+ const ::rtl::OUString* _pNameAccessor
+ );
+
+ /** ensures that the given control has a peer, if necessary and possible
+ @param _rxControl
+ an ->XControl which has just been inserted into the container. Must not be <NULL/>.
+ @precond
+ our mutex is locked
+ */
+ void impl_createControlPeerIfNecessary(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl
+ );
+};
+
+
+
+#endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINER_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx
new file mode 100644
index 000000000000..ef0d9a4068ee
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainermodel.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 _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_
+#define _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_
+
+
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+
+// ----------------------------------------------------
+// class ::com::sun::star::awt::UnoControlContainerModel
+// ----------------------------------------------------
+class UnoControlContainerModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlContainerModel();
+ UnoControlContainerModel( const UnoControlContainerModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlContainerModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlContainerModel, UnoControlModel, szServiceName2_UnoControlContainerModel )
+};
+
+
+
+#endif // _TOOLKIT_CONTROLS_UNOCONTROLCONTAINERMODEL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrolmodel.hxx b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
new file mode 100644
index 000000000000..2de5e36aa02c
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_
+#define _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_
+
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <cppuhelper/weakagg.hxx>
+#include <osl/mutex.hxx>
+
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <list>
+
+class ImplPropertyTable;
+
+// ----------------------------------------------------
+// class UnoControlModel
+// ----------------------------------------------------
+
+class UnoControlModel : public ::com::sun::star::awt::XControlModel,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::io::XPersistObject,
+ public ::com::sun::star::lang::XComponent,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::com::sun::star::lang::XUnoTunnel,
+ public ::com::sun::star::util::XCloneable,
+ public MutexAndBroadcastHelper,
+ public ::cppu::OPropertySetHelper,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ImplPropertyTable* mpData;
+ EventListenerMultiplexer maDisposeListeners;
+
+protected:
+ void ImplRegisterProperty( sal_uInt16 nPropType );
+ void ImplRegisterProperties( const std::list< sal_uInt16 > &rIds );
+ void ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault );
+ ::com::sun::star::uno::Sequence<sal_Int32> ImplGetPropertyIds() const;
+ virtual void ImplPropertyChanged( sal_uInt16 nPropId );
+ virtual ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const;
+
+ /** called before setting multiple properties, allows to care for property dependencies
+
+ <p>When multiple property values are set (e.g. XPropertySet::setPropertyValues), it may happen that some
+ of them are dependent. For this, derivees which know such dependencies can affect the order in which
+ the properties are internally really set.</p>
+ */
+ virtual void ImplNormalizePropertySequence(
+ const sal_Int32 _nCount, /// the number of entries in the arrays
+ sal_Int32* _pHandles, /// the handles of the properties to set
+ ::com::sun::star::uno::Any* _pValues, /// the values of the properties to set
+ sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
+ ) const SAL_THROW(());
+
+ /// ensures that two property values in a sequence have a certain order
+ void ImplEnsureHandleOrder(
+ const sal_Int32 _nCount, /// number of entries in the array
+ sal_Int32* _pHandles, /// pointer to the handles
+ ::com::sun::star::uno::Any* _pValues, /// pointer to the values
+ sal_Int32 _nFirstHandle, /// first handle, which should precede _nSecondHandle in the sequence
+ sal_Int32 _nSecondHandle /// second handle, which should supersede _nFirstHandle in the sequence
+ ) const;
+
+public:
+ UnoControlModel();
+ UnoControlModel( const UnoControlModel& rModel );
+ ~UnoControlModel();
+
+ virtual UnoControlModel* Clone() const = 0;
+
+ // ::com::sun::star::uno::XAggregation
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return OWeakAggObject::queryInterface(rType); }
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XUnoTunnel
+ static const ::com::sun::star::uno::Sequence< sal_Int8 >& GetUnoTunnelId() throw();
+ static UnoControlModel* GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw();
+ sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::util::XCloneable
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControlModel
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyState
+ ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::cppu::OPropertySetHelper
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0;
+ sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException);
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+ using cppu::OPropertySetHelper::getFastPropertyValue;
+ void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+ // setValue-Methoden ueberladen, um die Einzelproperties des FontDescriptors abzufangen
+ // ::com::sun::star::beans::XPropertySet
+ void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::beans::XFastPropertySet
+ void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+#define UNO_CONTROL_MODEL_REGISTER_PROPERTIES(a) \
+ do { \
+ std::list< sal_uInt16 > aIds; \
+ a::ImplGetPropertyIds( aIds ); \
+ ImplRegisterProperties( aIds ); \
+ } while (0)
+
+#endif // _TOOLKIT_AWT_UNOCONTROLMODEL_HXX_
+
diff --git a/toolkit/inc/toolkit/controls/unocontrols.hxx b/toolkit/inc/toolkit/controls/unocontrols.hxx
new file mode 100644
index 000000000000..a4015dfd3b44
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -0,0 +1,1434 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_HELPER_UNOCONTROLS_HXX_
+#define _TOOLKIT_HELPER_UNOCONTROLS_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XTextListener.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XToggleButton.hpp>
+#include <com/sun/star/awt/XImageConsumer.hpp>
+#include <com/sun/star/awt/XImageProducer.hpp>
+#include <com/sun/star/awt/XRadioButton.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XFixedHyperlink.hpp>
+#include <com/sun/star/awt/XFixedText.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <com/sun/star/awt/XDateField.hpp>
+#include <com/sun/star/awt/XSpinField.hpp>
+#include <com/sun/star/awt/XTimeField.hpp>
+#include <com/sun/star/awt/XNumericField.hpp>
+#include <com/sun/star/awt/XCurrencyField.hpp>
+#include <com/sun/star/awt/XPatternField.hpp>
+#include <com/sun/star/awt/XProgressBar.hpp>
+#include <com/sun/star/graphic/XGraphicObject.hpp>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <vcl/imgcons.hxx>
+#include <vcl/bitmapex.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+
+#include <list>
+
+#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
+
+
+// ----------------------------------------------------
+// class UnoControlEditModel
+// ----------------------------------------------------
+class UnoControlEditModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlEditModel();
+ UnoControlEditModel( const UnoControlEditModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlEditModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlEditModel, UnoControlModel, szServiceName2_UnoControlEditModel )
+};
+
+// ----------------------------------------------------
+// class UnoEditControl
+// ----------------------------------------------------
+typedef ::cppu::ImplHelper4 < ::com::sun::star::awt::XTextComponent
+ , ::com::sun::star::awt::XTextListener
+ , ::com::sun::star::awt::XLayoutConstrains
+ , ::com::sun::star::awt::XTextLayoutConstrains
+ > UnoEditControl_Base;
+class TOOLKIT_DLLPUBLIC UnoEditControl :public UnoControlBase
+ ,public UnoEditControl_Base
+{
+private:
+ TextListenerMultiplexer maTextListeners;
+
+ // Not all fields derived from UnoEditCOntrol have the property "Text"
+ // They only support XTextComponent, so keep the text
+ // here, maybe there is no Peer when calling setText()...
+ ::rtl::OUString maText;
+ USHORT mnMaxTextLen;
+
+ sal_Bool mbSetTextInPeer;
+ sal_Bool mbSetMaxTextLenInPeer;
+ sal_Bool mbHasTextProperty;
+
+public:
+
+ UnoEditControl();
+ ::rtl::OUString GetComponentServiceName();
+ TextListenerMultiplexer& GetTextListeners() { return maTextListeners; }
+
+ void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // disambiguate XInterface
+ DECLARE_XINTERFACE()
+
+ // XAggregation
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTextComponent
+ void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL insertText( const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Selection SAL_CALL getSelection( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEditable( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getMaxTextLen( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoEditControl, UnoControlBase, szServiceName2_UnoControlEdit )
+
+ sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
+};
+
+// ----------------------------------------------------
+// class UnoControlFileControlModel
+// ----------------------------------------------------
+class UnoControlFileControlModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlFileControlModel();
+ UnoControlFileControlModel( const UnoControlFileControlModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlFileControlModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlFileControlModel, UnoControlModel, szServiceName2_UnoControlFileControlModel )
+};
+
+// ----------------------------------------------------
+// class UnoFileControl
+// ----------------------------------------------------
+class UnoFileControl : public UnoEditControl
+{
+public:
+ UnoFileControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFileControl, UnoEditControl, szServiceName2_UnoControlFileControl )
+};
+
+// ----------------------------------------------------
+// class ImageProducerControlModel
+// ----------------------------------------------------
+class ImageProducerControlModel : public ::com::sun::star::awt::XImageProducer,
+ public UnoControlModel
+{
+private:
+ std::list< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > maListeners;
+ bool mbAdjustingImagePosition;
+ bool mbAdjustingGraphic;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphicObject > mxGrfObj;
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
+protected:
+ ImageProducerControlModel() : mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+ ImageProducerControlModel( const ImageProducerControlModel& _rSource ) : com::sun::star::awt::XImageProducer(), UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+
+ // ::com::sun::star::awt::XImageProducer
+ void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::cppu::OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
+ // UnoControlModel
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+
+private:
+ ImageProducerControlModel& operator=( const ImageProducerControlModel& ); // never implemented
+};
+
+// ----------------------------------------------------
+// class ImageConsumerControl
+// ----------------------------------------------------
+class ImageConsumerControl : public UnoControlBase
+{
+protected:
+ ImageConsumerControl() { }
+
+ void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+
+ // XControl
+ sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ ImageConsumerControl( const ImageConsumerControl& ); // never implemented
+ ImageConsumerControl& operator=( const ImageConsumerControl& ); // never implemented
+};
+
+// ----------------------------------------------------
+// class UnoControlButtonModel
+// ----------------------------------------------------
+class UnoControlButtonModel : public ImageProducerControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlButtonModel();
+ UnoControlButtonModel( const UnoControlButtonModel& rModel ) : ImageProducerControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlButtonModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlButtonModel, ImageProducerControlModel, szServiceName2_UnoControlButtonModel )
+};
+
+// ----------------------------------------------------
+// class UnoButtonControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper4 < ImageConsumerControl
+ , ::com::sun::star::awt::XButton
+ , ::com::sun::star::awt::XToggleButton
+ , ::com::sun::star::awt::XLayoutConstrains
+ , ::com::sun::star::awt::XItemListener
+ > UnoButtonControl_Base;
+class UnoButtonControl : public UnoButtonControl_Base
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+ ::rtl::OUString maActionCommand;
+
+public:
+
+ UnoButtonControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XToggleButton
+ // ::com::sun::star::awt::XItemEventBroadcaster
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XItemListener
+ virtual void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoButtonControl, ImageConsumerControl, szServiceName2_UnoControlButton )
+};
+
+// ----------------------------------------------------
+// class UnoControlImageControlModel
+// ----------------------------------------------------
+class UnoControlImageControlModel : public ImageProducerControlModel
+{
+private:
+ bool mbAdjustingImageScaleMode;
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlImageControlModel();
+ UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : ImageProducerControlModel( rModel ), mbAdjustingImageScaleMode( false ) { }
+
+ UnoControlModel* Clone() const { return new UnoControlImageControlModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlImageControlModel, ImageProducerControlModel, szServiceName2_UnoControlImageControlModel )
+
+ // ::cppu::OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+};
+
+// ----------------------------------------------------
+// class UnoImageControlControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper1 < ImageConsumerControl
+ , ::com::sun::star::awt::XLayoutConstrains
+ > UnoImageControlControl_Base;
+class UnoImageControlControl : public UnoImageControlControl_Base
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+public:
+
+ UnoImageControlControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoImageControlControl, ImageConsumerControl, szServiceName2_UnoControlImageControl )
+};
+
+// ----------------------------------------------------
+// class UnoControlRadioButtonModel
+// ----------------------------------------------------
+class UnoControlRadioButtonModel : public ImageProducerControlModel
+
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlRadioButtonModel();
+ UnoControlRadioButtonModel( const UnoControlRadioButtonModel& rModel ) : ImageProducerControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlRadioButtonModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlRadioButtonModel, ImageProducerControlModel, szServiceName2_UnoControlRadioButtonModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoRadioButtonControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper4 < ImageConsumerControl
+ , ::com::sun::star::awt::XButton
+ , ::com::sun::star::awt::XRadioButton
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::awt::XLayoutConstrains
+ > UnoRadioButtonControl_Base;
+class UnoRadioButtonControl : public UnoRadioButtonControl_Base
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+public:
+
+ UnoRadioButtonControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { ImageConsumerControl::disposing( Source ); }
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XRadioButton
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XItemListener
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoRadioButtonControl, ImageConsumerControl, szServiceName2_UnoControlRadioButton )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlCheckBoxModel
+// ----------------------------------------------------
+class UnoControlCheckBoxModel : public ImageProducerControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlCheckBoxModel();
+ UnoControlCheckBoxModel( const UnoControlCheckBoxModel& rModel ) : ImageProducerControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlCheckBoxModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlCheckBoxModel, ImageProducerControlModel, szServiceName2_UnoControlCheckBoxModel )
+};
+
+// ----------------------------------------------------
+// class UnoCheckBoxControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper4 < ImageConsumerControl
+ , ::com::sun::star::awt::XButton
+ , ::com::sun::star::awt::XCheckBox
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::awt::XLayoutConstrains
+ > UnoCheckBoxControl_Base;
+class UnoCheckBoxControl : public UnoCheckBoxControl_Base
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+public:
+
+ UnoCheckBoxControl();
+ ~UnoCheckBoxControl(){;}
+ ::rtl::OUString GetComponentServiceName();
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { ImageConsumerControl::disposing( Source ); }
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XButton
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setActionCommand( const ::rtl::OUString& Command ) throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw (::com::sun::star::uno::RuntimeException);
+
+
+ sal_Int16 SAL_CALL getState( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setState( sal_Int16 n ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLabel( const ::rtl::OUString& Label ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XItemListener
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoCheckBoxControl, ImageConsumerControl, szServiceName2_UnoControlCheckBox )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlFixedTextModel
+// ----------------------------------------------------
+class UnoControlFixedHyperlinkModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlFixedHyperlinkModel();
+ UnoControlFixedHyperlinkModel( const UnoControlFixedHyperlinkModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlFixedHyperlinkModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlFixedHyperlinkModel, UnoControlModel, szServiceName_UnoControlFixedHyperlinkModel )
+};
+
+// ----------------------------------------------------
+// class UnoFixedHyperlinkControl
+// ----------------------------------------------------
+class UnoFixedHyperlinkControl : public UnoControlBase,
+ public ::com::sun::star::awt::XFixedHyperlink,
+ public ::com::sun::star::awt::XLayoutConstrains
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+
+public:
+ UnoFixedHyperlinkControl();
+
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XFixedHyperlink
+ void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getURL( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFixedHyperlinkControl, UnoControlBase, szServiceName_UnoControlFixedHyperlink )
+};
+
+// ----------------------------------------------------
+// class UnoControlFixedTextModel
+// ----------------------------------------------------
+class UnoControlFixedTextModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlFixedTextModel();
+ UnoControlFixedTextModel( const UnoControlFixedTextModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlFixedTextModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlFixedTextModel, UnoControlModel, szServiceName2_UnoControlFixedTextModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoFixedTextControl
+// ----------------------------------------------------
+class UnoFixedTextControl : public UnoControlBase,
+ public ::com::sun::star::awt::XFixedText,
+ public ::com::sun::star::awt::XLayoutConstrains
+{
+public:
+ UnoFixedTextControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XFixedText
+ void SAL_CALL setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setAlignment( sal_Int16 nAlign ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getAlignment( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFixedTextControl, UnoControlBase, szServiceName2_UnoControlFixedText )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlGroupBoxModel
+// ----------------------------------------------------
+class UnoControlGroupBoxModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlGroupBoxModel();
+ UnoControlGroupBoxModel( const UnoControlGroupBoxModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlGroupBoxModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlGroupBoxModel, UnoControlModel, szServiceName2_UnoControlGroupBoxModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoGroupBoxControl
+// ----------------------------------------------------
+class UnoGroupBoxControl : public UnoControlBase
+{
+public:
+ UnoGroupBoxControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoGroupBoxControl, UnoControlBase, szServiceName2_UnoControlGroupBox )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlListBoxModel
+// ----------------------------------------------------
+class UnoControlListBoxModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlListBoxModel();
+ UnoControlListBoxModel( const UnoControlListBoxModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlListBoxModel( *this ); }
+
+ void ImplPropertyChanged( sal_uInt16 nPropId );
+ virtual void ImplNormalizePropertySequence(
+ const sal_Int32 _nCount, /// the number of entries in the arrays
+ sal_Int32* _pHandles, /// the handles of the properties to set
+ ::com::sun::star::uno::Any* _pValues, /// the values of the properties to set
+ sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted
+ ) const SAL_THROW(());
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoListBoxControl
+// ----------------------------------------------------
+class UnoListBoxControl : public UnoControlBase,
+ public ::com::sun::star::awt::XListBox,
+ public ::com::sun::star::awt::XItemListener,
+ public ::com::sun::star::awt::XLayoutConstrains,
+ public ::com::sun::star::awt::XTextLayoutConstrains
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+public:
+
+ UnoListBoxControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ void ImplUpdateSelectedItemsProperty();
+ void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoControlBase::disposing( Source ); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XListBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getSelectedItemPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getSelectedItem( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItemsPos( const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isMutipleMode( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XItemListener
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL calcAdjustedSize( const ::com::sun::star::awt::Size& aNewSize ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextLayoutConstrains
+ ::com::sun::star::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlComboBoxModel
+// ----------------------------------------------------
+class UnoControlComboBoxModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlComboBoxModel();
+ UnoControlComboBoxModel( const UnoControlComboBoxModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlComboBoxModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoComboBoxControl
+// ----------------------------------------------------
+class UnoComboBoxControl : public UnoEditControl,
+ public ::com::sun::star::awt::XComboBox
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+public:
+
+ UnoComboBoxControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XComboBox
+ void SAL_CALL addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getItemCount( ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDropDownLineCount( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox )
+
+};
+
+// ----------------------------------------------------
+// class UnoSpinFieldControl
+// ----------------------------------------------------
+class UnoSpinFieldControl : public UnoEditControl,
+ public ::com::sun::star::awt::XSpinField
+{
+private:
+ SpinListenerMultiplexer maSpinListeners;
+ BOOL mbRepeat;
+
+public:
+ UnoSpinFieldControl();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoEditControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XSpinField
+ void SAL_CALL addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL up() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL down() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL first() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL last() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ // ::com::sun::star::lang::XServiceInfo
+ // No service info, only base class for other fields.
+};
+
+
+// ----------------------------------------------------
+// class UnoControlDateFieldModel
+// ----------------------------------------------------
+class UnoControlDateFieldModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlDateFieldModel();
+ UnoControlDateFieldModel( const UnoControlDateFieldModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlDateFieldModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlDateFieldModel, UnoControlModel, szServiceName2_UnoControlDateFieldModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoDateFieldControl
+// ----------------------------------------------------
+class UnoDateFieldControl : public UnoSpinFieldControl,
+ public ::com::sun::star::awt::XDateField
+{
+private:
+ sal_Int32 mnFirst;
+ sal_Int32 mnLast;
+ sal_Bool mbLongFormat;
+public:
+ UnoDateFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XDateField
+ void SAL_CALL setDate( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getDate( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Date ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isLongFormat( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoDateFieldControl, UnoSpinFieldControl, szServiceName2_UnoControlDateField )
+};
+
+// ----------------------------------------------------
+// class UnoControlTimeFieldModel
+// ----------------------------------------------------
+class UnoControlTimeFieldModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlTimeFieldModel();
+ UnoControlTimeFieldModel( const UnoControlTimeFieldModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlTimeFieldModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTimeFieldModel, UnoControlModel, szServiceName2_UnoControlTimeFieldModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoTimeFieldControl
+// ----------------------------------------------------
+class UnoTimeFieldControl : public UnoSpinFieldControl,
+ public ::com::sun::star::awt::XTimeField
+{
+private:
+ sal_Int32 mnFirst;
+ sal_Int32 mnLast;
+
+public:
+ UnoTimeFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ //XTimeField
+ void SAL_CALL setTime( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getTime( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( sal_Int32 Time ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isEmpty( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoTimeFieldControl, UnoSpinFieldControl, szServiceName2_UnoControlTimeField )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlNumericFieldModel
+// ----------------------------------------------------
+class UnoControlNumericFieldModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlNumericFieldModel();
+ UnoControlNumericFieldModel( const UnoControlNumericFieldModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlNumericFieldModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlNumericFieldModel, UnoControlModel, szServiceName2_UnoControlNumericFieldModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoNumericFieldControl
+// ----------------------------------------------------
+class UnoNumericFieldControl : public UnoSpinFieldControl,
+ public ::com::sun::star::awt::XNumericField
+{
+private:
+ double mnFirst;
+ double mnLast;
+
+public:
+ UnoNumericFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XNumericField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoNumericFieldControl, UnoSpinFieldControl, szServiceName2_UnoControlNumericField )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlCurrencyFieldModel
+// ----------------------------------------------------
+class UnoControlCurrencyFieldModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlCurrencyFieldModel();
+ UnoControlCurrencyFieldModel( const UnoControlCurrencyFieldModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlCurrencyFieldModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlCurrencyFieldModel, UnoControlModel, szServiceName2_UnoControlCurrencyFieldModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoCurrencyFieldControl
+// ----------------------------------------------------
+class UnoCurrencyFieldControl : public UnoSpinFieldControl,
+ public ::com::sun::star::awt::XCurrencyField
+{
+private:
+ double mnFirst;
+ double mnLast;
+
+public:
+ UnoCurrencyFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTextListener
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XCurrencyField
+ void SAL_CALL setValue( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getValue( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMin( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMin( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setMax( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getMax( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getFirst( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setLast( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getLast( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException);
+ double SAL_CALL getSpinSize( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL getDecimalDigits( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoCurrencyFieldControl, UnoSpinFieldControl, szServiceName2_UnoControlCurrencyField )
+};
+
+// ----------------------------------------------------
+// class UnoControlPatternFieldModel
+// ----------------------------------------------------
+class UnoControlPatternFieldModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlPatternFieldModel();
+ UnoControlPatternFieldModel( const UnoControlPatternFieldModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlPatternFieldModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlPatternFieldModel, UnoControlModel, szServiceName2_UnoControlPatternFieldModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoPatternFieldControl
+// ----------------------------------------------------
+class UnoPatternFieldControl : public UnoSpinFieldControl,
+ public ::com::sun::star::awt::XPatternField
+{
+protected:
+ void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+
+public:
+ UnoPatternFieldControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoSpinFieldControl::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XPatternField
+ void SAL_CALL setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getString( ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isStrictFormat( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoPatternFieldControl, UnoSpinFieldControl, szServiceName2_UnoControlPatternField )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlProgressBarModel
+// ----------------------------------------------------
+class UnoControlProgressBarModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlProgressBarModel();
+ UnoControlProgressBarModel( const UnoControlProgressBarModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlProgressBarModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlProgressBarModel, UnoControlModel, szServiceName2_UnoControlProgressBarModel )
+};
+
+// ----------------------------------------------------
+// class UnoProgressBarControl
+// ----------------------------------------------------
+class UnoProgressBarControl : public UnoControlBase,
+ public ::com::sun::star::awt::XProgressBar
+{
+public:
+ UnoProgressBarControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) { return UnoControlBase::queryInterface(rType); }
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakAggObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakAggObject::release(); }
+
+ // ::com::sun::star::lang::XTypeProvider
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XProgressBar
+ void SAL_CALL setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException );
+ sal_Int32 SAL_CALL getValue() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoProgressBarControl, UnoControlBase, szServiceName2_UnoControlProgressBar )
+};
+
+
+// ----------------------------------------------------
+// class UnoControlFixedLineModel
+// ----------------------------------------------------
+class UnoControlFixedLineModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlFixedLineModel();
+ UnoControlFixedLineModel( const UnoControlFixedLineModel& rModel ) : UnoControlModel( rModel ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlFixedLineModel( *this ); }
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlFixedLineModel, UnoControlModel, szServiceName2_UnoControlFixedLineModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoFixedLineControl
+// ----------------------------------------------------
+class UnoFixedLineControl : public UnoControlBase
+{
+public:
+ UnoFixedLineControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ sal_Bool SAL_CALL isTransparent( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFixedLineControl, UnoControlBase, szServiceName2_UnoControlFixedLine )
+
+};
+
+
+#endif // _TOOLKIT_HELPER_UNOCONTROLS_HXX_
+
diff --git a/toolkit/inc/toolkit/dllapi.h b/toolkit/inc/toolkit/dllapi.h
new file mode 100644
index 000000000000..02e64153310c
--- /dev/null
+++ b/toolkit/inc/toolkit/dllapi.h
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_DLLAPI_H
+#define TOOLKIT_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined TOOLKIT_DLLIMPLEMENTATION
+#define TOOLKIT_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define TOOLKIT_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
diff --git a/toolkit/inc/toolkit/helper/accessibilityclient.hxx b/toolkit/inc/toolkit/helper/accessibilityclient.hxx
new file mode 100644
index 000000000000..732e2d76279a
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/accessibilityclient.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 TOOLKIT_HELPER_ACCESSIBILITY_CLIENT_HXX
+#define TOOLKIT_HELPER_ACCESSIBILITY_CLIENT_HXX
+
+#include <toolkit/helper/accessiblefactory.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= AccessibilityClient
+ //====================================================================
+ /** a client for the accessibility implementations which have been
+ outsourced from the main toolkit library
+
+ All instances of this class share a reference to a common IAccessibleFactory
+ instance, which is used for creating all kind of Accessibility related
+ components.
+
+ When the AccessibilityClient goes aways, this factory goes aways, to, and the respective
+ library is unloaded.
+
+ This class is not thread-safe.
+ */
+ class AccessibilityClient
+ {
+ private:
+ bool m_bInitialized;
+
+ public:
+ AccessibilityClient();
+ ~AccessibilityClient();
+
+ IAccessibleFactory& getFactory();
+
+ private:
+ void ensureInitialized();
+ };
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_HELPER_ACCESSIBILITY_CLIENT_HXX
+
diff --git a/toolkit/inc/toolkit/helper/accessiblefactory.hxx b/toolkit/inc/toolkit/helper/accessiblefactory.hxx
new file mode 100644
index 000000000000..f3f28287d460
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/accessiblefactory.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 TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX
+#define TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX
+
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+
+#ifndef _RTL_REF_HXX
+#include <rtl/ref.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+ class XAccessibleContext;
+} } } }
+class VCLXButton;
+class VCLXCheckBox;
+class VCLXRadioButton;
+class VCLXListBox;
+class VCLXFixedHyperlink;
+class VCLXFixedText;
+class VCLXScrollBar;
+class VCLXEdit;
+class VCLXComboBox;
+class VCLXToolBox;
+class VCLXWindow;
+class Menu;
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ /** a function which is able to create a factory for the standard Accessible/Context
+ components needed for standard toolkit controls
+
+ The returned pointer denotes an instance of the IAccessibleFactory, which has been acquired
+ <em>once</em>. The caller is responsible for holding this reference as long as it needs the
+ factory, and release it afterwards.
+ */
+ typedef void* (SAL_CALL * GetStandardAccComponentFactory)( );
+
+ //================================================================
+ //= IAccessibleFactory
+ //================================================================
+ class IAccessibleFactory : public ::rtl::IReference
+ {
+ public:
+ /** creates an accessible context for a button window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXButton* _pXWindow ) = 0;
+
+ /** creates an accessible context for a checkbox window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXCheckBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a radio button window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXRadioButton* _pXWindow ) = 0;
+
+ /** creates an accessible context for a listbox window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXListBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a fixed hyperlink window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedHyperlink* _pXWindow ) = 0;
+
+ /** creates an accessible context for a fixed text window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedText* _pXWindow ) = 0;
+
+ /** creates an accessible context for a scrollbar window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXScrollBar* _pXWindow ) = 0;
+
+ /** creates an accessible context for a edit window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXEdit* _pXWindow ) = 0;
+
+ /** creates an accessible context for a combo box window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXComboBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a toolbox window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXToolBox* _pXWindow ) = 0;
+
+ /** creates an accessible context for a generic window
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXWindow* _pXWindow ) = 0;
+
+ /** creates an accessible component for the given menu
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar ) = 0;
+ };
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_HELPER_ACCESSIBLE_FACTORY_HXX
diff --git a/toolkit/inc/toolkit/helper/convert.hxx b/toolkit/inc/toolkit/helper/convert.hxx
new file mode 100644
index 000000000000..5de2b8861abf
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/convert.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_CONVERT_HXX_
+#define _TOOLKIT_HELPER_CONVERT_HXX_
+
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+
+#include <tools/gen.hxx>
+
+inline ::com::sun::star::awt::Size AWTSize( const Size& rVCLSize )
+{
+ return ::com::sun::star::awt::Size( rVCLSize.Width(), rVCLSize.Height() );
+}
+
+inline ::Size VCLSize( const ::com::sun::star::awt::Size& rAWTSize )
+{
+ return ::Size( rAWTSize.Width, rAWTSize.Height );
+}
+
+inline ::com::sun::star::awt::Point AWTPoint( const ::Point& rVCLPoint )
+{
+ return ::com::sun::star::awt::Point( rVCLPoint.X(), rVCLPoint.Y() );
+}
+
+inline ::Point VCLPoint( const ::com::sun::star::awt::Point& rAWTPoint )
+{
+ return ::Point( rAWTPoint.X, rAWTPoint.Y );
+}
+
+inline ::com::sun::star::awt::Rectangle AWTRectangle( const ::Rectangle& rVCLRect )
+{
+ return ::com::sun::star::awt::Rectangle( rVCLRect.Left(), rVCLRect.Top(), rVCLRect.GetWidth(), rVCLRect.GetHeight() );
+}
+
+inline ::Rectangle VCLRectangle( const ::com::sun::star::awt::Rectangle& rAWTRect )
+{
+ return ::Rectangle( ::Point( rAWTRect.X, rAWTRect.Y ), ::Size( rAWTRect.Width, rAWTRect.Height ) );
+}
+
+#endif // _TOOLKIT_HELPER_CONVERT_HXX_
diff --git a/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx b/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx
new file mode 100644
index 000000000000..e35b1395eb54
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/emptyfontdescriptor.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_
+#define _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_
+
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+
+// ----------------------------------------------------
+// class EmptyFontDescriptor
+// ----------------------------------------------------
+class EmptyFontDescriptor : public ::com::sun::star::awt::FontDescriptor
+{
+public:
+ EmptyFontDescriptor()
+ {
+ // Not all enums are initialized correctly in FontDescriptor-CTOR because
+ // they are set to the first enum value, this is not allways the default value.
+ Slant = ::com::sun::star::awt::FontSlant_DONTKNOW;
+ Underline = ::com::sun::star::awt::FontUnderline::DONTKNOW;
+ Strikeout = ::com::sun::star::awt::FontStrikeout::DONTKNOW;
+ }
+};
+
+
+
+
+#endif // _TOOLKIT_HELPER_EMPTYFONTDESCRIPTOR_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/externallock.hxx b/toolkit/inc/toolkit/helper/externallock.hxx
new file mode 100644
index 000000000000..75246a829790
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/externallock.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 _TOOLKIT_HELPER_EXTERNALLOCK_HXX_
+#define _TOOLKIT_HELPER_EXTERNALLOCK_HXX_
+
+#include <toolkit/dllapi.h>
+#include <comphelper/accessiblecontexthelper.hxx>
+
+// -----------------------------------------------------------------------------
+// class VCLExternalSolarLock
+// -----------------------------------------------------------------------------
+
+class TOOLKIT_DLLPUBLIC VCLExternalSolarLock : public ::comphelper::IMutex
+{
+public:
+ virtual void acquire();
+ virtual void release();
+};
+
+#endif // _TOOLKIT_HELPER_EXTERNALLOCK_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/fixedhyperbase.hxx b/toolkit/inc/toolkit/helper/fixedhyperbase.hxx
new file mode 100644
index 000000000000..4688e2a3f33d
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/fixedhyperbase.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX
+#define TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX
+
+#include <toolkit/dllapi.h>
+
+#include <vcl/fixed.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ class TOOLKIT_DLLPUBLIC FixedHyperlinkBase : public FixedText
+ {
+ public:
+ FixedHyperlinkBase( Window* pParent, const ResId& rId );
+ FixedHyperlinkBase( Window* pParent, WinBits nWinStyle );
+ virtual ~FixedHyperlinkBase();
+
+ virtual void SetURL( const String& rNewURL );
+ virtual String GetURL() const;
+ virtual void SetDescription( const String& rNewDescription );
+ };
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_INC_TOOLKIT_HELPER_FIXEDHYPERBASE_HXX
+
diff --git a/toolkit/inc/toolkit/helper/formpdfexport.hxx b/toolkit/inc/toolkit/helper/formpdfexport.hxx
new file mode 100644
index 000000000000..502f25520145
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/formpdfexport.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 _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
+#define _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
+
+#ifndef TOOLKIT_DLLAPI_H
+#include <toolkit/dllapi.h>
+#endif
+
+/** === begin UNO includes === **/
+#ifndef _COM_SUN_STAR_AWT_XCONTROL_HPP_
+#include <com/sun/star/awt/XControl.hpp>
+#endif
+/** === end UNO includes === **/
+
+#ifndef _VCL_PDFWRITER_HXX
+#include <vcl/pdfwriter.hxx>
+#endif
+
+#include <memory>
+
+//........................................................................
+namespace toolkitform
+{
+//........................................................................
+
+ /** creates a PDF compatible control descriptor for the given control
+ */
+ void TOOLKIT_DLLPUBLIC describePDFControl(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxControl,
+ ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor
+ ) SAL_THROW(());
+
+//........................................................................
+} // namespace toolkitform
+//........................................................................
+
+#endif // _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
diff --git a/toolkit/inc/toolkit/helper/imagealign.hxx b/toolkit/inc/toolkit/helper/imagealign.hxx
new file mode 100644
index 000000000000..5d725a692bc6
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/imagealign.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 TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_HXX
+#define TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_HXX
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <sal/types.h>
+
+#include <vcl/button.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ /** translates a VCL ImageAlign value into an css.awt.ImagePosition value
+ */
+ sal_Int16 translateImagePosition( ImageAlign _eVCLAlign );
+
+ /** translates a css.awt.ImagePosition value into an VCL ImageAlign
+ */
+ ImageAlign translateImagePosition( sal_Int16 _nImagePosition );
+
+ /** translates a VCL ImageAlign value into a compatible css.awt.ImageAlign value
+ */
+ sal_Int16 getCompatibleImageAlign( ImageAlign _eAlign );
+
+ /** translates a css.awt.ImageAlign value into a css.awt.ImagePosition value
+ */
+ sal_Int16 getExtendedImagePosition( sal_Int16 _nImageAlign );
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_INC_TOOLKIT_HELPER_IMAGEALIGN_HXX
diff --git a/toolkit/inc/toolkit/helper/listenermultiplexer.hxx b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
new file mode 100644
index 000000000000..65e555f9d799
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
+#define _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+#include <com/sun/star/awt/XVclContainerListener.hpp>
+#include <com/sun/star/awt/XKeyListener.hpp>
+#include <com/sun/star/awt/XMouseListener.hpp>
+#include <com/sun/star/awt/XMouseMotionListener.hpp>
+#include <com/sun/star/awt/XPaintListener.hpp>
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#include <com/sun/star/awt/XTextListener.hpp>
+#include <com/sun/star/awt/XActionListener.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+#include <com/sun/star/awt/XSpinListener.hpp>
+#include <com/sun/star/awt/XAdjustmentListener.hpp>
+#include <com/sun/star/awt/XMenuListener.hpp>
+#include <com/sun/star/awt/tree/XTreeExpansionListener.hpp>
+#include <com/sun/star/awt/tree/XTreeEditListener.hpp>
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/util/VetoException.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <osl/mutex.hxx>
+#include <toolkit/helper/mutexhelper.hxx>
+#include <toolkit/helper/macros.hxx>
+
+// ----------------------------------------------------
+// class ListenerMultiplexerBase
+// ----------------------------------------------------
+
+class TOOLKIT_DLLPUBLIC ListenerMultiplexerBase : public MutexHelper,
+ public ::cppu::OInterfaceContainerHelper,
+ public ::com::sun::star::uno::XInterface
+{
+private:
+ ::cppu::OWeakObject& mrContext;
+
+protected:
+ ::cppu::OWeakObject& GetContext() { return mrContext; }
+
+public:
+ ListenerMultiplexerBase( ::cppu::OWeakObject& rSource );
+ virtual ~ListenerMultiplexerBase();
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { mrContext.acquire(); }
+ void SAL_CALL release() throw() { mrContext.release(); }
+};
+
+
+// ----------------------------------------------------
+// class EventListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( EventListenerMultiplexer, ::com::sun::star::lang::XEventListener )
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class FocusListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener )
+ void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+
+// ----------------------------------------------------
+// class WindowListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener )
+ void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+
+
+// ----------------------------------------------------
+// class VclContainerListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener )
+ void SAL_CALL windowAdded( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowRemoved( const ::com::sun::star::awt::VclContainerEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class KeyListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener )
+ void SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class MouseListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
+ void SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseEntered( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseExited( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class MouseMotionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener )
+ void SAL_CALL mouseDragged( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL mouseMoved( const ::com::sun::star::awt::MouseEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class PaintListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener )
+ void SAL_CALL windowPaint( const ::com::sun::star::awt::PaintEvent& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TopWindowListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener )
+ void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TextListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener )
+ void SAL_CALL textChanged( const ::com::sun::star::awt::TextEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class ActionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener )
+ void SAL_CALL actionPerformed( const ::com::sun::star::awt::ActionEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class ItemListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener )
+ void SAL_CALL itemStateChanged( const ::com::sun::star::awt::ItemEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class ContainerListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
+ void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class SpinListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener )
+ void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class AdjustmentListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener )
+ void SAL_CALL adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class MenuListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener )
+ void SAL_CALL highlight( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL select( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL activate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deactivate( const ::com::sun::star::awt::MenuEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TreeSelectionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener )
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TreeExpansionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener )
+ virtual void SAL_CALL requestChildNodes( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL treeExpanding( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL treeCollapsing( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL treeExpanded( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL treeCollapsed( const ::com::sun::star::awt::tree::TreeExpansionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TreeEditListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener )
+ virtual void SAL_CALL nodeEditing( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::uno::RuntimeException,::com::sun::star::util::VetoException);
+ virtual void SAL_CALL nodeEdited( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node, const ::rtl::OUString& NewText ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+
+
+
+#endif // _TOOLKIT_HELPER_LISTENERMULTIPLEXER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/macros.hxx b/toolkit/inc/toolkit/helper/macros.hxx
new file mode 100644
index 000000000000..48386d9a404c
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/macros.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_MACROS_HXX_
+#define _TOOLKIT_HELPER_MACROS_HXX_
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_XUNOTUNNEL( ClassName ) \
+sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ if( ( rIdentifier.getLength() == 16 ) && ( 0 == rtl_compareMemory( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \
+ { \
+ return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \
+ } \
+ return 0; \
+} \
+const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::GetUnoTunnelId() throw() \
+{ \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL; \
+ if( !pSeq ) \
+ { \
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if( !pSeq ) \
+ { \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \
+ pSeq = &aSeq; \
+ } \
+ } \
+ return *pSeq; \
+} \
+ClassName* ClassName::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw() \
+{ \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( rxIFace, ::com::sun::star::uno::UNO_QUERY ); \
+ return xUT.is() ? reinterpret_cast<ClassName*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( ClassName::GetUnoTunnelId() ))) : NULL; \
+}
+
+#define IMPL_XUNOTUNNEL2( ClassName, BaseClass ) \
+sal_Int64 ClassName::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rIdentifier ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ if( ( rIdentifier.getLength() == 16 ) && ( 0 == rtl_compareMemory( ClassName::GetUnoTunnelId().getConstArray(), rIdentifier.getConstArray(), 16 ) ) ) \
+ { \
+ return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this)); \
+ } \
+ return BaseClass::getSomething( rIdentifier ); \
+} \
+const ::com::sun::star::uno::Sequence< sal_Int8 >& ClassName::GetUnoTunnelId() throw() \
+{ \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = NULL; \
+ if( !pSeq ) \
+ { \
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if( !pSeq ) \
+ { \
+ static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 ); \
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); \
+ pSeq = &aSeq; \
+ } \
+ } \
+ return *pSeq; \
+} \
+ClassName* ClassName::GetImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxIFace ) throw() \
+{ \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( rxIFace, ::com::sun::star::uno::UNO_QUERY ); \
+ return xUT.is() ? reinterpret_cast<ClassName*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( ClassName::GetUnoTunnelId() ))) : NULL; \
+}
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_IMPLEMENTATION_ID( ClassName ) \
+::com::sun::star::uno::Sequence< sal_Int8 > ClassName::getImplementationId() throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ static ::cppu::OImplementationId* pId = NULL; \
+ if( !pId ) \
+ { \
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if( ! pId ) \
+ { \
+ static ::cppu::OImplementationId id( sal_False ); \
+ pId = &id; \
+ } \
+ } \
+ return (*pId).getImplementationId(); \
+}
+
+#define IMPL_XTYPEPROVIDER_START( ClassName ) \
+IMPL_IMPLEMENTATION_ID( ClassName ) \
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > ClassName::getTypes() throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ static ::cppu::OTypeCollection* pCollection = NULL; \
+ if( !pCollection ) \
+ { \
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ); \
+ if( !pCollection ) \
+ { \
+ static ::cppu::OTypeCollection collection( \
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ),
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_XTYPEPROVIDER_END \
+ ); \
+ pCollection = &collection; \
+ } \
+ } \
+ return (*pCollection).getTypes(); \
+}
+
+// -------------------------------------------------------------------------------------
+
+#define DECL_LISTENERMULTIPLEXER_START( ClassName, InterfaceName ) \
+class ClassName : public ListenerMultiplexerBase, public InterfaceName \
+{ \
+public: \
+ ClassName( ::cppu::OWeakObject& rSource ); \
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); \
+ void SAL_CALL acquire() throw() { ListenerMultiplexerBase::acquire(); } \
+ void SAL_CALL release() throw() { ListenerMultiplexerBase::release(); } \
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+// -------------------------------------------------------------------------------------
+
+#define DECL_LISTENERMULTIPLEXER_START_DLLPUB( ClassName, InterfaceName ) \
+class TOOLKIT_DLLPUBLIC ClassName : public ListenerMultiplexerBase, public InterfaceName \
+{ \
+public: \
+ ClassName( ::cppu::OWeakObject& rSource ); \
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); \
+ void SAL_CALL acquire() throw() { ListenerMultiplexerBase::acquire(); } \
+ void SAL_CALL release() throw() { ListenerMultiplexerBase::release(); } \
+ void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+// -------------------------------------------------------------------------------------
+
+#define DECL_LISTENERMULTIPLEXER_END \
+};
+
+// -------------------------------------------------------------------------------------
+
+#define IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ClassName, InterfaceName ) \
+ClassName::ClassName( ::cppu::OWeakObject& rSource ) \
+ : ListenerMultiplexerBase( rSource ) \
+{ \
+} \
+::com::sun::star::uno::Any ClassName::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType, \
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ), \
+ SAL_STATIC_CAST( InterfaceName*, this ) ); \
+ return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType )); \
+} \
+void ClassName::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+}
+
+// -------------------------------------------------------------------------------------
+
+#if OSL_DEBUG_LEVEL > 0
+ #define DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
+ ::rtl::OString sMessage( #ClassName "::" #MethodName ": caught an exception!\n" ); \
+ sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US ); \
+ OSL_ENSURE( sal_False, sMessage.getStr() );
+#else
+ #define DISPLAY_EXCEPTION( ClassName, MethodName, e )
+#endif
+
+#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType ) \
+{ \
+ EventType aMulti( evt ); \
+ aMulti.Source = &GetContext(); \
+ ::cppu::OInterfaceIteratorHelper aIt( *this ); \
+ while( aIt.hasMoreElements() ) \
+ { \
+ ::com::sun::star::uno::Reference< InterfaceName > xListener( \
+ static_cast< InterfaceName* >( aIt.next() ) ); \
+ try \
+ { \
+ xListener->MethodName( aMulti ); \
+ } \
+ catch( ::com::sun::star::lang::DisposedException e ) \
+ { \
+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" ); \
+ if ( e.Context == xListener || !e.Context.is() ) \
+ aIt.remove(); \
+ } \
+ catch( ::com::sun::star::uno::RuntimeException e ) \
+ { \
+ DISPLAY_EXCEPTION( ClassName, MethodName, e ) \
+ } \
+ } \
+}
+
+#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( ClassName, InterfaceName, MethodName, EventType, Exception ) \
+void ClassName::MethodName( const EventType& evt ) throw(::com::sun::star::uno::RuntimeException, Exception) \
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType )
+
+#define IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ClassName, InterfaceName, MethodName, EventType ) \
+void ClassName::MethodName( const EventType& evt ) throw(::com::sun::star::uno::RuntimeException) \
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_BODY( ClassName, InterfaceName, MethodName, EventType )
+
+// -------------------------------------------------------------------------------------
+
+#define DECLIMPL_SUPPORTS_SERVICE( ) \
+ sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() ); \
+ const ::rtl::OUString* pSupported = aServiceNames.getConstArray(); \
+ const ::rtl::OUString* pSupportedEnd = pSupported + aServiceNames.getLength(); \
+ for ( ; pSupported != pSupportedEnd; ++pSupported ) \
+ if ( *pSupported == rServiceName ) \
+ return sal_True; \
+ return sal_False; \
+ }
+
+// -------------------------------------------------------------------------------------
+
+#define DECLIMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames = BaseClass::getSupportedServiceNames( ); \
+ aNames.realloc( aNames.getLength() + 1 ); \
+ aNames[ aNames.getLength() - 1 ] = ::rtl::OUString::createFromAscii( ServiceName ); \
+ return aNames; \
+ } \
+
+// -------------------------------------------------------------------------------------
+
+#define DECLIMPL_SERVICEINFO( ImplName, ServiceName ) \
+ ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( 1 ); \
+ aNames[ 0 ] = ::rtl::OUString::createFromAscii( ServiceName ); \
+ return aNames; \
+ } \
+ DECLIMPL_SUPPORTS_SERVICE( )
+
+
+
+
+
+
+#endif // _TOOLKIT_HELPER_MACROS_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
new file mode 100644
index 000000000000..c84a6e54d73b
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX_
+#define _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX_
+
+#include <cppuhelper/interfacecontainer.h>
+
+
+// Helper class with Mutex and BroadcastHelper, because they must be
+// initialized before calling the OPropertySetHelper-CTOR
+
+class MutexAndBroadcastHelper
+{
+public:
+ MutexAndBroadcastHelper() : BrdcstHelper( Mutex ) {}
+
+
+ ::osl::Mutex Mutex;
+ ::cppu::OBroadcastHelper BrdcstHelper;
+
+ ::osl::Mutex& GetMutex() { return Mutex; }
+
+};
+
+
+
+
+
+
+#endif // _TOOLKIT_HELPER_MUTEXANDBROADCASTHELPER_HXX
+
+
diff --git a/toolkit/inc/toolkit/helper/mutexhelper.hxx b/toolkit/inc/toolkit/helper/mutexhelper.hxx
new file mode 100644
index 000000000000..43d5e77b353e
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/mutexhelper.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_MUTEXHELPER_HXX_
+#define _TOOLKIT_HELPER_MUTEXHELPER_HXX_
+
+#include <osl/mutex.hxx>
+
+// ----------------------------------------------------
+// class MutexHelper
+// ----------------------------------------------------
+
+class MutexHelper
+{
+private:
+ ::osl::Mutex maMutex;
+
+public:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+};
+
+
+
+
+#endif // _TOOLKIT_HELPER_MUTEXHELPER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/property.hxx b/toolkit/inc/toolkit/helper/property.hxx
new file mode 100644
index 000000000000..d9adc182f4d7
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_HELPER_PROPERTY_HXX_
+#define _TOOLKIT_HELPER_PROPERTY_HXX_
+
+#include <toolkit/dllapi.h>
+
+#include <sal/types.h>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace uno {
+ class Type;
+ class Any;
+} } } }
+
+namespace rtl {
+ class OUString;
+}
+
+
+#define BASEPROPERTY_NOTFOUND 0
+
+#define BASEPROPERTY_TEXT 1 // ::rtl::OUString
+#define BASEPROPERTY_BACKGROUNDCOLOR 2 // sal_Int32
+#define BASEPROPERTY_FILLCOLOR 3 // sal_Int32
+#define BASEPROPERTY_TEXTCOLOR 4 // sal_Int32
+#define BASEPROPERTY_LINECOLOR 5 // sal_Int32
+#define BASEPROPERTY_BORDER 6 // sal_Int16
+#define BASEPROPERTY_ALIGN 7 // sal_Int16
+#define BASEPROPERTY_FONTDESCRIPTOR 8 // ::com::sun::star::awt::FontDescriptor, war mal Font, aber nie gespeichert...
+#define BASEPROPERTY_DROPDOWN 9 // sal_Bool
+#define BASEPROPERTY_MULTILINE 10 // sal_Bool
+#define BASEPROPERTY_STRINGITEMLIST 11 // UStringSequence
+#define BASEPROPERTY_HSCROLL 12 // sal_Bool
+#define BASEPROPERTY_VSCROLL 13 // sal_Bool
+#define BASEPROPERTY_TABSTOP 14 // sal_Bool
+#define BASEPROPERTY_STATE 15 // sal_Int16
+#define BASEPROPERTY_FONT_TYPE 16 // OLD: Font_Type
+#define BASEPROPERTY_FONT_SIZE 17 // OLD: Font_Size
+#define BASEPROPERTY_FONT_ATTRIBS 18 // OLD: Font_Attribs
+#define BASEPROPERTY_DEFAULTCONTROL 19 // ::rtl::OUString (ServiceName)
+#define BASEPROPERTY_LABEL 20 // ::rtl::OUString
+#define BASEPROPERTY_LINECOUNT 21 // sal_Int16
+#define BASEPROPERTY_EXTDATEFORMAT 22 // sal_Int16
+#define BASEPROPERTY_DATESHOWCENTURY 23 // sal_Bool
+#define BASEPROPERTY_EXTTIMEFORMAT 24 // sal_Int16
+#define BASEPROPERTY_NUMSHOWTHOUSANDSEP 25 // sal_Bool
+#define BASEPROPERTY_CURRENCYSYMBOL 26 // ::rtl::OUString
+#define BASEPROPERTY_SPIN 27 // sal_Bool
+#define BASEPROPERTY_STRICTFORMAT 28 // sal_Bool
+#define BASEPROPERTY_DECIMALACCURACY 29 // sal_Int16
+#define BASEPROPERTY_DATE 30 // sal_Int32
+#define BASEPROPERTY_DATEMIN 31 // sal_Int32
+#define BASEPROPERTY_DATEMAX 32 // sal_Int32
+#define BASEPROPERTY_TIME 33 // sal_Int32
+#define BASEPROPERTY_TIMEMIN 34 // sal_Int32
+#define BASEPROPERTY_TIMEMAX 35 // sal_Int32
+#define BASEPROPERTY_VALUE_INT32 36 // sal_Int32
+#define BASEPROPERTY_VALUEMIN_INT32 37 // sal_Int32
+#define BASEPROPERTY_VALUEMAX_INT32 38 // sal_Int32
+#define BASEPROPERTY_VALUESTEP_INT32 39 // sal_Int32
+#define BASEPROPERTY_EDITMASK 40 // ::rtl::OUString
+#define BASEPROPERTY_LITERALMASK 41 // ::rtl::OUString
+#define BASEPROPERTY_IMAGEURL 42 // ::rtl::OUString
+#define BASEPROPERTY_READONLY 43 // sal_Bool
+#define BASEPROPERTY_ENABLED 44 // sal_Bool
+#define BASEPROPERTY_PRINTABLE 45 // sal_Bool
+#define BASEPROPERTY_ECHOCHAR 46 // sal_Int16
+#define BASEPROPERTY_MAXTEXTLEN 47 // sal_Int16
+#define BASEPROPERTY_HARDLINEBREAKS 48 // sal_Int16
+#define BASEPROPERTY_AUTOCOMPLETE 49 // sal_Bool
+#define BASEPROPERTY_MULTISELECTION 50 // sal_Bool
+#define BASEPROPERTY_SELECTEDITEMS 51 // INT16Sequence
+#define BASEPROPERTY_VALUE_DOUBLE 52 // DOUBLE
+#define BASEPROPERTY_VALUEMIN_DOUBLE 53 // DOUBLE
+#define BASEPROPERTY_VALUEMAX_DOUBLE 54 // DOUBLE
+#define BASEPROPERTY_VALUESTEP_DOUBLE 55 // DOUBLE
+#define BASEPROPERTY_TRISTATE 56 // sal_Bool
+#define BASEPROPERTY_DEFAULTBUTTON 57 // sal_Bool
+#define BASEPROPERTY_HELPURL 58 // ::rtl::OUString
+#define BASEPROPERTY_AUTOTOGGLE 59 // sal_Bool
+//#define BASEPROPERTY_FOCUSSELECTIONHIDE 60 // sal_Bool
+#define BASEPROPERTY_FORMATKEY 61 // sal_Bool
+#define BASEPROPERTY_FORMATSSUPPLIER 62 // ::com::sun::star::util::XNumberFormatsSupplier
+#define BASEPROPERTY_EFFECTIVE_VALUE 63 // Any (double or string)
+#define BASEPROPERTY_TREATASNUMBER 64 // sal_Bool
+#define BASEPROPERTY_EFFECTIVE_DEFAULT 65 // Any (double or string)
+#define BASEPROPERTY_EFFECTIVE_MIN 66 // Double
+#define BASEPROPERTY_EFFECTIVE_MAX 67 // Double
+#define BASEPROPERTY_CURSYM_POSITION 68 // sal_Bool
+#define BASEPROPERTY_TITLE 69 // ::rtl::OUString
+#define BASEPROPERTY_MOVEABLE 70 // sal_Bool
+#define BASEPROPERTY_CLOSEABLE 71 // sal_Bool
+#define BASEPROPERTY_SIZEABLE 72 // sal_Bool
+#define BASEPROPERTY_HELPTEXT 73 // ::rtl::OUString
+#define BASEPROPERTY_PROGRESSVALUE 74 // sal_Int32
+#define BASEPROPERTY_PROGRESSVALUE_MIN 75 // sal_Int32
+#define BASEPROPERTY_PROGRESSVALUE_MAX 76 // sal_Int32
+#define BASEPROPERTY_SCROLLVALUE 77 // sal_Int32
+#define BASEPROPERTY_SCROLLVALUE_MAX 78 // sal_Int32
+#define BASEPROPERTY_LINEINCREMENT 79 // sal_Int32
+#define BASEPROPERTY_BLOCKINCREMENT 80 // sal_Int32
+#define BASEPROPERTY_VISIBLESIZE 81 // sal_Int32
+#define BASEPROPERTY_ORIENTATION 82 // sal_Int32
+#define BASEPROPERTY_FONTRELIEF 83 // sal_Int16
+#define BASEPROPERTY_FONTEMPHASISMARK 84 // sal_Int16
+#define BASEPROPERTY_TEXTLINECOLOR 85 // sal_Int32
+#define BASEPROPERTY_IMAGEALIGN 86 // sal_Int16
+#define BASEPROPERTY_SCALEIMAGE 87 // sal_Bool
+#define BASEPROPERTY_PUSHBUTTONTYPE 88 // sal_Int16
+#define BASEPROPERTY_DISPLAYBACKGROUNDCOLOR 89 // sal_Int32
+#define BASEPROPERTY_AUTOMNEMONICS 90 // sal_Bool
+#define BASEPROPERTY_MOUSETRANSPARENT 91 // sal_Bool
+#define BASEPROPERTY_ACCESSIBLENAME 92 // ::rtl::OUString
+#define BASEPROPERTY_PLUGINPARENT 93 // sal_Int64
+#define BASEPROPERTY_SCROLLVALUE_MIN 94 // sal_Int32
+#define BASEPROPERTY_REPEAT_DELAY 95 // sal_Int32
+#define BASEPROPERTY_SYMBOL_COLOR 96 // sal_Int32
+#define BASEPROPERTY_SPINVALUE 97 // sal_Int32
+#define BASEPROPERTY_SPINVALUE_MIN 98 // sal_Int32
+#define BASEPROPERTY_SPINVALUE_MAX 99 // sal_Int32
+#define BASEPROPERTY_SPININCREMENT 100 // sal_Int32
+#define BASEPROPERTY_REPEAT 101 // sal_Bool
+#define BASEPROPERTY_ENFORCE_FORMAT 102 // sal_Bool
+#define BASEPROPERTY_LIVE_SCROLL 103 // sal_Bool
+#define BASEPROPERTY_LINE_END_FORMAT 104 // sal_Int16
+#define BASEPROPERTY_ACTIVATED 105 // sal Bool
+#define BASEPROPERTY_COMPLETE 106 // sal_Bool
+#define BASEPROPERTY_CURRENTITEMID 107 // sal_Int16
+#define BASEPROPERTY_TOGGLE 108 // sal_Bool
+#define BASEPROPERTY_FOCUSONCLICK 109 // sal_Bool
+#define BASEPROPERTY_HIDEINACTIVESELECTION 110 // sal_Bool
+#define BASEPROPERTY_VISUALEFFECT 111 // sal_Int16
+#define BASEPROPERTY_BORDERCOLOR 112 // sal_Int32
+#define BASEPROPERTY_IMAGEPOSITION 113 // sal_Int16
+#define BASEPROPERTY_NATIVE_WIDGET_LOOK 114 // sal_Bool
+#define BASEPROPERTY_VERTICALALIGN 115 // VerticalAlignment
+#define BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR 116 // sal_Int16
+#define BASEPROPERTY_GRAPHIC 117 // css.graphic.XGraphic
+#define BASEPROPERTY_STEP_TIME 118 // sal_Int32
+#define BASEPROPERTY_DECORATION 119 // sal_Bool
+#define BASEPROPERTY_PAINTTRANSPARENT 120 // sal_Bool
+#define BASEPROPERTY_AUTOHSCROLL 121 // sal_Bool
+#define BASEPROPERTY_AUTOVSCROLL 122 // sal_Bool
+#define BASEPROPERTY_DESKTOP_AS_PARENT 123 // sal_Bool
+#define BASEPROPERTY_TREE_START 124
+#define BASEPROPERTY_TREE_SELECTIONTYPE 124
+#define BASEPROPERTY_TREE_EDITABLE 125
+#define BASEPROPERTY_TREE_DATAMODEL 126
+#define BASEPROPERTY_TREE_ROOTDISPLAYED 127
+#define BASEPROPERTY_TREE_SHOWSHANDLES 128
+#define BASEPROPERTY_TREE_SHOWSROOTHANDLES 129
+#define BASEPROPERTY_TREE_ROWHEIGHT 130
+#define BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING 131
+#define BASEPROPERTY_TREE_END 131
+#define BASEPROPERTY_DIALOGSOURCEURL 132
+#define BASEPROPERTY_NOLABEL 133 // ::rtl::OUString added for issue79712
+#define BASEPROPERTY_URL 134 // ::rtl::OUString
+#define BASEPROPERTY_UNIT 135 // ::awt::FieldUnit
+#define BASEPROPERTY_CUSTOMUNITTEXT 136 // ::rtl::OUString
+#define BASEPROPERTY_IMAGE_SCALE_MODE 137
+#define BASEPROPERTY_WRITING_MODE 138
+#define BASEPROPERTY_CONTEXT_WRITING_MODE 139
+#define BASEPROPERTY_GRID_SHOWROWHEADER 140
+#define BASEPROPERTY_GRID_SHOWCOLUMNHEADER 141
+#define BASEPROPERTY_GRID_DATAMODEL 142
+#define BASEPROPERTY_GRID_COLUMNMODEL 143
+#define BASEPROPERTY_GRID_SELECTIONMODE 144
+#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool
+#define BASEPROPERTY_REFERENCE_DEVICE 146
+#define BASEPROPERTY_HIGHCONTRASTMODE 147
+
+
+// Keine gebundenen Properties, werden immer aus der Property BASEPROPERTY_FONTDESCRIPTOR entnommen.
+#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000
+#define BASEPROPERTY_FONTDESCRIPTORPART_NAME 1000 // ::rtl::OUString, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME 1001 // ::rtl::OUString, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_FAMILY 1002 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_CHARSET 1003 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT 1004 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT 1005 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_SLANT 1006 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE 1007 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT 1008 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WIDTH 1009 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_PITCH 1010 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH 1011 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION 1012 // Float, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_KERNING 1013 // sal_Bool, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE 1014 // sal_Bool, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_TYPE 1015 // sal_Int16, not bound
+#define BASEPROPERTY_FONTDESCRIPTORPART_END 1015
+
+#define PROPERTY_ALIGN_LEFT 0
+#define PROPERTY_ALIGN_CENTER 1
+#define PROPERTY_ALIGN_RIGHT 2
+
+#define PROPERTY_STATE_OFF 0
+#define PROPERTY_STATE_ON 1
+#define PROPERTY_STATE_DONTCARE 2
+
+TOOLKIT_DLLPUBLIC sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName );
+const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId );
+const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId );
+sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId );
+sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId );
+sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId );
+sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 );
+
+
+
+
+#endif // _TOOLKIT_HELPER_PROPERTY_HXX_
+
+
diff --git a/toolkit/inc/toolkit/helper/servicenames.hxx b/toolkit/inc/toolkit/helper/servicenames.hxx
new file mode 100644
index 000000000000..70f18f91fb09
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_SERVICENAMES_HXX_
+#define _TOOLKIT_HELPER_SERVICENAMES_HXX_
+
+#include <sal/types.h>
+#include <tools/solar.h>
+
+extern const sal_Char __FAR_DATA szServiceName_Toolkit[], szServiceName2_Toolkit[];
+extern const sal_Char __FAR_DATA szServiceName_MVCIntrospection[], szServiceName2_MVCIntrospection[];
+extern const sal_Char __FAR_DATA szServiceName_PopupMenu[], szServiceName2_PopupMenu[];
+extern const sal_Char __FAR_DATA szServiceName_MenuBar[], szServiceName2_MenuBar[];
+extern const sal_Char __FAR_DATA szServiceName_Pointer[], szServiceName2_Pointer[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlContainer[], szServiceName2_UnoControlContainer[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[], szServiceName2_UnoControlContainerModel[];
+extern const sal_Char __FAR_DATA szServiceName_TabController[], szServiceName2_TabController[];
+extern const sal_Char __FAR_DATA szServiceName_TabControllerModel[], szServiceName2_TabControllerModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlDialog[], szServiceName2_UnoControlDialog[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlDialogModel[], szServiceName2_UnoControlDialogModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlEdit[], szServiceName2_UnoControlEdit[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlEditModel[], szServiceName2_UnoControlEditModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFileControl[], szServiceName2_UnoControlFileControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFileControlModel[], szServiceName2_UnoControlFileControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlButton[], szServiceName2_UnoControlButton[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlButtonModel[], szServiceName2_UnoControlButtonModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageButton[], szServiceName2_UnoControlImageButton[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageButtonModel[], szServiceName2_UnoControlImageButtonModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageControl[], szServiceName2_UnoControlImageControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlImageControlModel[], szServiceName2_UnoControlImageControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlRadioButton[], szServiceName2_UnoControlRadioButton[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlRadioButtonModel[], szServiceName2_UnoControlRadioButtonModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCheckBox[], szServiceName2_UnoControlCheckBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCheckBoxModel[], szServiceName2_UnoControlCheckBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlListBox[], szServiceName2_UnoControlListBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlListBoxModel[], szServiceName2_UnoControlListBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlComboBox[], szServiceName2_UnoControlComboBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlComboBoxModel[], szServiceName2_UnoControlComboBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedText[], szServiceName2_UnoControlFixedText[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedTextModel[], szServiceName2_UnoControlFixedTextModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlGroupBox[], szServiceName2_UnoControlGroupBox[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlGroupBoxModel[], szServiceName2_UnoControlGroupBoxModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlDateField[], szServiceName2_UnoControlDateField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlDateFieldModel[], szServiceName2_UnoControlDateFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTimeField[], szServiceName2_UnoControlTimeField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTimeFieldModel[], szServiceName2_UnoControlTimeFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlNumericField[], szServiceName2_UnoControlNumericField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlNumericFieldModel[], szServiceName2_UnoControlNumericFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyField[], szServiceName2_UnoControlCurrencyField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyFieldModel[], szServiceName2_UnoControlCurrencyFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlPatternField[], szServiceName2_UnoControlPatternField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[], szServiceName2_UnoControlPatternFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[], szServiceName2_UnoControlFormattedField[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[], szServiceName2_UnoControlFormattedFieldModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlProgressBar[], szServiceName2_UnoControlProgressBar[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlProgressBarModel[], szServiceName2_UnoControlProgressBarModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlScrollBar[], szServiceName2_UnoControlScrollBar[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlScrollBarModel[], szServiceName2_UnoControlScrollBarModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedLine[], szServiceName2_UnoControlFixedLine[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedLineModel[], szServiceName2_UnoControlFixedLineModel[];
+extern const sal_Char __FAR_DATA szServiceName_PrinterServer[], szServiceName2_PrinterServer[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[], szServiceName2_UnoControlRoadmap[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[], szServiceName2_UnoControlRoadmapModel[];
+
+extern const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[], szServiceName_UnoSpinButtonModel[];
+
+extern const sal_Char __FAR_DATA szServiceName_TreeControl[];
+extern const sal_Char __FAR_DATA szServiceName_TreeControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[];
+
+extern const sal_Char __FAR_DATA szServiceName_GridControl[];
+extern const sal_Char __FAR_DATA szServiceName_GridControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[];
+extern const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[];
+extern const sal_Char __FAR_DATA szServiceName_GridColumn[];
+
+extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName_UnoSimpleAnimationControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName_UnoThrobberControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
+
+// ExtUnoWrapper:
+extern const char __FAR_DATA szServiceName_ImageProducer[], szServiceName2_ImageProducer[];
+
+
+
+#endif // _TOOLKIT_HELPER_SERVICENAMES_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/solarrelease.hxx b/toolkit/inc/toolkit/helper/solarrelease.hxx
new file mode 100644
index 000000000000..d8938b41c220
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/solarrelease.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_INC_TOOLKIT_HELPER_SOLARRELEASE_HXX
+#define TOOLKIT_INC_TOOLKIT_HELPER_SOLARRELEASE_HXX
+
+#include <vcl/svapp.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= ReleaseSolarMutex
+ //====================================================================
+ class ReleaseSolarMutex
+ {
+ sal_uInt32 mnLockCount;
+ public:
+ ReleaseSolarMutex()
+ {
+ mnLockCount = Application::ReleaseSolarMutex();
+ }
+
+ ~ReleaseSolarMutex()
+ {
+ Application::AcquireSolarMutex( mnLockCount );
+ }
+ };
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_INC_TOOLKIT_HELPER_SOLARRELEASE_HXX
+
diff --git a/toolkit/inc/toolkit/helper/throbberimpl.hxx b/toolkit/inc/toolkit/helper/throbberimpl.hxx
new file mode 100644
index 000000000000..5ca6ec83d330
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/throbberimpl.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_THROBBERIMPL_HXX_
+#define _TOOLKIT_HELPER_THROBBERIMPL_HXX_
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <vcl/timer.hxx>
+#include <vos/mutex.hxx>
+
+//........................................................................
+namespace toolkit
+//........................................................................
+{
+
+ class Throbber_Impl
+ {
+ private:
+ NAMESPACE_VOS(IMutex)& mrMutex; // Reference to SolarMutex
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > maImageList;
+ ::com::sun::star::uno::Reference< VCLXWindow > mxParent;
+
+ sal_Bool mbRepeat;
+ sal_Int32 mnStepTime;
+ sal_Int32 mnCurStep;
+ sal_Int32 mnStepCount;
+ AutoTimer maWaitTimer;
+
+ DECL_LINK( TimeOutHdl, Throbber_Impl* );
+
+ NAMESPACE_VOS(IMutex)& GetMutex() { return mrMutex; }
+
+ public:
+ Throbber_Impl( ::com::sun::star::uno::Reference< VCLXWindow > xParent,
+ sal_Int32 nStepTime,
+ sal_Bool bRepeat );
+ ~Throbber_Impl();
+
+ // Properties
+ void setStepTime( sal_Int32 nStepTime ) { mnStepTime = nStepTime; }
+ void setRepeat( sal_Bool bRepeat ) { mbRepeat = bRepeat; }
+
+ // XSimpleAnimation
+ void start() throw ( ::com::sun::star::uno::RuntimeException );
+ void stop() throw ( ::com::sun::star::uno::RuntimeException );
+ void setImageList( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& ImageList )
+ throw ( ::com::sun::star::uno::RuntimeException );
+ // Helpers
+ void initImage() throw ( ::com::sun::star::uno::RuntimeException );
+ sal_Bool isHCMode() throw ( ::com::sun::star::uno::RuntimeException );
+ };
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
+#endif //_TOOLKIT_HELPER_THROBBERIMPL_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/tkresmgr.hxx b/toolkit/inc/toolkit/helper/tkresmgr.hxx
new file mode 100644
index 000000000000..d7a1c42ea13c
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/tkresmgr.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_TKRESMGR_HXX_
+#define _TOOLKIT_HELPER_TKRESMGR_HXX_
+
+#include <rtl/ustring.hxx>
+#include <vcl/image.hxx>
+
+class SimpleResMgr;
+class ResMgr;
+
+#define TK_RES_STRING(id) TkResMgr::loadString(id)
+#define TK_RES_IMAGE(id) TkResMgr::loadImage(id)
+
+// -----------------------------------------------------------------------------
+// TkResMgr
+// -----------------------------------------------------------------------------
+
+class TkResMgr
+{
+ static SimpleResMgr* m_pSimpleResMgr;
+ static ResMgr* m_pResMgr;
+
+private:
+ // no instantiation allowed
+ TkResMgr() { }
+ ~TkResMgr() { }
+
+ // we'll instantiate one static member of the following class,
+ // which in it's dtor ensures that m_pSimpleResMgr 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 );
+
+ // loads the image with the specified resource id
+ static Image loadImage( sal_uInt16 nResId );
+};
+
+
+#endif // _TOOLKIT_HELPER_TKRESMGR_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/unomemorystream.hxx b/toolkit/inc/toolkit/helper/unomemorystream.hxx
new file mode 100644
index 000000000000..c7d91e076f73
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/unomemorystream.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 _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_
+#define _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_
+
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+
+#include <tools/stream.hxx>
+
+// ----------------------------------------------------
+// class UNOMEMORYSTREAM
+// ----------------------------------------------------
+
+class UnoMemoryStream : public SvMemoryStream,
+ public ::com::sun::star::io::XInputStream,
+ public ::cppu::OWeakObject
+{
+private:
+ ::osl::Mutex maMutex;
+
+protected:
+ ::osl::Mutex& GetMutex() { return maMutex; }
+
+
+public:
+ UnoMemoryStream( sal_uInt32 nInitSize = 0x3FFF, sal_uInt32 nResize = 0x3FFFF );
+
+ // ::com::sun::star::uno::XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // ::com::sun::star::io::XInputStream
+ sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL available( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL closeInput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+
+
+
+#endif // _TOOLKIT_HELPER_UNOMEMORYSTREAM_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
new file mode 100644
index 000000000000..2a42d05b72fd
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+#define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+
+#include <cppuhelper/propshlp.hxx>
+
+#include <tools/table.hxx>
+
+#include <list>
+
+// ----------------------------------------------------
+// class UnoPropertyArrayHelper
+// ----------------------------------------------------
+class UnoPropertyArrayHelper : public ::cppu::IPropertyArrayHelper
+{
+private:
+ Table maIDs;
+
+protected:
+ sal_Bool ImplHasProperty( sal_uInt16 nPropId ) const;
+
+public:
+ UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs );
+ UnoPropertyArrayHelper( const std::list< sal_uInt16 > &rIDs );
+
+ // ::cppu::IPropertyArrayHelper
+ sal_Bool SAL_CALL fillPropertyMembersByHandle( ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties();
+ ::com::sun::star::beans::Property SAL_CALL getPropertyByName(const ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException);
+ sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& rPropertyName);
+ sal_Int32 SAL_CALL getHandleByName( const ::rtl::OUString & rPropertyName );
+ sal_Int32 SAL_CALL fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames );
+};
+
+
+
+#endif // _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/unowrapper.hxx b/toolkit/inc/toolkit/helper/unowrapper.hxx
new file mode 100644
index 000000000000..31cc259b7fd0
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/unowrapper.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 _TOOLKIT_HELPER_UNOWRAPPER_HXX_
+#define _TOOLKIT_HELPER_UNOWRAPPER_HXX_
+
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XGraphics.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <toolkit/helper/accessibilityclient.hxx>
+
+#include <vcl/unowrap.hxx>
+#include <vcl/window.hxx>
+
+// ----------------------------------------------------
+// class UnoWrapper
+// ----------------------------------------------------
+
+class UnoWrapper : public UnoWrapperBase
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> mxToolkit;
+ ::toolkit::AccessibilityClient maAccessibleFactoryAccess;
+
+public:
+ UnoWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& rxToolkit );
+
+ virtual void Destroy();
+
+ // Toolkit
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> GetVCLToolkit();
+
+ // Graphics
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> CreateGraphics( OutputDevice* pOutDev );
+ virtual void ReleaseAllGraphics( OutputDevice* pOutDev );
+
+ // Window
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> GetWindowInterface( Window* pWindow, BOOL bCreate );
+ virtual void SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace );
+
+ void WindowDestroyed( Window* pWindow );
+ void WindowEvent_Move( Window* pWindow );
+ void WindowEvent_Resize( Window* pWindow );
+ void WindowEvent_Show( Window* pWindow, BOOL bShow );
+ void WindowEvent_Close( Window* pWindow );
+ void WindowEvent_Minimize( Window* pWindow );
+ void WindowEvent_Normalize( Window* pWindow );
+ void WindowEvent_Activate( Window* pWindow, BOOL bActivated );
+ void WindowEvent_MouseButtonUp( Window* pWindow, const MouseEvent& rEvt );
+ void WindowEvent_MouseButtonDown( Window* pWindow, const MouseEvent& rEvt );
+ void WindowEvent_MouseMove( Window* pWindow, const MouseEvent& rEvt );
+ void WindowEvent_Command( Window* pWindow, const CommandEvent& rCEvt );
+ void WindowEvent_KeyInput( Window* pWindow, const KeyEvent& rEvt );
+ void WindowEvent_KeyUp( Window* pWindow, const KeyEvent& rEvt );
+ void WindowEvent_GetFocus( Window* pWindow );
+ void WindowEvent_LoseFocus( Window* pWindow );
+ void WindowEvent_Paint( Window* pWindow, const Rectangle& rRect );
+
+ // Accessibility
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ CreateAccessible( Menu* pMenu, sal_Bool bIsMenuBar );
+
+private:
+ virtual ~UnoWrapper();
+};
+
+#endif // _TOOLKIT_HELPER_UNOWRAPPER_HXX_
+
diff --git a/toolkit/inc/toolkit/helper/vclunohelper.hxx b/toolkit/inc/toolkit/helper/vclunohelper.hxx
new file mode 100644
index 000000000000..cc11f3a586bb
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/vclunohelper.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#define _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+
+#include <toolkit/dllapi.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.h>
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/awt/MouseEvent.hpp>
+
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XInterface;
+}}}}
+
+namespace com { namespace sun { namespace star { namespace awt {
+ class XBitmap;
+ class XWindow;
+ class XWindow2;
+ class XWindowPeer;
+ class XGraphics;
+ class XRegion;
+ class XDevice;
+ class XPointer;
+ class XToolkit;
+ class XFont;
+ class XControlContainer;
+ struct Size;
+ struct Point;
+ struct SimpleFontMetric;
+ struct FontDescriptor;
+ struct Rectangle;
+ struct KeyEvent;
+}}}}
+
+
+#include <vcl/bitmapex.hxx>
+#include <vcl/region.hxx>
+#include <vcl/metric.hxx>
+#include <vcl/mapunit.hxx>
+#include <vcl/fldunit.hxx>
+#include <tools/poly.hxx>
+
+class Window;
+class OutputDevice;
+class MouseEvent;
+class KeyEvent;
+
+// ----------------------------------------------------
+// class VclUnoHelper
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC VCLUnoHelper
+{
+public:
+ // Toolkit
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> CreateToolkit();
+
+ // Bitmap
+ static BitmapEx GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> CreateBitmap( const BitmapEx& rBitmap );
+
+ // Window
+ static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow );
+ static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow2 );
+ static Window* GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindowPeer );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> GetInterface( Window* pWindow );
+
+ // OutputDevice
+ static OutputDevice* GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice );
+ static OutputDevice* GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics );
+
+ // Region
+ static Region GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion );
+
+
+ // Pointer
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> CreatePointer();
+
+ // Polygon
+ static Polygon CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY );
+
+ // Font
+ static ::com::sun::star::awt::FontDescriptor CreateFontDescriptor( const Font& rFont );
+ static Font CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont );
+ static Font CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont );
+ static ::com::sun::star::awt::SimpleFontMetric CreateFontMetric( const FontMetric& rFontMetric );
+ static float ConvertFontWidth( FontWidth eWidth );
+ static FontWidth ConvertFontWidth( float f );
+ static float ConvertFontWeight( FontWeight eWeight );
+ static FontWeight ConvertFontWeight( float f );
+
+ // Rectangle
+ static sal_Bool IsZero( ::com::sun::star::awt::Rectangle rRect );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> CreateControlContainer( Window* pWindow );
+
+ // MapUnits
+ static MapUnit UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit );
+ static sal_Int32 VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit );
+
+ //========================================================================
+ //= MeasurementUnitConversion
+ //========================================================================
+ /** small helper to convert between <type>MeasurementUnit</type> and
+ <type>FieldUnit</type>
+ */
+ static sal_Int16 ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _rFieldToUNOValueFactor );
+ static FieldUnit ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor );
+
+ static MapUnit /* MapModeUnit */ ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (::com::sun::star::lang::IllegalArgumentException);
+ static sal_Int16 /* com.sun.star.util.MeasureUnit.* */ ConvertToMeasurementUnit(MapUnit /* MapModeUnit */ _nMapModeUnit) throw (::com::sun::star::lang::IllegalArgumentException);
+
+ static ::Size /* VCLSize */ ConvertToVCLSize(::com::sun::star::awt::Size const& _aSize);
+ static ::com::sun::star::awt::Size ConvertToAWTSize(::Size /* VCLSize */ const& _aSize);
+
+ static ::Point /* VCLPoint */ ConvertToVCLPoint(::com::sun::star::awt::Point const& _aPoint);
+ static ::com::sun::star::awt::Point ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint);
+
+ static ::Rectangle ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect );
+ static ::com::sun::star::awt::Rectangle ConvertToAWTRect( ::Rectangle const & _rRect );
+
+ static ::com::sun::star::awt::MouseEvent
+ createMouseEvent(
+ const ::MouseEvent& _rVclEvent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext
+ );
+
+ static ::com::sun::star::awt::KeyEvent
+ createKeyEvent(
+ const ::KeyEvent& _rVclEvent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext
+ );
+};
+
+
+#endif // _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
diff --git a/toolkit/prj/build.lst b/toolkit/prj/build.lst
new file mode 100644
index 000000000000..304d0e7c978f
--- /dev/null
+++ b/toolkit/prj/build.lst
@@ -0,0 +1,13 @@
+ti toolkit : vcl NULL
+ti toolkit usr1 - all ti_mkout NULL
+ti toolkit\prj get - all ti_prj NULL
+ti toolkit\inc nmake - all ti_inc NULL
+ti toolkit\uiconfig\layout nmake - all ti_uiconfig_layout NULL
+ti toolkit\source\helper nmake - all ti_helper ti_inc NULL
+ti toolkit\source\awt nmake - all ti_awt ti_inc NULL
+ti toolkit\source\controls nmake - all ti_controls ti_inc NULL
+ti toolkit\source\controls\tree nmake - all ti_tree NULL
+ti toolkit\source\controls\grid nmake - all ti_grid NULL
+ti toolkit\source\layout\core nmake - all ti_layout_core NULL
+ti toolkit\source\layout\vcl nmake - all ti_layout_vcl NULL
+ti toolkit\util nmake - all ti_util ti_awt ti_controls ti_layout_core ti_helper ti_tree ti_grid ti_layout_vcl NULL
diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst
new file mode 100644
index 000000000000..0c62a083b330
--- /dev/null
+++ b/toolkit/prj/d.lst
@@ -0,0 +1,63 @@
+mkdir: %COMMON_DEST%\bin%_EXT%\hid
+mkdir: %_DEST%\inc%_EXT%\toolkit
+mkdir: %_DEST%\inc%_EXT%\toolkit\helper
+mkdir: %_DEST%\inc%_EXT%\toolkit\awt
+mkdir: %_DEST%\inc%_EXT%\toolkit\controls
+
+..\%COMMON_OUTDIR%\misc\*.hid %COMMON_DEST%\bin%_EXT%\hid\*.hid
+..\%__SRC%\lib\itk.lib %_DEST%\lib%_EXT%\itk.lib
+..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\lib\*.a %_DEST%\lib%_EXT%\*.a
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+..\%__SRC%\bin\tk*.res %_DEST%\bin%_EXT%\tk*res
+..\%__SRC%\bin\tk?????.sym %_DEST%\bin%_EXT%\tk?????.sym
+..\%__SRC%\bin\tk?????.dll %_DEST%\bin%_EXT%\tk?????.dll
+..\%__SRC%\misc\tk?????.map %_DEST%\bin%_EXT%\tk?????.map
+
+..\util\toolkit.xml %_DEST%\xml%_EXT%\toolkit.xml
+
+..\inc\toolkit\awt\vclxaccessiblecomponent.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxaccessiblecomponent.hxx
+..\inc\toolkit\awt\vclxcontainer.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxcontainer.hxx
+..\inc\toolkit\awt\vclxdevice.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdevice.hxx
+..\inc\toolkit\awt\vclxfont.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxfont.hxx
+..\inc\toolkit\awt\vclxtopwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtopwindow.hxx
+..\inc\toolkit\awt\vclxtoolkit.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxtoolkit.hxx
+..\inc\toolkit\awt\vclxwindow.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindow.hxx
+..\source\awt\vclxdialog.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxdialog.hxx
+..\inc\toolkit\awt\vclxwindows.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxwindows.hxx
+..\inc\toolkit\awt\vclxmenu.hxx %_DEST%\inc%_EXT%\toolkit\awt\vclxmenu.hxx
+
+..\inc\toolkit\controls\unocontrol.hxx %_DEST%\inc%_EXT%\toolkit\controls\unocontrol.hxx
+..\inc\toolkit\controls\unocontrols.hxx %_DEST%\inc%_EXT%\toolkit\controls\unocontrols.hxx
+..\inc\toolkit\controls\unocontrolmodel.hxx %_DEST%\inc%_EXT%\toolkit\controls\unocontrolmodel.hxx
+..\inc\toolkit\controls\unocontrolbase.hxx %_DEST%\inc%_EXT%\toolkit\controls\unocontrolbase.hxx
+..\inc\toolkit\helper\servicenames.hxx %_DEST%\inc%_EXT%\toolkit\helper\servicenames.hxx
+
+..\inc\toolkit\helper\emptyfontdescriptor.hxx %_DEST%\inc%_EXT%\toolkit\helper\emptyfontdescriptor.hxx
+..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\vclunohelper.hxx
+..\inc\toolkit\helper\convert.hxx %_DEST%\inc%_EXT%\toolkit\helper\convert.hxx
+..\inc\toolkit\helper\property.hxx %_DEST%\inc%_EXT%\toolkit\helper\property.hxx
+..\inc\toolkit\helper\macros.hxx %_DEST%\inc%_EXT%\toolkit\helper\macros.hxx
+..\inc\toolkit\helper\mutexhelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\mutexhelper.hxx
+..\inc\toolkit\helper\mutexandbroadcasthelper.hxx %_DEST%\inc%_EXT%\toolkit\helper\mutexandbroadcasthelper.hxx
+..\inc\toolkit\helper\listenermultiplexer.hxx %_DEST%\inc%_EXT%\toolkit\helper\listenermultiplexer.hxx
+..\inc\toolkit\helper\unowrapper.hxx %_DEST%\inc%_EXT%\toolkit\helper\unowrapper.hxx
+..\inc\toolkit\helper\externallock.hxx %_DEST%\inc%_EXT%\toolkit\helper\externallock.hxx
+..\inc\toolkit\helper\formpdfexport.hxx %_DEST%\inc%_EXT%\toolkit\helper/formpdfexport.hxx
+..\inc\toolkit\helper\accessiblefactory.hxx %_DEST%\inc%_EXT%\toolkit\helper\accessiblefactory.hxx
+..\inc\toolkit\helper\fixedhyperbase.hxx %_DEST%\inc%_EXT%\toolkit\helper\fixedhyperbase.hxx
+
+..\inc\toolkit\helper\vclunohelper.hxx %_DEST%\inc%_EXT%\toolkit\unohlp.hxx
+..\inc\toolkit\dllapi.h %_DEST%\inc%_EXT%\toolkit\dllapi.h
+
+mkdir: %_DEST%\inc%_EXT%\layout
+..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
+
+..\inc\layout\*.hxx %_DEST%\inc%_EXT%\layout\*.hxx
+mkdir: %_DEST%\inc%_EXT%\layout\core
+..\source\layout\core\*.hxx %_DEST%\inc%_EXT%\layout\core\*.hxx
+mkdir: %_DEST%\inc%_EXT%\layout\vcl
+..\source\layout\vcl\*.hxx %_DEST%\inc%_EXT%\layout\vcl\*.hxx
+
+..\%__SRC%\bin\*-layout.zip %_DEST%\pck%_EXT%\*.*
diff --git a/toolkit/qa/complex/toolkit/CallbackClass.java b/toolkit/qa/complex/toolkit/CallbackClass.java
new file mode 100644
index 000000000000..efc0ef91f7c0
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CallbackClass.java
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import com.sun.star.awt.XCallback;
+import lib.MultiMethodTest;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.awt.XRequestCallback</code>
+ * interface methods :
+ * <ul>
+ * <li><code> addCallback()</code></li>
+ * </ul> <p>
+ * @see com.sun.star.awt.XRequestCallback
+ */
+public class CallbackClass implements XCallback{
+
+ private LogWriter log;
+
+ private XMultiServiceFactory xMSF;
+
+
+ public CallbackClass(LogWriter log, XMultiServiceFactory xMSF ) {
+
+ this.xMSF = xMSF;
+ this.log = log;
+ }
+
+
+ /**
+ * Callback method which will be called by the asynchronous
+ * service where we have added our request before.
+ */
+ public void notify( Object aData ) {
+
+ log.println("callback called successfully" );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java
new file mode 100755
index 000000000000..fee95f2e6de0
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java
@@ -0,0 +1,331 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import util.AccessibilityTools;
+import complex.toolkit.interface_tests._XAccessibleComponent;
+import complex.toolkit.interface_tests._XAccessibleContext;
+import complex.toolkit.interface_tests._XAccessibleExtendedComponent;
+import complex.toolkit.interface_tests._XAccessibleEventBroadcaster;
+import com.sun.star.awt.XWindow;
+import com.sun.star.chart.XChartDocument;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCloseable;
+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 java.io.PrintWriter;
+
+/**
+ *
+ */
+public class CheckAccessibleStatusBar extends ComplexTestCase {
+
+ XInterface testObject = null;
+ XMultiServiceFactory xMSF = null;
+ XWindow xWindow = null;
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkDocs"};//WriterDoc", "checkDrawDoc",
+// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"};
+ }
+
+/* public String getTestObjectName() {
+ return "com.sun.star.awt.AccessibleStatusBar";
+ }
+*/
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(500) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check document types
+ */
+ public void checkDocs() {
+ Object doc = param.get("DocType");
+ String testDocType;
+ if (doc == null)
+ testDocType = "all";
+ else
+ testDocType = (String)doc;
+
+ System.out.println("Param was " + doc);
+ System.out.println("DocType " + testDocType);
+ if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all"))
+ checkWriterDoc();
+ if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all"))
+ checkMathDoc();
+ if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all"))
+ checkDrawDoc();
+ if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all"))
+ checkImpressDoc();
+ if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all"))
+ checkCalcDoc();
+
+ }
+
+ /**
+ * Test the interfaces on a writer document
+ */
+ public void checkWriterDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XTextDocument xTextDoc = null;
+ try {
+ log.println("****** Open a new writer document");
+ xTextDoc = xSOF.createTextDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xTextDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a math document
+ */
+ public void checkMathDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xMathDoc = null;
+ try {
+ log.println("****** Open a new math document");
+ xMathDoc = xSOF.createMathDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xMathDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a draw document
+ */
+ public void checkDrawDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xDrawDoc = null;
+ try {
+ log.println("****** Open a new draw document");
+ xDrawDoc = xSOF.createDrawDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xDrawDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on an impress document
+ */
+ public void checkImpressDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xImpressDoc = null;
+ try {
+ log.println("****** Open a new impress document");
+ xImpressDoc = xSOF.createImpressDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xImpressDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ /**
+ * Test the interfaces on an calc document
+ */
+ public void checkCalcDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XSpreadsheetDocument xSpreadsheetDoc = null;
+ try {
+ log.println("****** Open a new calc document");
+ xSpreadsheetDoc = xSOF.createCalcDoc("_blank");
+ shortWait();
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xSpreadsheetDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void getTestObject() {
+ try {
+ XInterface xIfc = (XInterface) xMSF.createInstance(
+ "com.sun.star.awt.Toolkit") ;
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc);
+
+ shortWait();
+ xWindow = (XWindow)UnoRuntime.queryInterface(
+ XWindow.class,tk.getActiveTopWindow());
+
+ shortWait();
+ AccessibilityTools at = new AccessibilityTools();
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+ XAccessibleContext parentContext = null;
+
+ log.println("Get the accessible status bar.");
+ parentContext = at.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+ shortWait();
+ log.println("...OK.");
+
+ XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class,parentContext);
+ String[] services = xSI.getSupportedServiceNames();
+ log.println("*****");
+ log.println("* Implementation Name: " + xSI.getImplementationName());
+ for (int i=0; i<services.length; i++)
+ log.println("* ServiceName "+i+": "+ services[i]);
+ log.println("*****");
+ testObject=parentContext;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ catch(Throwable t) {
+ System.out.println("Got throwable:");
+ t.printStackTrace();
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ log.println("*** Now testing XAccessibleComponent ***");
+ _XAccessibleComponent _xAccCompTest =
+ new _XAccessibleComponent(testObject, log);
+ assure("failed: XAccessibleComponent::getBounds", _xAccCompTest._getBounds());
+ assure("failed: XAccessibleComponent::contains", _xAccCompTest._containsPoint());
+ assure("failed: XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint());
+ assure("failed: XAccessibleComponent::getBackground", _xAccCompTest._getBackground());
+ assure("failed: XAccessibleComponent::getForeground", _xAccCompTest._getForeground());
+ assure("failed: XAccessibleComponent::getLocation", _xAccCompTest._getLocation());
+ assure("failed: XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen());
+ assure("failed: XAccessibleComponent::getSize", _xAccCompTest._getSize());
+ assure("failed: XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus());
+
+ log.println("*** Now testing XAccessibleContext ***");
+ _XAccessibleContext _xAccContext =
+ new _XAccessibleContext(testObject, log);
+ assure("failed: XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount());
+ assure("failed: XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild());
+ assure("failed: XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription());
+ assure("failed: XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName());
+ assure("failed: XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent());
+ assure("failed: XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent());
+ assure("failed: XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet());
+ assure("failed: XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole());
+ assure("failed: XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet());
+ assure("failed: XAccessibleContext::getLocale", _xAccContext._getLocale());
+
+ log.println("*** Now testing XAccessibleExtendedComponent ***");
+ _XAccessibleExtendedComponent _xAccExtComp =
+ new _XAccessibleExtendedComponent(testObject, log);
+ assure("failed: XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont());
+ assure("failed: XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText());
+ assure("failed: XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText());
+
+ log.println("*** Now testing XAccessibleEventBroadcaster ***");
+ _XAccessibleEventBroadcaster _xAccEvBcast =
+ new _XAccessibleEventBroadcaster(testObject, log, "Pfff", xWindow);
+ assure("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener());
+ assure("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener());
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java
new file mode 100755
index 000000000000..36394732ce78
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java
@@ -0,0 +1,385 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import util.AccessibilityTools;
+import complex.toolkit.interface_tests._XAccessibleComponent;
+import complex.toolkit.interface_tests._XAccessibleContext;
+import complex.toolkit.interface_tests._XAccessibleEventBroadcaster;
+import complex.toolkit.interface_tests._XAccessibleExtendedComponent;
+import complex.toolkit.interface_tests._XAccessibleText;
+import com.sun.star.awt.XWindow;
+import com.sun.star.chart.XChartDocument;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.text.XTextDocument;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XCloseable;
+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 java.io.PrintWriter;
+/**
+ *
+ */
+public class CheckAccessibleStatusBarItem extends ComplexTestCase {
+
+ XMultiServiceFactory xMSF = null;
+ XAccessibleContext testObject = null;
+ XWindow xWindow = null;
+
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkDocs"};//{"checkWriterDoc", "checkDrawDoc",
+// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"};
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ shortWait(500) ;
+ }
+
+ /**
+ * Sleeps for a certain time.
+ * @param Thread is sleeping for this time in milliseconds.
+ */
+ private void shortWait(int time) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check document types
+ */
+ public void checkDocs() {
+ Object doc = param.get("DocType");
+ String testDocType;
+ if (doc == null)
+ testDocType = "all";
+ else
+ testDocType = (String)doc;
+
+ System.out.println("Param was " + doc);
+ System.out.println("DocType " + testDocType);
+ if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all"))
+ checkWriterDoc();
+ if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all"))
+ checkMathDoc();
+ if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all"))
+ checkDrawDoc();
+ if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all"))
+ checkImpressDoc();
+ if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all"))
+ checkCalcDoc();
+
+ }
+
+ /**
+ * Test the interfaces on a writer document
+ */
+ public void checkWriterDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XTextDocument xTextDoc = null;
+ try {
+ log.println("****** Open a new writer document");
+ xTextDoc = xSOF.createTextDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xTextDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a math document
+ */
+ public void checkMathDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xMathDoc = null;
+ try {
+ log.println("****** Open a new math document");
+ xMathDoc = xSOF.createMathDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xMathDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a draw document
+ */
+ public void checkDrawDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xDrawDoc = null;
+ try {
+ log.println("****** Open a new draw document");
+ xDrawDoc = xSOF.createDrawDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xDrawDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on an impress document
+ */
+ public void checkImpressDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xImpressDoc = null;
+ try {
+ log.println("****** Open a new impress document");
+ xImpressDoc = xSOF.createImpressDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xImpressDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ /**
+ * Test the interfaces on an calc document
+ */
+ public void checkCalcDoc() {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XSpreadsheetDocument xSpreadsheetDoc = null;
+ try {
+ log.println("****** Open a new calc document");
+ xSpreadsheetDoc = xSOF.createCalcDoc("_blank");
+ shortWait();
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ runAllInterfaceTests();
+
+ if (xSpreadsheetDoc != null) {
+ XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void getTestObject() {
+ try {
+ XInterface xIfc = (XInterface) xMSF.createInstance(
+ "com.sun.star.awt.Toolkit") ;
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc);
+
+ shortWait();
+ xWindow = (XWindow)UnoRuntime.queryInterface(
+ XWindow.class,tk.getActiveTopWindow());
+
+ shortWait();
+ AccessibilityTools at = new AccessibilityTools();
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+ XAccessibleContext parentContext = null;
+
+ log.println("Get the accessible status bar.");
+ parentContext = at.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+ shortWait();
+ if ( parentContext == null ) {
+ log.println("Could not get the test object: set the correct focus in the next 30 seconds.");
+ shortWait(30000);
+ parentContext = at.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+
+ if ( parentContext == null )
+ failed("Could not create a test object.");
+ }
+ log.println("...OK.");
+
+ testObject=parentContext;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ catch(Throwable t) {
+ System.out.println("Got throwable:");
+ t.printStackTrace();
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ int count = testObject.getAccessibleChildCount();
+ log.println("*****");
+ log.println("**** Found items to test: " + count);
+ for (int i=0;i<count;i++){
+ log.println("**** Now testing StatusBarItem " + i + ".");
+ XAccessible object = null;
+ try {
+ object = testObject.getAccessibleChild(i);
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("* Cannot get item Nr: " + i);
+ continue;
+ }
+ XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class,object);
+ String[] services = xSI.getSupportedServiceNames();
+ log.println("* Implementation Name: " + xSI.getImplementationName());
+ String accName = object.getAccessibleContext().getAccessibleName();
+ log.println("* Accessible Name: " + accName);
+ for (int j=0; i<services.length; i++)
+ log.println("* ServiceName "+i+": "+ services[j]);
+ log.println("*****");
+
+ log.println("*** Now testing XAccessibleComponent ***");
+ _XAccessibleComponent _xAccCompTest =
+ new _XAccessibleComponent(object, log);
+ assure("failed: "+accName+" - XAccessibleComponent::getBounds", _xAccCompTest._getBounds(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::contains", _xAccCompTest._containsPoint(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getBackground", _xAccCompTest._getBackground(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getForeground", _xAccCompTest._getForeground(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getLocation", _xAccCompTest._getLocation(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::getSize", _xAccCompTest._getSize(), true);
+ assure("failed: "+accName+" - XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus(), true);
+
+ log.println("*** Now testing XAccessibleContext ***");
+ _XAccessibleContext _xAccContext =
+ new _XAccessibleContext(object, log);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet(), true);
+ assure("failed: "+accName+" - XAccessibleContext::getLocale", _xAccContext._getLocale(), true);
+
+ log.println("*** Now testing XAccessibleExtendedComponent ***");
+ _XAccessibleExtendedComponent _xAccExtComp =
+ new _XAccessibleExtendedComponent(object, log);
+ assure("failed: "+accName+" - XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont(), true);
+ assure("failed: "+accName+" - XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText(), true);
+ assure("failed: "+accName+" - XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText(), true);
+
+ log.println("*** Now testing XAccessibleEventBroadcaster ***");
+ _XAccessibleEventBroadcaster _xAccEvBcast =
+ new _XAccessibleEventBroadcaster(object, log, "Pfff", xWindow);
+ assure("failed: "+accName+" - XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener(), true);
+ assure("failed: "+accName+" - XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener(), true);
+
+ log.println("*** Now testing XAccessibleText ***");
+ _XAccessibleText _xAccText =
+ new _XAccessibleText(object, log, xMSF, "true");
+ assure("failed: "+accName+" - XAccessibleText::getText", _xAccText._getText(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacterCount", _xAccText._getCharacterCount(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacterBounds", _xAccText._getCharacterBounds(), true);
+ assure("failed: "+accName+" - XAccessibleText::setSelection", _xAccText._setSelection(), true);
+ assure("failed: "+accName+" - XAccessibleText::copyText", _xAccText._copyText(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacter", _xAccText._getCharacter(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCharacterAttributes", _xAccText._getCharacterAttributes(), true);
+ assure("failed: "+accName+" - XAccessibleText::getIndexAtPoint", _xAccText._getIndexAtPoint(), true);
+ assure("failed: "+accName+" - XAccessibleText::getSelectedText", _xAccText._getSelectedText(), true);
+ assure("failed: "+accName+" - XAccessibleText::getSelectionEnd", _xAccText._getSelectionEnd(), true);
+ assure("failed: "+accName+" - XAccessibleText::getSelectionStart", _xAccText._getSelectionStart(), true);
+ assure("failed: "+accName+" - XAccessibleText::getTextAtIndex", _xAccText._getTextAtIndex(), true);
+ assure("failed: "+accName+" - XAccessibleText::getTextBeforeIndex", _xAccText._getTextBeforeIndex(), true);
+ assure("failed: "+accName+" - XAccessibleText::getBehindIndex", _xAccText._getTextBehindIndex(), true);
+ assure("failed: "+accName+" - XAccessibleText::getTextRange", _xAccText._getTextRange(), true);
+ assure("failed: "+accName+" - XAccessibleText::setCaretPosition", _xAccText._setCaretPosition(), true);
+ assure("failed: "+accName+" - XAccessibleText::getCaretPosition", _xAccText._getCaretPosition(), true);
+ }
+ }
+
+}
diff --git a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java
new file mode 100644
index 000000000000..cc184f3c1a73
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java
@@ -0,0 +1,127 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit;
+
+import complexlib.ComplexTestCase;
+import util.SOfficeFactory;
+import complex.toolkit.interface_tests._XRequestCallback;
+import complex.toolkit.CallbackClass;
+import com.sun.star.awt.XRequestCallback;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.awt.XExtendedToolkit;
+import java.io.PrintWriter;
+
+/**
+ *
+ */
+public class CheckAsyncCallback extends ComplexTestCase {
+
+
+ XInterface testObject = null;
+ XMultiServiceFactory xMSF = null;
+
+ public String[] getTestMethodNames() {
+ return new String[]{"checkService"};
+ }
+
+/* public String getTestObjectName() {
+ return "com.sun.star.awt.AccessibleStatusBar";
+ }
+*/
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(500) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check services
+ */
+ public void checkService() {
+ checkAsyncCallbackService();
+
+ }
+
+ /**
+ * Test the interfaces
+ */
+ public void checkAsyncCallbackService() {
+ runAllInterfaceTests();
+ }
+
+ public void getTestObject() {
+ try {
+ xMSF = (XMultiServiceFactory)param.getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+
+ XRequestCallback xAsyncCallback = null;
+
+ XInterface xIfc = (XInterface)xMSF.createInstance(
+ "com.sun.star.awt.AsyncCallback" );
+ xAsyncCallback = (XRequestCallback)
+ UnoRuntime.queryInterface(XRequestCallback.class,xIfc);
+
+ testObject=xAsyncCallback;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+ catch(Throwable t) {
+ System.out.println("Got throwable:");
+ t.printStackTrace();
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ getTestObject();
+ log.println("*** Now testing XRequestCallback ***");
+ _XRequestCallback _xRequestCallback =
+ new _XRequestCallback(testObject, log, xMSF );
+ assure("failed: XRequestCallback::addCallback", _xRequestCallback._addCallback());
+ }
+
+ public void checkCallback() {
+ getTestObject();
+ log.println("*** Now testing asynchronous callback service ***");
+ XRequestCallback xAsyncCallback = null;
+ xAsyncCallback = (XRequestCallback)
+ UnoRuntime.queryInterface( XRequestCallback.class, testObject );
+ CallbackClass aCallbackClass = new CallbackClass( log, xMSF );
+ xAsyncCallback.addCallback( aCallbackClass, null );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java
new file mode 100755
index 000000000000..e3d80629be40
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java
@@ -0,0 +1,489 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import share.LogWriter;
+import com.sun.star.awt.Point;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.Size;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.uno.XInterface;
+import java.util.Vector;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleComponent</code>
+ * interface methods :
+ * <ul>
+ * <li><code> containsPoint()</code></li>
+ * <li><code> getAccessibleAtPoint()</code></li>
+ * <li><code> getBounds()</code></li>
+ * <li><code> getLocation()</code></li>
+ * <li><code> getLocationOnScreen()</code></li>
+ * <li><code> getSize()</code></li>
+ * <li><code> grabFocus()</code></li>
+ * <li><code> getAccessibleKeyBinding()</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ */
+public class _XAccessibleComponent {
+
+ private LogWriter log;
+
+ public XAccessibleComponent oObj = null;
+
+ private Rectangle bounds = null ;
+
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleComponent";
+
+ /**
+ * Constructor
+ */
+ public _XAccessibleComponent(XInterface object, LogWriter log) {
+ oObj = (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, object);
+ this.log = log;
+ }
+
+ /**
+ * First checks 4 inner bounds (upper, lower, left and right)
+ * of component bounding box to contain
+ * at least one point of the component. Second 4 outer bounds
+ * are checked to not contain any component points.<p>
+ *
+ * Has <b> OK </b> status if inner bounds contain component points
+ * and outer bounds don't contain any component points. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> : to have size of a component.</li>
+ * </ul>
+ */
+ public boolean _containsPoint() {
+
+ boolean result = true ;
+
+ int curX = 0;
+ //while (!oObj.containsPoint(new Point(curX, bounds.Y)) && curX < bounds.Width+bounds.X) {
+ while (!oObj.containsPoint(new Point(curX, 0)) && curX < bounds.Width) {
+ curX++;
+ };
+ //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) {
+ if (curX < bounds.Width) {
+ log.println("Upper bound of box contains point ("
+ + curX + ",0) - OK");
+ } else {
+ log.println
+ ("Upper bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ curX = 0;
+ //while (!oObj.containsPoint(new Point(curX, bounds.Y+bounds.Height - 1))
+ while (!oObj.containsPoint(new Point(curX, bounds.Height - 1))
+ && curX < bounds.Width) {
+
+ log.println("Contains returns false for ("+curX+","+bounds.Height+")");
+ curX++;
+ };
+ //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) {
+ if (curX < bounds.Width) {
+ log.println("Lower bound of box contains point ("
+ + curX + "," + (bounds.Height - 1) + ") - OK");
+ } else {
+ log.println
+ ("Lower bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ int curY = 0;
+ //while (!oObj.containsPoint(new Point(bounds.X, curY)) && curY < bounds.Height+bounds.Y) {
+ while (!oObj.containsPoint(new Point(0, curY)) && curY < bounds.Height) {
+ curY++;
+ };
+ //if ((bounds.Y <= curY) && (curY < bounds.Height+bounds.Y)) {
+ if (curY < bounds.Height) {
+ log.println("Left bound of box contains point (0,"
+ + curY + ") - OK");
+ } else {
+ log.println
+ ("Left bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ curY = 0;
+ //while (!oObj.containsPoint(new Point(bounds.X+bounds.Width - 1, curY))
+ // && curY < bounds.Height+bounds.Y) {
+ while (!oObj.containsPoint(new Point(bounds.Width - 1, curY)) && curY < bounds.Height) {
+ curY++;
+ };
+ //if ((bounds.Y <= curY) && (curY < bounds.Height + bounds.Y)) {
+ if (curY < bounds.Height) {
+ log.println("Right bound of box contains point ("
+ + (bounds.Width - 1) + "," + curY + ") - OK");
+ } else {
+ log.println
+ ("Right bound of box contains no component points - FAILED");
+ result = false;
+ }
+
+ boolean locRes = true;
+ for (int x = -1; x <= bounds.Width; x++) {
+ locRes &= !oObj.containsPoint(new Point(x, -1));
+ locRes &= !oObj.containsPoint(new Point(x, bounds.Height+bounds.Y));
+ }
+ if (locRes) {
+ log.println("Outer upper and lower bounds contain no component "
+ + "points - OK");
+ } else {
+ log.println("Outer upper and lower bounds CONTAIN some component "
+ + "points - FAILED");
+ result = false;
+ }
+
+ locRes = true;
+ for (int y = -1; y <= bounds.Height; y++) {
+ locRes &= !oObj.containsPoint(new Point(-1, y));
+ locRes &= !oObj.containsPoint(new Point(bounds.X+bounds.Width, y));
+ }
+ if (locRes) {
+ log.println("Outer left and right bounds contain no component "
+ + "points - OK");
+ } else {
+ log.println("Outer left and right bounds CONTAIN some component "
+ + "points - FAILED");
+ result = false;
+ }
+
+ return result;
+ }
+
+ /**
+ * Iterates through all children which implement
+ * <code>XAccessibleComponent</code> (if they exist) determines their
+ * boundaries and tries to get each child by <code>getAccessibleAtPoint</code>
+ * passing point which belongs to the child.
+ * Also the point is checked which doesn't belong to child boundary
+ * box. <p>
+ *
+ * Has <b> OK </b> status if in the first cases the right children
+ * are returned, and in the second <code>null</code> or
+ * another child is returned.
+ */
+ public boolean _getAccessibleAtPoint() {
+
+ boolean result = true ;
+ XAccessibleComponent[] children = getChildrenComponents();
+
+ if (children.length > 0) {
+ for (int i = 0; i < children.length; i++) {
+ Rectangle chBnd = children[i].getBounds();
+ if (chBnd.X == -1) continue;
+ log.println("Checking child with bounds " +
+ "(" + chBnd.X + "," + chBnd.Y + "),("
+ + chBnd.Width + "," + chBnd.Height + "): "
+ + util.AccessibilityTools.accessibleToString(children[i]));
+
+ log.println("finding the point which lies on the component");
+ int curX = 0;
+ int curY = 0;
+ while (!children[i].containsPoint(new Point(curX, curY))
+ && curX < chBnd.Width) {
+ curX++;
+ curY++;
+ };
+
+ if (curX==chBnd.Width) {
+ log.println("Couldn't find a point with contains");
+ continue;
+ }
+
+ // trying the point laying on child
+ XAccessible xAcc = oObj.getAccessibleAtPoint
+ (new Point(chBnd.X , chBnd.Y));
+ if (xAcc == null) {
+ log.println("The child not found at point ("
+ + (chBnd.X ) + "," + chBnd.Y + ") - FAILED");
+ result = false;
+ } else {
+ XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, children[i]);
+ log.println("Child found at point ("
+ + (chBnd.X ) + "," + chBnd.Y + ") - OK");
+ boolean res = util.AccessibilityTools.equals(xAccCh, xAcc);
+ if (!res) {
+ int expIndex = xAccCh.getAccessibleContext().getAccessibleIndexInParent();
+ int gotIndex = xAcc.getAccessibleContext().getAccessibleIndexInParent();
+ if (expIndex < gotIndex) {
+ log.println("The children found is not the same");
+ log.println("The expected child " +
+ xAccCh.getAccessibleContext().getAccessibleName());
+ log.println("is hidden behind the found Child ");
+ log.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK");
+ } else {
+ log.println("The children found is not the same - FAILED");
+ log.println("Expected: "
+ +xAccCh.getAccessibleContext().getAccessibleName());
+ log.println("Found: "
+ +xAcc.getAccessibleContext().getAccessibleName());
+ result = false ;
+ }
+ }
+ }
+
+ // trying the point NOT laying on child
+ xAcc = oObj.getAccessibleAtPoint
+ (new Point(chBnd.X - 1, chBnd.Y - 1));
+ if (xAcc == null) {
+ log.println("No children found at point ("
+ + (chBnd.X - 1) + "," + (chBnd.Y - 1) + ") - OK");
+ result &= true;
+ } else {
+ XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, children[i]);
+ boolean res = util.AccessibilityTools.equals(xAccCh, xAcc);
+ if (res) {
+ log.println("The same child found outside "
+ + "its bounds - FAILED");
+ result = false ;
+ }
+ }
+ }
+ } else {
+ log.println("There are no children supporting "
+ + "XAccessibleComponent");
+ }
+
+ return result;
+ }
+
+ /**
+ * Retrieves the component bounds and stores it. <p>
+ *
+ * Has <b> OK </b> status if boundary position (x,y) is not negative
+ * and size (Width, Height) is greater than 0.
+ */
+ public boolean _getBounds() {
+ boolean result = true ;
+
+ bounds = oObj.getBounds() ;
+ result &= bounds != null
+ && bounds.X >=0 && bounds.Y >=0
+ && bounds.Width >0 && bounds.Height >0;
+
+ log.println("Bounds = " + (bounds != null
+ ? "(" + bounds.X + "," + bounds.Y + "),("
+ + bounds.Width + "," + bounds.Height + ")" : "null"));
+
+ return result;
+ }
+
+ /**
+ * Gets the location. <p>
+ *
+ * Has <b> OK </b> status if the location is the same as location
+ * of boundary obtained by <code>getBounds()</code> method.
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> : to have bounds </li>
+ * </ul>
+ */
+ public boolean _getLocation() {
+
+ boolean result = true ;
+ Point loc = oObj.getLocation() ;
+
+ result &= loc.X == bounds.X && loc.Y == bounds.Y ;
+
+ return result;
+ }
+
+ /**
+ * Get the screen location of the component and its parent
+ * (if it exists and supports <code>XAccessibleComponent</code>). <p>
+ *
+ * Has <b> OK </b> status if component screen location equals
+ * to screen location of its parent plus location of the component
+ * relative to the parent. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> : to have location of the component
+ * relative to its parent</li>
+ * </ul>
+ */
+ public boolean _getLocationOnScreen() {
+
+ XAccessibleComponent parent = getParentComponent();
+
+ boolean result = true ;
+ Point loc = oObj.getLocationOnScreen();
+ log.println("Location is (" + loc.X + "," + loc.Y + ")");
+
+ if (parent != null) {
+ Point parLoc = parent.getLocationOnScreen();
+ log.println("Parent location is ("
+ + parLoc.X + "," + parLoc.Y + ")");
+
+ result &= parLoc.X + bounds.X == loc.X;
+ result &= parLoc.Y + bounds.Y == loc.Y;
+ }
+
+ return result;
+ }
+
+ /**
+ * Obtains the size of the component. <p>
+ *
+ * Has <b> OK </b> status if the size is the same as in bounds. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getBounds() </code> </li>
+ * </ul>
+ */
+ public boolean _getSize() {
+
+ boolean result = true ;
+ Size size = oObj.getSize() ;
+
+ result &= size.Width == bounds.Width;
+ result &= size.Height == bounds.Height;
+
+ return result;
+ }
+
+ /**
+ * Just calls the method. <p>
+ *
+ * Has <b> OK </b> status if no runtime exceptions occured.
+ */
+ public boolean _grabFocus() {
+
+ boolean result = true ;
+ oObj.grabFocus() ;
+
+ return result ;
+ }
+
+ /**
+ * Retrieves all children (not more than 50) of the current
+ * component which support <code>XAccessibleComponent</code>.
+ *
+ * @return The array of children. Empty array returned if
+ * such children were not found or some error occured.
+ */
+ private XAccessibleComponent[] getChildrenComponents() {
+ XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, oObj) ;
+ if (xAcc == null) {
+ log.println("Component doesn't support XAccessible.");
+ return new XAccessibleComponent[0];
+ }
+ XAccessibleContext xAccCon = xAcc.getAccessibleContext();
+ int cnt = xAccCon.getAccessibleChildCount();
+
+ // for cases when too many children exist checking only first 50
+ if (cnt > 50) cnt = 50 ;
+
+ Vector childComp = new Vector();
+ for (int i = 0; i < cnt; i++) {
+ try {
+ XAccessible child = xAccCon.getAccessibleChild(i);
+ XAccessibleContext xAccConCh = child.getAccessibleContext();
+ XAccessibleComponent xChAccComp = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class,
+ xAccConCh);
+ if (xChAccComp != null) {
+ childComp.add(xChAccComp) ;
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {}
+ }
+
+ return (XAccessibleComponent[]) childComp.toArray
+ (new XAccessibleComponent[childComp.size()]);
+ }
+
+ /**
+ * Gets the parent of the current component which support
+ * <code>XAccessibleComponent</code>.
+ *
+ * @return The parent or <code>null</code> if the component
+ * has no parent or some errors occured.
+ */
+ private XAccessibleComponent getParentComponent() {
+ XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface
+ (XAccessible.class, oObj) ;
+ if (xAcc == null) {
+ log.println("Component doesn't support XAccessible.");
+ return null;
+ }
+
+ XAccessibleContext xAccCon = xAcc.getAccessibleContext();
+ XAccessible xAccPar = xAccCon.getAccessibleParent();
+
+ if (xAccPar == null) {
+ log.println("Component has no accessible parent.");
+ return null;
+ }
+ XAccessibleContext xAccConPar = xAccPar.getAccessibleContext();
+ XAccessibleComponent parent = (XAccessibleComponent)
+ UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar);
+ if (parent == null) {
+ log.println
+ ("Accessible parent doesn't support XAccessibleComponent");
+ return null;
+ }
+
+ return parent;
+ }
+
+ /**
+ * Just calls the method.
+ */
+ public boolean _getForeground() {
+ int forColor = oObj.getForeground();
+ log.println("getForeground(): " + forColor);
+ return true;
+ }
+
+ /**
+ * Just calls the method.
+ */
+ public boolean _getBackground() {
+ int backColor = oObj.getBackground();
+ log.println("getBackground(): " + backColor);
+ return true;
+ }
+
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java
new file mode 100755
index 000000000000..230eb3d098d3
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java
@@ -0,0 +1,261 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.lang.Locale;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.IllegalAccessibleComponentStateException;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.accessibility.AccessibleRelationType;
+import util.AccessibilityTools;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleContext</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getAccessibleChildCount()</code></li>
+ * <li><code> getAccessibleChild()</code></li>
+ * <li><code> getAccessibleParent()</code></li>
+ * <li><code> getAccessibleIndexInParent()</code></li>
+ * <li><code> getAccessibleRole()</code></li>
+ * <li><code> getAccessibleDescription()</code></li>
+ * <li><code> getAccessibleName()</code></li>
+ * <li><code> getAccessibleRelationSet()</code></li>
+ * <li><code> getAccessibleStateSet()</code></li>
+ * <li><code> getLocale()</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleContext
+ */
+public class _XAccessibleContext {
+
+ private LogWriter log;
+
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleContext" ;
+
+ public XAccessibleContext oObj = null;
+
+ private int childCount = 0;
+ private XAccessible parent = null ;
+
+ public _XAccessibleContext(XInterface object, LogWriter log) {
+ oObj = (XAccessibleContext)UnoRuntime.queryInterface(
+ XAccessibleContext.class, object);
+ this.log = log;
+ }
+
+ /**
+ * Calls the method and stores the number of children. <p>
+ * Has <b> OK </b> status if non-negative number rutrned.
+ */
+ public boolean _getAccessibleChildCount() {
+ childCount = oObj.getAccessibleChildCount();
+ log.println("" + childCount + " children found.");
+ return childCount > -1;
+ }
+
+ /**
+ * Tries to get every child and checks its parent. <p>
+ *
+ * Has <b> OK </b> status if parent of every child
+ * and the tested component are the same objects.
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getAccessibleChildCount() </code> : to have a number of
+ * children </li>
+ * </ul>
+ */
+ public boolean _getAccessibleChild() {
+ boolean bOK = true;
+ int counter = childCount;
+ if (childCount > 500) counter = 500;
+ for (int i = 0; i < counter; i++) {
+ try {
+ XAccessible ch = oObj.getAccessibleChild(i) ;
+ XAccessibleContext chAC = ch.getAccessibleContext();
+
+ log.println(" Child " + i + ": " +
+ chAC.getAccessibleDescription()) ;
+
+ if (!AccessibilityTools.equals
+ (chAC.getAccessibleParent().getAccessibleContext(), oObj)){
+
+ log.println("Role:");
+ log.println("Getting: "+chAC.getAccessibleParent().getAccessibleContext().getAccessibleRole());
+ log.println("Expected: "+oObj.getAccessibleRole());
+
+ log.println("ImplementationName:");
+ log.println("Getting: "+util.utils.getImplName(chAC.getAccessibleParent().getAccessibleContext()));
+ log.println("Expected: "+util.utils.getImplName(oObj));
+
+ log.println("The parent of child and component "+
+ "itself differ.");
+ log.println("Getting(Description): "
+ +chAC.getAccessibleParent().getAccessibleContext().getAccessibleDescription());
+ log.println("Expected(Description): "
+ +oObj.getAccessibleDescription());
+
+ bOK = false;
+ } else {
+ log.println("Getting the expected Child -- OK");
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ bOK = false;
+ }
+ }
+
+ return bOK;
+ }
+
+ /**
+ * Just gets the parent. <p>
+ *
+ * Has <b> OK </b> status if parent is not null.
+ */
+ public boolean _getAccessibleParent() {
+ // assume that the component is not ROOT
+ parent = oObj.getAccessibleParent();
+ return parent != null;
+ }
+
+ /**
+ * Retrieves the index of tested component in its parent.
+ * Then gets the parent's child by this index and compares
+ * it with tested component.<p>
+ *
+ * Has <b> OK </b> status if the parent's child and the tested
+ * component are the same objects.
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getAccessibleParent() </code> : to have a parent </li>
+ * </ul>
+ */
+ public boolean _getAccessibleIndexInParent() {
+
+ boolean bOK = true;
+ int idx = oObj.getAccessibleIndexInParent();
+
+ XAccessibleContext parentAC = parent.getAccessibleContext() ;
+ try {
+ bOK &= AccessibilityTools.equals(
+ parentAC.getAccessibleChild(idx).getAccessibleContext(),oObj);
+ if (!bOK) {
+ log.println("Expected: "+util.utils.getImplName(oObj));
+ log.println("Getting: "+util.utils.getImplName(
+ parentAC.getAccessibleChild(idx).getAccessibleContext()));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ bOK = false;
+ }
+ return bOK;
+ }
+
+ /**
+ * Get the accessible role of component. <p>
+ *
+ * Has <b> OK </b> status if non-negative number rutrned.
+ */
+ public boolean _getAccessibleRole() {
+ short role = oObj.getAccessibleRole();
+ log.println("The role is " + role);
+ return role > -1;
+ }
+
+ /**
+ * Get the accessible name of the component. <p>
+ *
+ * Has <b> OK </b> status if the name has non-zero length.
+ */
+ public boolean _getAccessibleName() {
+ String name = oObj.getAccessibleName();
+ log.println("The name is '" + name + "'");
+ return name != null;
+ }
+
+ /**
+ * Get the accessible description of the component. <p>
+ *
+ * Has <b> OK </b> status if the description has non-zero length.
+ */
+ public boolean _getAccessibleDescription() {
+ String descr = oObj.getAccessibleDescription();
+ log.println("The description is '" + descr + "'");
+ return descr != null;
+ }
+
+ /**
+ * Just gets the set. <p>
+ *
+ * Has <b> OK </b> status if the set is not null.
+ */
+ public boolean _getAccessibleRelationSet() {
+ XAccessibleRelationSet set = oObj.getAccessibleRelationSet();
+ return set != null;
+ }
+
+ /**
+ * Just gets the set. <p>
+ *
+ * Has <b> OK </b> status if the set is not null.
+ */
+ public boolean _getAccessibleStateSet() {
+ XAccessibleStateSet set = oObj.getAccessibleStateSet();
+ return set != null;
+ }
+
+ /**
+ * Gets the locale. <p>
+ *
+ * Has <b> OK </b> status if <code>Country</code> and
+ * <code>Language</code> fields of locale structure
+ * are not empty.
+ */
+ public boolean _getLocale() {
+ Locale loc = null ;
+ try {
+ loc = oObj.getLocale();
+ log.println("The locale is " + loc.Language + "," + loc.Country);
+ } catch (IllegalAccessibleComponentStateException e) {
+ e.printStackTrace();
+ }
+
+ return loc != null && loc.Language.length() > 0 &&
+ loc.Country.length() > 0;
+ }
+}
+
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java
new file mode 100755
index 000000000000..18a20d02e233
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java
@@ -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.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.lang.EventObject;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.PosSize;
+import com.sun.star.awt.XWindow;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>
+ * com.sun.star.accessibility.XAccessibleEventBroadcaster</code>
+ * interface methods :
+ * <ul>
+ * <li><code> addEventListener()</code></li>
+ * <li><code> removeEventListener()</code></li>
+ * </ul> <p>
+ *
+ * This test needs the following object relations :
+ * <ul>
+ * <li> <code>'EventProducer'</code> (of type
+ * <code>ifc.accessibility._XAccessibleEventBroadcaster.EventProducer</code>):
+ * this must be an implementation of the interface which could perform
+ * some actions for generating any kind of <code>AccessibleEvent</code></li>
+ * <ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ */
+public class _XAccessibleEventBroadcaster {
+
+ private LogWriter log;
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleEventBroadcaster" ;
+
+ public XAccessibleEventBroadcaster oObj = null;
+ public String EventMsg = "";
+ EventProducer prod = null ;
+ EvListener list = new EvListener();
+
+ /**
+ * An event producer
+ */
+ public static class EventProducer {
+ XWindow xWindow;
+ public EventProducer(XWindow window) {
+ xWindow = window;
+ }
+
+ public void fireEvent() {
+ Rectangle newPosSize = xWindow.getPosSize();
+ newPosSize.Width = newPosSize.Width - 20;
+ newPosSize.Height = newPosSize.Height - 20;
+ newPosSize.X = newPosSize.X + 20;
+ newPosSize.Y = newPosSize.Y + 20;
+ xWindow.setPosSize(newPosSize.X, newPosSize.Y, newPosSize.Width,
+ newPosSize.Height, PosSize.POSSIZE);
+ }
+ }
+
+ /**
+ * Listener implementation which registers listener calls.
+ */
+ private class EvListener implements XAccessibleEventListener {
+ public AccessibleEventObject notifiedEvent = null ;
+ public void notifyEvent(AccessibleEventObject ev) {
+ log.println("Listener, Event : " + ev.EventId);
+ System.out.println("EventID: " + ev.EventId);
+ Object old=ev.OldValue;
+ if (old instanceof com.sun.star.accessibility.XAccessible) {
+ System.out.println("Old: "+((XAccessible)old).getAccessibleContext().getAccessibleName());
+ }
+
+ Object nev=ev.NewValue;
+ if (nev instanceof com.sun.star.accessibility.XAccessible) {
+ System.out.println("New: "+((XAccessible)nev).getAccessibleContext().getAccessibleName());
+ }
+ notifiedEvent = ev;
+ }
+
+ public void disposing(EventObject ev) {}
+ }
+
+ /**
+ * c'tor
+ */
+ public _XAccessibleEventBroadcaster(XInterface object, LogWriter log, String eventMessage, XWindow window) {
+ oObj = (XAccessibleEventBroadcaster)UnoRuntime.queryInterface(
+ XAccessibleEventBroadcaster.class, object);
+ this.log = log;
+ prod = new EventProducer(window);
+ EventMsg = eventMessage;
+ }
+
+ /**
+ * Adds two listeners and fires event by mean of object relation. <p>
+ * Has <b> OK </b> status if both listeners were called
+ */
+ public boolean _addEventListener() {
+ log.println("adding two listeners");
+ oObj.addEventListener(list);
+ boolean isTransient = chkTransient(oObj);
+ log.println("fire event");
+ prod.fireEvent() ;
+
+ try {
+ Thread.sleep(1500);
+ }
+ catch (InterruptedException ex) {
+ }
+
+ boolean works = true;
+
+ if (list.notifiedEvent == null) {
+ if (!isTransient) {
+ log.println("listener wasn't called");
+ works = false;
+ } else {
+ log.println("Object is Transient, listener isn't expected to be called");
+ }
+ oObj.removeEventListener(list);
+ }
+
+// log.println(EventMsg);
+ return works;
+ }
+
+ /**
+ * Removes one of two listeners added before and and fires event
+ * by mean of object relation. <p>
+ *
+ * Has <b> OK </b> status if the removed listener wasn't called. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code>addEventListener()</code> : to have added listeners </li>
+ * </ul>
+ */
+ public boolean _removeEventListener() {
+
+ list.notifiedEvent = null;
+
+ log.println("remove first listener");
+ oObj.removeEventListener(list);
+
+ log.println("fire event");
+ prod.fireEvent() ;
+
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException ex) {
+ }
+
+ if (list.notifiedEvent == null) {
+ log.println("listener wasn't called -- OK");
+ }
+
+ return list.notifiedEvent == null;
+
+ }
+
+ protected static boolean chkTransient(Object Testcase) {
+ XAccessibleContext accCon = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class,Testcase);
+ if (accCon.getAccessibleStateSet().contains(
+ com.sun.star.accessibility.AccessibleStateType.TRANSIENT)){
+ if (!accCon.getAccessibleParent().getAccessibleContext().getAccessibleStateSet().contains(
+ com.sun.star.accessibility.AccessibleStateType.MANAGES_DESCENDANTS)) {
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+}
+
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java
new file mode 100755
index 000000000000..e022e60d90c0
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.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 complex.toolkit.interface_tests;
+
+import lib.MultiMethodTest;
+import com.sun.star.accessibility.XAccessibleExtendedComponent;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.accessibility.AccessibleStateType;
+import com.sun.star.awt.XFont;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleExtendedComponent</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getForeground()</code></li>
+ * <li><code> getBackground()</code></li>
+ * <li><code> getFont()</code></li>
+ * <li><code> isEnabled()</code></li>
+ * <li><code> getTitledBorderText()</code></li>
+ * <li><code> getToolTipText()</code></li>
+ * </ul> <p>
+ * @see com.sun.star.accessibility.XAccessibleExtendedComponent
+ */
+public class _XAccessibleExtendedComponent {
+
+ private LogWriter log;
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleExtendedComponent" ;
+
+ public XAccessibleExtendedComponent oObj = null;
+
+ // temporary while accessibility package is in com.sun.star
+ protected String getTestedClassName() {
+ return className;
+ }
+
+ public _XAccessibleExtendedComponent(XInterface object, LogWriter log) {
+ oObj = (XAccessibleExtendedComponent)UnoRuntime.queryInterface(
+ XAccessibleExtendedComponent.class, object);
+ this.log = log;
+ }
+
+ /**
+ * Just calls the method.
+ */
+ public boolean _getFont() {
+ XFont font = oObj.getFont();
+ log.println("getFont(): " + font);
+ return true;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value isn't null.
+ */
+ public boolean _getTitledBorderText() {
+ String titleBorderText = oObj.getTitledBorderText();
+ log.println("getTitledBorderText(): '" + titleBorderText + "'");
+ return titleBorderText != null;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value isn't null.
+ */
+ public boolean _getToolTipText() {
+ String toolTipText = oObj.getToolTipText();
+ log.println("getToolTipText(): '" + toolTipText + "'");
+ return toolTipText != null;
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java
new file mode 100755
index 000000000000..d6357e8f24bc
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java
@@ -0,0 +1,1017 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.accessibility.XAccessibleText;
+import lib.MultiMethodTest;
+//import lib.StatusException;
+//import lib.Status;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.Point;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.accessibility.AccessibleTextType;
+import com.sun.star.accessibility.TextSegment;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.accessibility.XAccessibleText</code>
+ * interface methods :
+ * <ul>
+ * <li><code> getCaretPosition()</code></li>
+ * <li><code> setCaretPosition()</code></li>
+ * <li><code> getCharacter()</code></li>
+ * <li><code> getCharacterAttributes()</code></li>
+ * <li><code> getCharacterBounds()</code></li>
+ * <li><code> getCharacterCount()</code></li>
+ * <li><code> getIndexAtPoint()</code></li>
+ * <li><code> getSelectedText()</code></li>
+ * <li><code> getSelectionStart()</code></li>
+ * <li><code> getSelectionEnd()</code></li>
+ * <li><code> setSelection()</code></li>
+ * <li><code> getText()</code></li>
+ * <li><code> getTextRange()</code></li>
+ * <li><code> getTextAtIndex()</code></li>
+ * <li><code> getTextBeforeIndex()</code></li>
+ * <li><code> getTextBehindIndex()</code></li>
+ * <li><code> copyText()</code></li>
+ * </ul> <p>
+ * This test needs the following object relations :
+ * <ul>
+ * <li> <code>'XAccessibleText.Text'</code> (of type <code>String</code>)
+ * <b> optional </b> :
+ * the string presentation of component's text. If the relation
+ * is not specified, then text from method <code>getText()</code>
+ * is used.
+ * </li>
+ * </ul> <p>
+ * @see com.sun.star.accessibility.XAccessibleText
+ */
+public class _XAccessibleText {
+
+ private LogWriter log;
+
+ private static final String className =
+ "com.sun.star.accessibility.XAccessibleText" ;
+
+ public XAccessibleText oObj = null;
+ private XMultiServiceFactory xMSF;
+
+ Rectangle chBounds = null;
+ int chCount = 0;
+
+ String text = null;
+ String editOnly = null;
+
+
+ public _XAccessibleText(XInterface object, LogWriter log, XMultiServiceFactory xMSF, String editOnly) {
+ oObj = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, object);
+ this.xMSF = xMSF;
+ this.log = log;
+ this.editOnly = editOnly;
+ }
+
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value is equal to <code>chCount - 1</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setCaretPosition()</code> </li>
+ * </ul>
+ */
+ public boolean _getCaretPosition() {
+
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+ if ( chCount > 0 ) {
+ try {
+ oObj.setCaretPosition(chCount - 1);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ie) {
+
+ }
+ int carPos = oObj.getCaretPosition();
+ log.println("getCaretPosition: " + carPos);
+ res = carPos == (chCount - 1);
+ }
+ return res;
+ }
+
+ /**
+ * Calls the method with the wrong index and with the correct index
+ * <code>chCount - 1</code>.
+ * Has OK status if exception was thrown for wrong index and
+ * if exception wasn't thrown for the correct index.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _setCaretPosition() {
+ boolean res = true;
+
+ try {
+ log.println("setCaretPosition(-1):");
+ oObj.setCaretPosition(-1);
+ res &= false;
+ log.println("exception was expected");
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("setCaretPosition(chCount+1):");
+ oObj.setCaretPosition(chCount+1);
+ res &= false;
+ log.println("exception was expected");
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("expected exception");
+ res &= true;
+ }
+ if ( chCount > 0 ) {
+ try {
+ log.println("setCaretPosition(chCount - 1)");
+ oObj.setCaretPosition(chCount - 1);
+ res &= true;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with the wrong index and with the correct indexes.
+ * Checks every character in the text.
+ * Has OK status if exception was thrown for wrong index,
+ * if exception wasn't thrown for the correct index and
+ * if every character is equal to corresponding character in the text.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getCharacter() {
+ boolean res = true;
+
+ try {
+ log.println("getCharacter(-1)");
+ oObj.getCharacter(-1);
+ log.println("Exception was expected");
+ res = false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res = true;
+ }
+
+ try {
+ log.println("getCharacter(chCount)");
+ oObj.getCharacter(chCount);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("Checking of every character in the text...");
+ boolean isEqCh = true;
+ for(int i = 0; i < chCount; i++) {
+ char ch = oObj.getCharacter(i);
+ isEqCh = ch == text.charAt(i);
+ res &= isEqCh;
+ if (!isEqCh) {
+ log.println("At the position " + i +
+ "was expected character: " + text.charAt(i));
+ log.println("but was returned: " + ch);
+ break;
+ }
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with the wrong indexes and with the correct index,
+ * checks a returned value.
+ * Has OK status if exception was thrown for the wrong indexes,
+ * if exception wasn't thrown for the correct index and
+ * if returned value isn't <code>null</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getCharacterAttributes() {
+ boolean res = true;
+
+ try {
+ log.println("getCharacterAttributes(-1)");
+ oObj.getCharacterAttributes(-1, new String[0]);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getCharacterAttributes(chCount)");
+ oObj.getCharacterAttributes(chCount, new String[0]);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if ( chCount > 0 ) {
+ log.println("getCharacterAttributes(chCount-1)");
+ PropertyValue[] props = oObj.getCharacterAttributes(chCount - 1, new String[0]);
+ res &= props != null;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+
+ /**
+ * Calls the method with the wrong indexes and with the correct index.
+ * checks and stores a returned value.
+ * Has OK status if exception was thrown for the wrong indexes,
+ * if exception wasn't thrown for the correct index and
+ * if returned value isn't <code>null</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getCharacterBounds() {
+ boolean res = true;
+
+ try {
+ log.println("getCharacterBounds(-1)");
+ oObj.getCharacterBounds(-1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getCharacterBounds(chCount)");
+ oObj.getCharacterBounds(chCount);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if (chCount > 0) {
+ log.println("getCharacterBounds(chCount-1)");
+ chBounds = oObj.getCharacterBounds(chCount-1);
+ res &= chBounds != null;
+ log.println("rect: " + chBounds.X + ", " + chBounds.Y + ", " +
+ chBounds.Width + ", " + chBounds.Height);
+ }
+
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+
+ /**
+ * Calls the method and stores a returned value to the variable
+ * <code>chCount</code>.
+ * Has OK status if a returned value is equal to the text length.
+ */
+ public boolean _getCharacterCount() {
+ chCount = oObj.getCharacterCount();
+ log.println("Character count:" + chCount);
+ boolean res = chCount == text.length();
+ return res;
+ }
+
+ /**
+ * Calls the method for an invalid point and for the point of rectangle
+ * returned by the method <code>getCharacterBounds()</code>.
+ * Has OK status if returned value is equal to <code>-1</code> for an
+ * invalid point and if returned value is equal to <code>chCount-1</code>
+ * for a valid point.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterBounds()</code> </li>
+ * </ul>
+ */
+ public boolean _getIndexAtPoint() {
+
+ boolean res = true;
+ log.println("getIndexAtPoint(-1, -1):");
+ Point pt = new Point(-1, -1);
+ int index = oObj.getIndexAtPoint(pt);
+ log.println(Integer.toString(index));
+ res &= index == -1;
+
+ if (chBounds != null) {
+ pt = new Point(chBounds.X , chBounds.Y );
+ log.println("getIndexAtPoint(" + pt.X + ", " + pt.Y + "):");
+ index = oObj.getIndexAtPoint(pt);
+ log.println(Integer.toString(index));
+ res &= index == (chCount - 1);
+ }
+
+ return res;
+ }
+
+ /**
+ * Checks a returned values after different calls of the method
+ * <code>setSelection()</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setSelection()</code> </li>
+ * </ul>
+ */
+ public boolean _getSelectedText() {
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ log.println("setSelection(0, 0)");
+ oObj.setSelection(0, 0);
+ log.println("getSelectedText():");
+ String txt = oObj.getSelectedText();
+ log.println("'" + txt + "'");
+ res &= txt.length() == 0;
+
+ log.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ log.println("getSelectedText():");
+ txt = oObj.getSelectedText();
+ log.println("'" + txt + "'");
+ res &= txt.equals(text);
+
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ log.println("getSelectedText():");
+ txt = oObj.getSelectedText();
+ log.println("'" + txt + "'");
+ res &= txt.equals(text.substring(1, chCount - 1));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Checks a returned values after different calls of the method
+ * <code>setSelection()</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setSelection()</code> </li>
+ * </ul>
+ */
+ public boolean _getSelectionStart() {
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ log.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ int start = oObj.getSelectionStart();
+ log.println("getSelectionStart():" + start);
+ res &= start == 0;
+
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ start = oObj.getSelectionStart();
+ log.println("getSelectionStart():" + start);
+ res &= start == 1;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Checks a returned values after different calls of the method
+ * <code>setSelection()</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>setSelection()</code> </li>
+ * </ul>
+ */
+ public boolean _getSelectionEnd() {
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ log.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ int end = oObj.getSelectionEnd();
+ log.println("getSelectionEnd():" + end);
+ res &= end == chCount;
+
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ end = oObj.getSelectionEnd();
+ log.println("getSelectionEnd():" + end);
+ res &= end == chCount - 1;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _setSelection() {
+ boolean res = true;
+ boolean locRes = true;
+
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ try {
+ log.println("setSelection(-1, chCount-1):");
+ locRes = oObj.setSelection(-1, chCount - 1);
+ log.println(locRes + " exception was expected");
+ res &= !locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("setSelection(0, chCount+1):");
+ locRes = oObj.setSelection(0, chCount + 1);
+ log.println(locRes + " excepion was expected");
+ res &= !locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if (chCount > 2) {
+ log.println("setSelection(1, chCount-1):");
+ locRes = oObj.setSelection(1, chCount - 1);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+
+ log.println("setSelection(chCount-1, 1):");
+ locRes = oObj.setSelection(chCount - 1, 1);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+ }
+
+ if (chCount > 1) {
+ log.println("setSelection(0, chCount-1):");
+ locRes = oObj.setSelection(0, chCount-1);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+
+ log.println("setSelection(chCount-1, 0):");
+ locRes = oObj.setSelection(chCount-1, 0);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+ }
+
+ log.println("setSelection(0, 0):");
+ locRes = oObj.setSelection(0, 0);
+ log.println(Boolean.toString(locRes));
+ res &= locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned string is not null
+ * received from relation.
+ */
+ public boolean _getText() {
+ text = oObj.getText();
+ log.println("getText: '" + text + "'");
+ return (text != null);
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextRange() {
+ boolean res = true;
+ boolean locRes = true;
+
+ try {
+ if (chCount > 3) {
+ log.println("getTextRange(1, chCount - 2): ");
+ String txtRange = oObj.getTextRange(1, chCount - 2);
+ log.println(txtRange);
+ locRes = txtRange.equals(text.substring(1, chCount - 2));
+ res &= locRes;
+ if (!locRes) {
+ log.println("Was expected: " +
+ text.substring(1, chCount - 2));
+ }
+ }
+
+ if (chCount > 0) {
+ log.println("getTextRange(0, chCount-1): ");
+ String txtRange = oObj.getTextRange(0, chCount-1);
+ log.println(txtRange);
+ locRes = txtRange.equals(text.substring(0, chCount - 1));
+ res &= locRes;
+ if (!locRes) {
+ log.println("Was expected: " +
+ text.substring(0, chCount - 1));
+ }
+
+ log.println("getTextRange(chCount, 0): ");
+ txtRange = oObj.getTextRange(chCount, 0);
+ log.println(txtRange);
+ res &= txtRange.equals(text);
+
+ log.println("getTextRange(0, 0): ");
+ txtRange = oObj.getTextRange(0, 0);
+ log.println(txtRange);
+ locRes = txtRange.equals("");
+ res &= locRes;
+ if (!locRes) {
+ log.println("Empty string was expected");
+ }
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ try {
+ log.println("getTextRange(-1, chCount - 1): ");
+ String txtRange = oObj.getTextRange(-1, chCount - 1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getTextRange(0, chCount + 1): ");
+ String txtRange = oObj.getTextRange(0, chCount + 1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getTextRange(chCount+1, -1): ");
+ String txtRange = oObj.getTextRange(chCount+1, -1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextAtIndex() {
+ boolean res = true;
+
+ try {
+ log.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt =
+ oObj.getTextAtIndex(-1, AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("getTextAtIndex(chCount+1," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextAtIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ if ( chCount > 0 ) {
+ log.println("getTextAtIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextAtIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+
+ log.println("getTextAtIndex(1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextAtIndex(1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text);
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected exception");
+ res &= false;
+ }
+
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextBeforeIndex() {
+ boolean res = true;
+
+ try {
+ log.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBeforeIndex(-1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ log.println("getTextBeforeIndex(chCount+1, " +
+ "AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBeforeIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ TextSegment txt = null;
+ try {
+ if (chCount > 0) {
+ log.println("getTextBeforeIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBeforeIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == chCount ;
+
+ log.println("getTextBeforeIndex(1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBeforeIndex(1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+ }
+
+ if (chCount > 2) {
+ log.println("getTextBeforeIndex(chCount-1," +
+ " AccessibleTextType.CHARACTER):");
+ txt = oObj.getTextBeforeIndex(chCount - 1,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(chCount - 2, chCount - 1));
+ log.println("getTextBeforeIndex(2," +
+ " AccessibleTextType.CHARACTER):");
+ txt = oObj.getTextBeforeIndex(2,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(1, 2));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected exception");
+ res &= false;
+ }
+
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameters,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameters and if returned values
+ * are equal to corresponding substrings of the text received by relation.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>getCharacterCount()</code> </li>
+ * </ul>
+ */
+ public boolean _getTextBehindIndex() {
+ boolean res = true;
+
+ try {
+ log.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(-1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ log.println("getTextBehindIndex(chCount+1, " +
+ "AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ if ( chCount > 0 ) {
+ log.println("getTextBehindIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+
+ log.println("getTextBehindIndex(chCount-1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBehindIndex(chCount - 1,
+ AccessibleTextType.PARAGRAPH);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+ }
+ if ( chCount > 1 ) {
+ log.println("getTextBehindIndex(1," +
+ " AccessibleTextType.CHARACTER):");
+ TextSegment txt = oObj.getTextBehindIndex(1,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(2, 3));
+ }
+ if (chCount > 2) {
+ log.println("getTextBehindIndex(chCount-2," +
+ " AccessibleTextType.CHARACTER):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount - 2,
+ AccessibleTextType.CHARACTER);
+ log.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(chCount - 1, chCount));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected exception");
+ res &= false;
+ }
+
+
+ return res;
+ }
+
+ /**
+ * Calls the method with invalid parameters an with valid parameter,
+ * checks returned values.
+ * Has OK status if exception was thrown for invalid parameters,
+ * if exception wasn't thrown for valid parameter and if returned value for
+ * valid parameter is equal to <code>true</code>.
+ */
+ public boolean _copyText() {
+ boolean res = true;
+ boolean locRes = true;
+
+ if (editOnly != null) {
+ log.println(editOnly);
+ return true;
+ }
+
+ try {
+ log.println("copyText(-1,chCount):");
+ oObj.copyText(-1, chCount);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("copyText(0,chCount+1):");
+ oObj.copyText(0, chCount + 1);
+ log.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ log.println("copyText(0,chCount):");
+ locRes = oObj.copyText(0, chCount);
+ log.println(""+locRes);
+ res &= locRes;
+
+ String cbText = null;
+ try {
+ cbText =
+ util.SysUtils.getSysClipboardText(xMSF);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't access system clipboard :");
+ e.printStackTrace();
+ }
+ log.println("Clipboard: '" + cbText + "'");
+ res &= text.equals(cbText);
+
+ if (chCount > 2) {
+ log.println("copyText(1,chCount-1):");
+ locRes = oObj.copyText(1, chCount - 1);
+ log.println(""+locRes);
+ res &= locRes;
+
+ try {
+ cbText = util.SysUtils.getSysClipboardText(xMSF);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't access system clipboard :");
+ e.printStackTrace();
+ }
+
+ log.println("Clipboard: '" + cbText + "'");
+ res &= text.substring(1, chCount - 1).equals(cbText);
+ }
+
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java b/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java
new file mode 100644
index 000000000000..472412e80aa6
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.interface_tests;
+
+import com.sun.star.awt.XRequestCallback;
+import lib.MultiMethodTest;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import share.LogWriter;
+
+/**
+ * Testing <code>com.sun.star.awt.XRequestCallback</code>
+ * interface methods :
+ * <ul>
+ * <li><code> addCallback()</code></li>
+ * </ul> <p>
+ * @see com.sun.star.awt.XRequestCallback
+ */
+public class _XRequestCallback {
+
+ private LogWriter log;
+
+ private static final String className =
+ "com.sun.star.awt.XRequestCallback" ;
+
+ public XRequestCallback oObj = null;
+ private XMultiServiceFactory xMSF;
+
+ String text = null;
+
+
+ public _XRequestCallback(XInterface object, LogWriter log, XMultiServiceFactory xMSF ) {
+ oObj = (XRequestCallback)UnoRuntime.queryInterface(
+ XRequestCallback.class, object);
+ this.xMSF = xMSF;
+ this.log = log;
+ }
+
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value is equal to <code>chCount - 1</code>.
+ * The following method tests are to be executed before:
+ * <ul>
+ * <li> <code>addCallback()</code> </li>
+ * </ul>
+ */
+ public boolean _addCallback() {
+
+ boolean res = true;
+ try {
+ Object a = new Object();
+ oObj.addCallback( null, a );
+ } catch (com.sun.star.uno.RuntimeException ie) {
+ res = false;
+ }
+ log.println("addCallback called" );
+
+ return res;
+ }
+
+}
diff --git a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk
new file mode 100755
index 000000000000..0e324109f28d
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/interface_tests/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.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+TARGET = Toolkit
+PRJNAME = $(TARGET)
+PACKAGE = complex$/toolkit$/interface_tests
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = _XAccessibleComponent.java \
+ _XAccessibleContext.java \
+ _XAccessibleExtendedComponent.java \
+ _XAccessibleEventBroadcaster.java \
+ _XAccessibleText.java \
+ _XRequestCallback.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+
+# --- Targets ------------------------------------------------------
+
+.IF "$(depend)" == ""
+ALL : ALLTAR
+.ELSE
+ALL: ALLDEP
+.ENDIF
+
+.INCLUDE : target.mk
+
diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk
new file mode 100755
index 000000000000..3a4e096719bb
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/makefile.mk
@@ -0,0 +1,82 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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 = ..$/..$/..
+TARGET = Toolkit
+PRJNAME = $(TARGET)
+PACKAGE = complex$/toolkit
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = CheckAccessibleStatusBar.java CheckAccessibleStatusBarItem.java CheckAsyncCallback.java CallbackClass.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+SUBDIRS = interface_tests
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# start an office if the parameter is set for the makefile
+.IF "$(OFFICE)" == ""
+CT_APPEXECCOMMAND =
+.ELSE
+CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+.ENDIF
+
+# test base is java complex
+CT_TESTBASE = -tb java_complex
+
+# build up package name with "." instead of $/
+CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+run: \
+ CheckAccessibleStatusBarItem
+
+CheckAccessibleStatusBar:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBar
+
+CheckAccessibleStatusBarItem:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBarItem
+
diff --git a/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java b/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java
new file mode 100644
index 000000000000..654f5ec69da5
--- /dev/null
+++ b/toolkit/qa/complex/xunitconversion/XUnitConversionTest.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 complex.xunitconversion;
+
+import com.sun.star.awt.XUnitConversion;
+import com.sun.star.uno.UnoRuntime;
+import complexlib.ComplexTestCase;
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.XWindowPeer;
+
+import util.DesktopTools;
+
+/**
+ * This complex test is only for testing the com.sun.star.awt.XUnitConversion methods
+ * These are converter methods to get the size of a well known awt component
+ * in a com.sun.star.util.MeasureUnit you want.
+ * You don't need to know the factors to calculate by hand.
+ *
+ * @author ll93751
+ */
+public class XUnitConversionTest extends ComplexTestCase
+{
+ public String[] getTestMethodNames()
+ {
+ return new String[]{"testXUnitConversion"}; // function name of the test method
+ }
+
+ /**
+ * returns the delta value between a and b
+ * @param a
+ * @param b
+ * @return
+ */
+ private int delta(int a, int b)
+ {
+ final int n = Math.abs(a - b);
+ return n;
+ }
+
+ private XUnitConversion m_xConversion = null;
+
+ /**
+ * Not really a check,
+ * only a simple test call to convertSizeToLogic(...) with different parameters
+ * @param _aSize
+ * @param _aMeasureUnit
+ * @param _sEinheit
+ */
+ private void checkSize(com.sun.star.awt.Size _aSize, short _aMeasureUnit, String _sEinheit)
+ {
+ try
+ {
+ com.sun.star.awt.Size aSizeIn = m_xConversion.convertSizeToLogic(_aSize, _aMeasureUnit);
+ log.println("Window size:");
+ log.println("Width:" + aSizeIn.Width + " " + _sEinheit);
+ log.println("Height:" + aSizeIn.Height + " " + _sEinheit);
+ log.println("");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ log.println("Caught IllegalArgumentException in convertSizeToLogic with '" + _sEinheit + "' " + e.getMessage());
+ }
+ }
+
+/**
+ * The real test function
+ * 1. try to get the XMultiServiceFactory of an already running office. Therefore make sure an (open|star)office is running with
+ * parameters like -accept="socket,host=localhost,port=8100;urp;"
+ * 2. try to create an empty window
+ * 3. try to convert the WindowPeer to an XWindow
+ * 4. try to resize and move the window to an other position, so we get a well knowing position and size.
+ * 5. run some more tests
+ *
+ * If no test fails, the test is well done and returns with 'PASSED, OK'
+ *
+ */ public void testXUnitConversion()
+ {
+ XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF();
+ assure("failed: There is no office.", xMSF != null);
+
+ // create a window
+ XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF);
+ assure("failed: there is no window peer", xWindowPeer != null);
+
+
+ // resize and move the window to a well known position and size
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer);
+ assure("failed: there is no window, cast wrong?", xWindow != null);
+
+ xWindow.setVisible(Boolean.TRUE);
+
+ int x = 100;
+ int y = 100;
+ int width = 640;
+ int height = 480;
+ xWindow.setPosSize(x, y, width, height, com.sun.star.awt.PosSize.POSSIZE);
+
+ com.sun.star.awt.Rectangle aRect = xWindow.getPosSize();
+ com.sun.star.awt.Point aPoint = new com.sun.star.awt.Point(aRect.X, aRect.Y);
+ com.sun.star.awt.Size aSize = new com.sun.star.awt.Size(aRect.Width, aRect.Height);
+
+ log.println("Window position and size in pixel:");
+ log.println("X:" + aPoint.X);
+ log.println("Y:" + aPoint.Y);
+ log.println("Width:" + aSize.Width);
+ log.println("Height:" + aSize.Height);
+ log.println("");
+
+ assure("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y);
+
+ // XToolkit aToolkit = xWindowPeer.getToolkit();
+ m_xConversion = (XUnitConversion) UnoRuntime.queryInterface(XUnitConversion.class, xWindowPeer);
+
+ // try to get the position of the window in 1/100mm with the XUnitConversion method
+ try
+ {
+ com.sun.star.awt.Point aPointInMM_100TH = m_xConversion.convertPointToLogic(aPoint, com.sun.star.util.MeasureUnit.MM_100TH);
+ log.println("Window position:");
+ log.println("X:" + aPointInMM_100TH.X + " 1/100mm");
+ log.println("Y:" + aPointInMM_100TH.Y + " 1/100mm");
+ log.println("");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ assure("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage(), Boolean.FALSE);
+ }
+
+ // try to get the size of the window in 1/100mm with the XUnitConversion method
+ com.sun.star.awt.Size aSizeInMM_100TH = null;
+ com.sun.star.awt.Size aSizeInMM_10TH = null;
+ try
+ {
+ aSizeInMM_100TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_100TH);
+ log.println("Window size:");
+ log.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm");
+ log.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm");
+ log.println("");
+
+ // try to get the size of the window in 1/10mm with the XUnitConversion method
+
+ aSizeInMM_10TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_10TH);
+ log.println("Window size:");
+ log.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm");
+ log.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm");
+ log.println("");
+
+ // check the size with a delta which must be smaller a given difference
+ assure("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10);
+ assure("Size.Height not correct", delta(aSizeInMM_100TH.Height, aSizeInMM_10TH.Height * 10) < 10);
+
+ // new
+ checkSize(aSize, com.sun.star.util.MeasureUnit.PIXEL, "pixel");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.APPFONT, "appfont");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.SYSFONT, "sysfont");
+
+ // simply check some more parameters
+ checkSize(aSize, com.sun.star.util.MeasureUnit.MM, "mm");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.CM, "cm");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_1000TH, "1/1000inch");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_100TH, "1/100inch");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_10TH, "1/10inch");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.INCH, "inch");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.M, "m");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.POINT, "point");
+ checkSize(aSize, com.sun.star.util.MeasureUnit.TWIP, "twip");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.KM, "km");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.PICA, "pica");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.FOOT, "foot");
+ // checkSize(aSize, com.sun.star.util.MeasureUnit.MILE, "mile");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ assure("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage(), Boolean.FALSE);
+ }
+
+ // convert the 1/100mm window size back to pixel
+ try
+ {
+ com.sun.star.awt.Size aNewSize = m_xConversion.convertSizeToPixel(aSizeInMM_100TH, com.sun.star.util.MeasureUnit.MM_100TH);
+ log.println("Window size:");
+ log.println("Width:" + aNewSize.Width + " pixel");
+ log.println("Height:" + aNewSize.Height + " pixel");
+
+ // assure the pixels are the same as we already know
+ assure("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ assure("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage(), Boolean.FALSE);
+ }
+
+ // close the window.
+ // IMHO a little bit stupid, but the XWindow doesn't support a XCloseable interface
+ xWindow.dispose();
+ }
+}
diff --git a/toolkit/qa/complex/xunitconversion/makefile.mk b/toolkit/qa/complex/xunitconversion/makefile.mk
new file mode 100644
index 000000000000..18b59ee19f18
--- /dev/null
+++ b/toolkit/qa/complex/xunitconversion/makefile.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..
+TARGET = XUnitConversionTest
+PRJNAME = $(TARGET)
+PACKAGE = complex$/xunitconversion
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
+JAVAFILES = XUnitConversionTest.java
+JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
+SUBDIRS =
+
+#----- make a jar from compiled files ------------------------------
+
+MAXLINELENGTH = 100000
+
+JARCLASSDIRS = $(PACKAGE)
+JARTARGET = $(TARGET).jar
+JARCOMPRESS = TRUE
+
+# --- Parameters for the test --------------------------------------
+
+# start an office if the parameter is set for the makefile
+.IF "$(OFFICE)" == ""
+CT_APPEXECCOMMAND =
+.ELSE
+CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
+.ENDIF
+
+# test base is java complex
+CT_TESTBASE = -tb java_complex
+
+# build up package name with "." instead of $/
+CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
+
+# start the runner application
+CT_APP = org.openoffice.Runner
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+run: $(JAVAFILES) XUnitConversionTest
+
+XUnitConversionTest:
+ +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).XUnitConversionTest
diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl
new file mode 100644
index 000000000000..ef954f00eeeb
--- /dev/null
+++ b/toolkit/qa/unoapi/knownissues.xcl
@@ -0,0 +1,242 @@
+### i86545 ###
+toolkit.AccessibleToolBoxItem::com::sun::star::accessibility::XAccessibleText
+
+### i30818 ###
+toolkit.AccessibleToolBox::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i68852 ###
+toolkit.TabControllerModel::com::sun::star::io::XPersistObject
+
+### i79111 ###
+toolkit.UnoControlButtonModel::com::sun::star::awt::UnoControlButtonModel
+
+### i79110 ###
+toolkit.UnoControlCheckBoxModel::com::sun::star::awt::UnoControlCheckBoxModel
+
+### i84314 ###
+toolkit.UnoControlImageControlModel::com::sun::star::awt::UnoControlImageControlModel
+
+### i86542 ###
+toolkit.UnoControlProgressBarModel::com::sun::star::awt::UnoControlProgressBarModel
+
+### i86543 ###
+toolkit.UnoControlRadioButtonModel::com::sun::star::awt::UnoControlRadioButtonModel
+
+### i79098 ###
+toolkit.UnoControlScrollBarModel::com::sun::star::awt::UnoControlScrollBarModel
+
+### i86544 ###
+toolkit.UnoTreeModel::com::sun::star::awt::tree::TreeControlModel
+
+### i74011 ###
+toolkit.UnoControlDateField::com::sun::star::awt::XWindow
+toolkit.UnoSpinButtonControl::com::sun::star::awt::XWindow
+toolkit.UnoControlPatternField::com::sun::star::awt::XWindow
+toolkit.UnoControlRadioButton::com::sun::star::awt::XWindow
+toolkit.UnoControlButton::com::sun::star::awt::XWindow
+toolkit.UnoControlTimeField::com::sun::star::awt::XWindow
+toolkit.UnoControlFormattedField::com::sun::star::awt::XWindow
+toolkit.UnoControlContainer::com::sun::star::awt::XWindow
+toolkit.UnoControlGroupBox::com::sun::star::awt::XWindow
+toolkit.UnoControlFixedText::com::sun::star::awt::XWindow
+toolkit.UnoControlListBox::com::sun::star::awt::XWindow
+toolkit.UnoControlImageControl::com::sun::star::awt::XWindow
+toolkit.UnoControlDialog::com::sun::star::awt::XWindow
+toolkit.UnoControlEdit::com::sun::star::awt::XWindow
+toolkit.UnoControlCurrencyField::com::sun::star::awt::XWindow
+toolkit.UnoControlFileControl::com::sun::star::awt::XWindow
+toolkit.UnoControlComboBox::com::sun::star::awt::XWindow
+toolkit.UnoControlNumericField::com::sun::star::awt::XWindow
+toolkit.UnoControlCheckBox::com::sun::star::awt::XWindow
+toolkit.UnoScrollBarControl::com::sun::star::awt::XWindow
+
+### i86296 ###
+toolkit.UnoControlContainerModel::com::sun::star::awt::UnoControlContainerModel
+
+### i86297 ###
+toolkit.UnoControlFixedTextModel::com::sun::star::awt::UnoControlFixedTextModel
+
+### i86299 ###
+toolkit.UnoTreeModel::com::sun::star::awt::UnoControlModel
+
+### i86300 ###
+toolkit.UnoTreeModel::com::sun::star::beans::XMultiPropertySet
+
+### i86007 ###
+toolkit.AccessibleButton
+# -> disabled in toolkit.sce
+
+### i86008 ###
+toolkit.AccessibleComboBox
+# -> disabled in toolkit.sce
+
+### i86110 ###
+toolkit.AccessibleEdit
+toolkit.AccessibleList
+toolkit.AccessibleListBox
+toolkit.AccessibleListItem
+toolkit.AccessibleRadioButton
+# -> disabled in toolkit.sce
+
+### i86009 ###
+toolkit.AccessibleMenuItem
+# -> disabled in toolkit.sce
+
+### i86107 ###
+toolkit.AccessibleRadioButton
+# -> disabled in toolkit.sce
+
+### i86287 ###
+toolkit.AccessibleToolBox
+# -> disabled in toolkit.sce
+
+### i80788 ###
+toolkit.Toolkit
+toolkit.UnoControlDialog
+# -> disabled in toolkit.sce
+
+### i86011 ###
+toolkit.UnoControlFileControl
+# -> disabled in toolkit.sce
+
+### i86013 ###
+toolkit.UnoControlFormattedField
+# -> disabled in toolkit.sce
+
+### i86019 ###
+toolkit.UnoControlListBox
+# -> disabled in toolkit.sce
+
+### i86020 ###
+toolkit.UnoSimpleAnimationControl
+# -> disabled in toolkit.sce
+
+### i86021 ###
+toolkit.UnoSimpleAnimationControlModel
+# -> disabled in toolkit.sce
+
+### i86022 ###
+toolkit.UnoThrobberControl
+# -> disabled in toolkit.sce
+
+### i86023 ###
+toolkit.UnoThrobberControlModel
+# -> disabled in toolkit.sce
+
+### i86298 ###
+toolkit.UnoTreeControl
+# -> disabled in toolkit.sce
+
+### i52607 ###
+toolkit.AccessiblePopupMenu
+# -> disabled in toolkit.sce
+
+### i86660 ###
+toolkit.UnoControlDateField::com::sun::star::awt::XView
+toolkit.UnoSpinButtonControl::com::sun::star::awt::XView
+toolkit.UnoControlPatternField::com::sun::star::awt::XView
+toolkit.UnoControlRadioButton::com::sun::star::awt::XView
+toolkit.UnoControlButton::com::sun::star::awt::XView
+toolkit.UnoControlTimeField::com::sun::star::awt::XView
+toolkit.UnoControlFormattedField::com::sun::star::awt::XView
+toolkit.UnoControlGroupBox::com::sun::star::awt::XView
+toolkit.UnoControlContainer::com::sun::star::awt::XView
+toolkit.UnoControlFixedText::com::sun::star::awt::XView
+toolkit.UnoControlListBox::com::sun::star::awt::XView
+toolkit.UnoControlEdit::com::sun::star::awt::XView
+toolkit.UnoControlImageControl::com::sun::star::awt::XView
+toolkit.UnoControlDialog::com::sun::star::awt::XView
+toolkit.UnoThrobberControl::com::sun::star::awt::XView
+toolkit.UnoControlFileControl::com::sun::star::awt::XView
+toolkit.UnoControlCurrencyField::com::sun::star::awt::XView
+toolkit.UnoSimpleAnimationControl::com::sun::star::awt::XView
+toolkit.UnoControlComboBox::com::sun::star::awt::XView
+toolkit.UnoControlNumericField::com::sun::star::awt::XView
+toolkit.UnoControlCheckBox::com::sun::star::awt::XView
+toolkit.UnoScrollBarControl::com::sun::star::awt::XView
+
+
+### i87757 ###
+toolkit.AccessibleFixedText::com::sun::star::accessibility::XAccessibleText
+
+### i37643 ###
+toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i87864 ###
+toolkit.UnoControlContainerModel::com::sun::star::lang::XComponent
+toolkit.UnoTreeModel::com::sun::star::lang::XComponent
+toolkit.UnoControlTimeFieldModel::com::sun::star::lang::XComponent
+toolkit.UnoControlDateField::com::sun::star::lang::XComponent
+toolkit.UnoControlButtonModel::com::sun::star::lang::XComponent
+toolkit.UnoControlPatternFieldModel::com::sun::star::lang::XComponent
+toolkit.UnoSpinButtonControl::com::sun::star::lang::XComponent
+toolkit.UnoControlDateFieldModel::com::sun::star::lang::XComponent
+toolkit.UnoControlPatternField::com::sun::star::lang::XComponent
+toolkit.UnoControlRadioButtonModel::com::sun::star::lang::XComponent
+toolkit.UnoControlFormattedFieldModel::com::sun::star::lang::XComponent
+toolkit.UnoControlRadioButton::com::sun::star::lang::XComponent
+toolkit.UnoControlButton::com::sun::star::lang::XComponent
+toolkit.UnoControlTimeField::com::sun::star::lang::XComponent
+toolkit.UnoControlFormattedField::com::sun::star::lang::XComponent
+toolkit.UnoControlFixedLineModel::com::sun::star::lang::XComponent
+toolkit.UnoControlDialogModel::com::sun::star::lang::XComponent
+toolkit.UnoControlFileControlModel::com::sun::star::lang::XComponent
+toolkit.UnoControlGroupBox::com::sun::star::lang::XComponent
+toolkit.UnoControlContainer::com::sun::star::lang::XComponent
+toolkit.MutableTreeDataModel::com::sun::star::lang::XComponent
+toolkit.UnoControlFixedText::com::sun::star::lang::XComponent
+toolkit.UnoControlListBox::com::sun::star::lang::XComponent
+toolkit.UnoControlCheckBoxModel::com::sun::star::lang::XComponent
+toolkit.UnoThrobberControlModel::com::sun::star::lang::XComponent
+toolkit.UnoControlEditModel::com::sun::star::lang::XComponent
+toolkit.UnoControlEdit::com::sun::star::lang::XComponent
+toolkit.UnoControlImageControl::com::sun::star::lang::XComponent
+toolkit.UnoControlDialog::com::sun::star::lang::XComponent
+toolkit.UnoControlGroupBoxModel::com::sun::star::lang::XComponent
+toolkit.UnoControlImageControlModel::com::sun::star::lang::XComponent
+toolkit.UnoControlNumericFieldModel::com::sun::star::lang::XComponent
+toolkit.UnoSimpleAnimationControlModel::com::sun::star::lang::XComponent
+toolkit.UnoThrobberControl::com::sun::star::lang::XComponent
+toolkit.UnoControlFileControl::com::sun::star::lang::XComponent
+toolkit.UnoControlCurrencyField::com::sun::star::lang::XComponent
+toolkit.UnoControlComboBoxModel::com::sun::star::lang::XComponent
+toolkit.UnoSimpleAnimationControl::com::sun::star::lang::XComponent
+toolkit.UnoControlComboBox::com::sun::star::lang::XComponent
+toolkit.UnoControlNumericField::com::sun::star::lang::XComponent
+toolkit.UnoControlScrollBarModel::com::sun::star::lang::XComponent
+toolkit.UnoControlProgressBarModel::com::sun::star::lang::XComponent
+toolkit.UnoControlListBoxModel::com::sun::star::lang::XComponent
+toolkit.UnoControlFixedTextModel::com::sun::star::lang::XComponent
+toolkit.UnoSpinButtonControlModel::com::sun::star::lang::XComponent
+toolkit.UnoControlCurrencyFieldModel::com::sun::star::lang::XComponent
+toolkit.UnoControlCheckBox::com::sun::star::lang::XComponent
+toolkit.UnoScrollBarControl::com::sun::star::lang::XComponent
+
+### i89415 ###
+toolkit.UnoControlContainer::com::sun::star::awt::XControl
+
+### i89417 ###
+toolkit.UnoControlContainer::com::sun::star::accessibility::XAccessible
+
+### i89418 ###
+toolkit.UnoSpinButtonControl::com::sun::star::awt::XSpinValue
+
+### i88332 ###
+toolkit.AccessibleCheckBox
+# -> disabled in toolkit.sce
+
+### i88605 ###
+toolkit.AccessibleToolBoxItem
+# -> disabled in toolkit.sce
+
+### i89019 ###
+toolkit.AccessibleWindow::com::sun::star::accessibility::XAccessibleEventBroadcaster
+
+### i90354 ###
+toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleComponent
+
+### i90356 ###
+toolkit.UnoScrollBarControl::com::sun::star::awt::XScrollBar
+
+### i94344 ###
+toolkit.AccessibleTabPage::com::sun::star::accessibility::XAccessibleText \ No newline at end of file
diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk
new file mode 100644
index 000000000000..a24f81d7c6ef
--- /dev/null
+++ b/toolkit/qa/unoapi/makefile.mk
@@ -0,0 +1,43 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=qa_unoapi
+
+.INCLUDE: settings.mk
+
+.INCLUDE: target.mk
+
+ALLTAR : UNOAPI_TEST
+
+UNOAPI_TEST:
+ +$(SOLARENV)$/bin$/checkapi -sce toolkit.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments
+ @echo =======================================================================
+ @echo In case you noticed a failures of toolkit.AccessibleToolBoxItem make sure that the object bar is configured as text and not as icons
+ @echo =======================================================================
diff --git a/toolkit/qa/unoapi/testdocuments/poliball.gif b/toolkit/qa/unoapi/testdocuments/poliball.gif
new file mode 100644
index 000000000000..dda461bd347e
--- /dev/null
+++ b/toolkit/qa/unoapi/testdocuments/poliball.gif
Binary files differ
diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce
new file mode 100644
index 000000000000..dad24165e2d2
--- /dev/null
+++ b/toolkit/qa/unoapi/toolkit.sce
@@ -0,0 +1,77 @@
+#i86007 -o toolkit.AccessibleButton
+#i88332 -o toolkit.AccessibleCheckBox
+#i86008 -o toolkit.AccessibleComboBox
+-o toolkit.AccessibleDropDownComboBox
+-o toolkit.AccessibleDropDownListBox
+#i86110 -o toolkit.AccessibleEdit
+-o toolkit.AccessibleFixedText
+#i86110 -o toolkit.AccessibleList
+#i86110 -o toolkit.AccessibleListBox
+#i86110 -o toolkit.AccessibleListItem
+-o toolkit.AccessibleMenu
+-o toolkit.AccessibleMenuBar
+#i86009 -o toolkit.AccessibleMenuItem
+-o toolkit.AccessibleMenuSeparator
+#i52607 -o toolkit.AccessiblePopupMenu
+#i86107,i86110 -o toolkit.AccessibleRadioButton
+-o toolkit.AccessibleScrollBar
+-o toolkit.AccessibleStatusBar
+-o toolkit.AccessibleStatusBarItem
+-o toolkit.AccessibleTabControl
+-o toolkit.AccessibleTabPage
+#i86287 -o toolkit.AccessibleToolBox
+#i88605 -o toolkit.AccessibleToolBoxItem
+-o toolkit.AccessibleWindow
+-o toolkit.MutableTreeDataModel
+-o toolkit.MutableTreeNode
+-o toolkit.TabController
+-o toolkit.TabControllerModel
+#i80788 -o toolkit.Toolkit
+-o toolkit.UnoControlButton
+-o toolkit.UnoControlButtonModel
+-o toolkit.UnoControlCheckBox
+-o toolkit.UnoControlCheckBoxModel
+-o toolkit.UnoControlComboBox
+-o toolkit.UnoControlComboBoxModel
+-o toolkit.UnoControlContainer
+-o toolkit.UnoControlContainerModel
+-o toolkit.UnoControlCurrencyField
+-o toolkit.UnoControlCurrencyFieldModel
+-o toolkit.UnoControlDateField
+-o toolkit.UnoControlDateFieldModel
+#i80788 -o toolkit.UnoControlDialog
+-o toolkit.UnoControlDialogModel
+-o toolkit.UnoControlEdit
+-o toolkit.UnoControlEditModel
+#i86011 -o toolkit.UnoControlFileControl
+-o toolkit.UnoControlFileControlModel
+-o toolkit.UnoControlFixedLineModel
+-o toolkit.UnoControlFixedText
+-o toolkit.UnoControlFixedTextModel
+#i86013 -o toolkit.UnoControlFormattedField
+-o toolkit.UnoControlFormattedFieldModel
+-o toolkit.UnoControlGroupBox
+-o toolkit.UnoControlGroupBoxModel
+-o toolkit.UnoControlImageControl
+-o toolkit.UnoControlImageControlModel
+#i86019 -o toolkit.UnoControlListBox
+-o toolkit.UnoControlListBoxModel
+-o toolkit.UnoControlNumericField
+-o toolkit.UnoControlNumericFieldModel
+-o toolkit.UnoControlPatternField
+-o toolkit.UnoControlPatternFieldModel
+-o toolkit.UnoControlProgressBarModel
+-o toolkit.UnoControlRadioButton
+-o toolkit.UnoControlRadioButtonModel
+-o toolkit.UnoControlScrollBarModel
+-o toolkit.UnoControlTimeField
+-o toolkit.UnoControlTimeFieldModel
+-o toolkit.UnoScrollBarControl
+#i86020 -o toolkit.UnoSimpleAnimationControl
+#i86021 -o toolkit.UnoSimpleAnimationControlModel
+-o toolkit.UnoSpinButtonControl
+-o toolkit.UnoSpinButtonControlModel
+#i86022 -o toolkit.UnoThrobberControl
+#i86023 -o toolkit.UnoThrobberControlModel
+#i86298 -o toolkit.UnoTreeControl
+-o toolkit.UnoTreeModel
diff --git a/toolkit/source/awt/asynccallback.cxx b/toolkit/source/awt/asynccallback.cxx
new file mode 100644
index 000000000000..593feb582274
--- /dev/null
+++ b/toolkit/source/awt/asynccallback.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include "vcl/svapp.hxx"
+#include "vos/mutex.hxx"
+#include "sal/config.h"
+#include "cppuhelper/factory.hxx"
+#include "cppuhelper/implementationentry.hxx"
+#include "cppuhelper/implbase2.hxx"
+#include "com/sun/star/lang/XServiceInfo.hpp"
+#include "com/sun/star/awt/XRequestCallback.hpp"
+
+
+// component helper namespace
+namespace comp_AsyncCallback {
+
+namespace css = ::com::sun::star;
+
+// component and service helper functions:
+::rtl::OUString SAL_CALL _getImplementationName();
+css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
+css::uno::Reference< css::uno::XInterface > SAL_CALL _create( css::uno::Reference< css::uno::XComponentContext > const & context );
+
+} // closing component helper namespace
+
+
+
+/// anonymous implementation namespace
+namespace {
+
+namespace css = ::com::sun::star;
+
+class AsyncCallback:
+ public ::cppu::WeakImplHelper2<
+ css::lang::XServiceInfo,
+ css::awt::XRequestCallback>
+{
+public:
+ explicit AsyncCallback(css::uno::Reference< css::uno::XComponentContext > const & context);
+
+ // ::com::sun::star::lang::XServiceInfo:
+ virtual ::rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException);
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XRequestCallback:
+ virtual void SAL_CALL addCallback(const css::uno::Reference< css::awt::XCallback > & xCallback, const ::com::sun::star::uno::Any & aData) throw (css::uno::RuntimeException);
+
+private:
+
+ struct CallbackData
+ {
+ CallbackData( const css::uno::Reference< css::awt::XCallback >& rCallback, const css::uno::Any& rAny ) :
+ xCallback( rCallback ), aData( rAny ) {}
+
+ css::uno::Reference< css::awt::XCallback > xCallback;
+ css::uno::Any aData;
+ };
+
+ DECL_STATIC_LINK( AsyncCallback, Notify_Impl, CallbackData* );
+
+ AsyncCallback(AsyncCallback &); // not defined
+ void operator =(AsyncCallback &); // not defined
+
+ virtual ~AsyncCallback() {}
+
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+};
+
+AsyncCallback::AsyncCallback(css::uno::Reference< css::uno::XComponentContext > const & context) :
+ m_xContext(context)
+{}
+
+// com.sun.star.uno.XServiceInfo:
+::rtl::OUString SAL_CALL AsyncCallback::getImplementationName() throw (css::uno::RuntimeException)
+{
+ return comp_AsyncCallback::_getImplementationName();
+}
+
+::sal_Bool SAL_CALL AsyncCallback::supportsService(::rtl::OUString const & serviceName) throw (css::uno::RuntimeException)
+{
+ const css::uno::Sequence< ::rtl::OUString > serviceNames = comp_AsyncCallback::_getSupportedServiceNames();
+ for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
+ if (serviceNames[i] == serviceName)
+ return sal_True;
+ }
+ return sal_False;
+}
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL AsyncCallback::getSupportedServiceNames() throw (css::uno::RuntimeException)
+{
+ return comp_AsyncCallback::_getSupportedServiceNames();
+}
+
+// ::com::sun::star::awt::XRequestCallback:
+void SAL_CALL AsyncCallback::addCallback(const css::uno::Reference< css::awt::XCallback > & xCallback, const ::com::sun::star::uno::Any & aData) throw (css::uno::RuntimeException)
+{
+ if ( Application::IsInMain() )
+ {
+ osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
+ CallbackData* pCallbackData = new CallbackData( xCallback, aData );
+ Application::PostUserEvent( STATIC_LINK( this, AsyncCallback, Notify_Impl ), pCallbackData );
+ }
+}
+
+// private asynchronous link to call reference to the callback object
+IMPL_STATIC_LINK_NOINSTANCE( AsyncCallback, Notify_Impl, CallbackData*, pCallbackData )
+{
+ try
+ {
+ // Asynchronous execution
+ // Check pointer and reference before!
+ if ( pCallbackData && pCallbackData->xCallback.is() )
+ pCallbackData->xCallback->notify( pCallbackData->aData );
+ }
+ catch ( css::uno::Exception& )
+ {
+ }
+
+ delete pCallbackData;
+ return 0;
+}
+
+} // closing anonymous implementation namespace
+
+
+
+// component helper namespace
+namespace comp_AsyncCallback {
+
+::rtl::OUString SAL_CALL _getImplementationName() {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.awt.comp.AsyncCallback"));
+}
+
+css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
+{
+ css::uno::Sequence< ::rtl::OUString > s(1);
+ s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.awt.AsyncCallback"));
+ return s;
+}
+
+css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
+ const css::uno::Reference< css::uno::XComponentContext > & context)
+ SAL_THROW((css::uno::Exception))
+{
+ return static_cast< ::cppu::OWeakObject * >(new AsyncCallback(context));
+}
+
+} // closing component helper namespace
+
+static ::cppu::ImplementationEntry const entries[] = {
+ { &comp_AsyncCallback::_create,
+ &comp_AsyncCallback::_getImplementationName,
+ &comp_AsyncCallback::_getSupportedServiceNames,
+ &::cppu::createSingleComponentFactory, 0, 0 },
+ { 0, 0, 0, 0, 0, 0 }
+};
+
+void * SAL_CALL comp_AsyncCallback_component_getFactory(
+ const char * implName, void * serviceManager, void * registryKey)
+{
+ return ::cppu::component_getFactoryHelper(
+ implName, serviceManager, registryKey, entries);
+}
+
+sal_Bool SAL_CALL comp_AsyncCallback_component_writeInfo(
+ void * serviceManager, void * registryKey)
+{
+ return ::cppu::component_writeInfoHelper(serviceManager, registryKey, entries);
+}
diff --git a/toolkit/source/awt/forward.hxx b/toolkit/source/awt/forward.hxx
new file mode 100644
index 000000000000..0228be562b2c
--- /dev/null
+++ b/toolkit/source/awt/forward.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 AWT_FORWARD_HXX
+#define AWT_FORWARD_HXX
+
+#include <comphelper/uno3.hxx>
+
+#define IMPLEMENT_FORWARD_XTYPEPROVIDER1( classname, baseclass ) \
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes( ) throw (::com::sun::star::uno::RuntimeException) \
+ { return baseclass::getTypes(); } \
+ IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
+
+#define IMPLEMENT_2_FORWARD_XINTERFACE1( classname, refcountbase1, refcountbase2 ) \
+ void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \
+ void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \
+ ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ { \
+ aReturn = refcountbase2::queryInterface( _rType ); \
+ } \
+ return aReturn; \
+ }
+
+#define IMPLEMENT_2_FORWARD_XINTERFACE2( classname, refcountbase1, refcountbase2, baseclass3 ) \
+ void SAL_CALL classname::acquire() throw() { refcountbase1::acquire(); refcountbase2::acquire(); } \
+ void SAL_CALL classname::release() throw() { refcountbase1::release(); refcountbase2::release(); } \
+ ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aReturn = refcountbase1::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ { \
+ aReturn = refcountbase2::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ aReturn = baseclass3::queryInterface( _rType ); \
+ } \
+ return aReturn; \
+ }
+
+#if defined (_MSC_VER) && (_MSC_VER <= 1310)
+// Windows .Net2003 build fix
+#define W3K_EXPLICIT_CAST(x) static_cast <XWindow2*> (&x)
+#else // !(defined (_MSC_VER) && (_MSC_VER <= 1310))
+#define W3K_EXPLICIT_CAST(x) x
+#endif // !(defined (_MSC_VER) && (_MSC_VER <= 1310))
+
+#endif /* AWT_FORWARD_HXX */
diff --git a/toolkit/source/awt/makefile.mk b/toolkit/source/awt/makefile.mk
new file mode 100644
index 000000000000..a53e9e22ba2d
--- /dev/null
+++ b/toolkit/source/awt/makefile.mk
@@ -0,0 +1,83 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=awt
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+.IF "$(GUIBASE)"=="aqua"
+CFLAGSCXX+=$(OBJCXXFLAGS)
+.ENDIF # "$(GUIBASE)"=="aqua"
+
+SLOFILES= \
+ $(SLO)$/vclxaccessiblecomponent.obj \
+ $(SLO)$/vclxbitmap.obj \
+ $(SLO)$/vclxcontainer.obj \
+ $(SLO)$/vclxdevice.obj \
+ $(SLO)$/vclxfont.obj \
+ $(SLO)$/vclxgraphics.obj \
+ $(SLO)$/vclxmenu.obj \
+ $(SLO)$/vclxpointer.obj \
+ $(SLO)$/vclxprinter.obj \
+ $(SLO)$/vclxregion.obj \
+ $(SLO)$/vclxsystemdependentwindow.obj \
+ $(SLO)$/vclxtoolkit.obj \
+ $(SLO)$/vclxtopwindow.obj \
+ $(SLO)$/vclxwindow.obj \
+ $(SLO)$/vclxwindow1.obj \
+ $(SLO)$/vclxwindows.obj \
+ $(SLO)$/vclxspinbutton.obj \
+ $(SLO)$/xsimpleanimation.obj \
+ $(SLO)$/xthrobber.obj \
+ $(SLO)$/asynccallback.obj\
+ $(SLO)/vclxbutton.obj\
+ $(SLO)/vclxdialog.obj\
+ $(SLO)/vclxfixedline.obj\
+ $(SLO)/vclxplugin.obj\
+ $(SLO)/vclxscroller.obj\
+ $(SLO)/vclxsplitter.obj\
+ $(SLO)/vclxtabcontrol.obj\
+ $(SLO)/vclxtabpage.obj
+
+SRS1NAME=$(TARGET)
+SRC1FILES=\
+ xthrobber.src
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/toolkit/source/awt/non-interactable-containers.xml b/toolkit/source/awt/non-interactable-containers.xml
new file mode 100644
index 000000000000..0ffdb7e9d58d
--- /dev/null
+++ b/toolkit/source/awt/non-interactable-containers.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ border="true" sizeable="true" moveable="true">
+ <hbox>
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ </hbox>
+</dialog>
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
new file mode 100644
index 000000000000..175289d1ac84
--- /dev/null
+++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -0,0 +1,924 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#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/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <toolkit/helper/externallock.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/awt/vclxfont.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/window.hxx>
+#include <tools/debug.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/menu.hxx>
+
+#ifndef VCLEVENT_WINDOW_FRAMETITLECHANGED
+#define VCLEVENT_WINDOW_FRAMETITLECHANGED 1018 // pData = XubString* = oldTitle
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::comphelper;
+
+
+DBG_NAME(VCLXAccessibleComponent)
+
+
+// ----------------------------------------------------
+// class VCLXAccessibleComponent
+// ----------------------------------------------------
+VCLXAccessibleComponent::VCLXAccessibleComponent( VCLXWindow* pVCLXindow )
+ : AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
+ , OAccessibleImplementationAccess( )
+{
+ DBG_CTOR( VCLXAccessibleComponent, 0 );
+ mpVCLXindow = pVCLXindow;
+ mxWindow = pVCLXindow;
+
+ m_pSolarLock = static_cast< VCLExternalSolarLock* >( getExternalLock( ) );
+
+ DBG_ASSERT( pVCLXindow->GetWindow(), "VCLXAccessibleComponent - no window!" );
+ if ( pVCLXindow->GetWindow() )
+ {
+ pVCLXindow->GetWindow()->AddEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
+ pVCLXindow->GetWindow()->AddChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
+ }
+
+ // announce the XAccessible of our creator to the base class
+ lateInit( pVCLXindow );
+}
+
+VCLXAccessibleComponent::~VCLXAccessibleComponent()
+{
+ DBG_DTOR( VCLXAccessibleComponent, 0 );
+
+ ensureDisposed();
+
+ if ( mpVCLXindow && mpVCLXindow->GetWindow() )
+ {
+ mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
+ mpVCLXindow->GetWindow()->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
+ }
+
+ delete m_pSolarLock;
+ m_pSolarLock = NULL;
+ // This is not completely safe. If we assume that the base class dtor calls some method which
+ // uses this lock, the we crash. However, as the base class' dtor does not have a chance to call _out_
+ // virtual methods, this is no problem as long as the base class is safe, i.e. does not use the external
+ // lock from within it's dtor. At the moment, we _know_ the base class is safe in this respect, so
+ // let's assume it keeps this way.
+ // @see OAccessibleContextHelper::OAccessibleContextHelper( IMutex* )
+}
+
+IMPLEMENT_FORWARD_XINTERFACE3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE )
+IMPLEMENT_FORWARD_XTYPEPROVIDER3( VCLXAccessibleComponent, AccessibleExtendedComponentHelper_BASE, OAccessibleImplementationAccess, VCLXAccessibleComponent_BASE )
+
+::rtl::OUString VCLXAccessibleComponent::getImplementationName() throw (uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleWindow" );
+}
+
+sal_Bool VCLXAccessibleComponent::supportsService( const ::rtl::OUString& rServiceName ) throw (uno::RuntimeException)
+{
+ uno::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;
+}
+
+uno::Sequence< ::rtl::OUString > VCLXAccessibleComponent::getSupportedServiceNames() throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aNames(1);
+ aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleWindow" );
+ return aNames;
+}
+
+IMPL_LINK( VCLXAccessibleComponent, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_CHKTHIS(VCLXAccessibleComponent,0);
+
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+
+ /* Ignore VCLEVENT_WINDOW_ENDPOPUPMODE, because the UNO accessibility wrapper
+ * might have been destroyed by the previous VCLEventListener (if no AT tool
+ * is running), e.g. sub-toolbars in impress.
+ */
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #122218# */ && (pEvent->GetId() != VCLEVENT_WINDOW_ENDPOPUPMODE) )
+ {
+ DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" );
+ if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
+ {
+ ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+ }
+ }
+ return 0;
+}
+
+IMPL_LINK( VCLXAccessibleComponent, WindowChildEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_CHKTHIS(VCLXAccessibleComponent,0);
+
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) && mxWindow.is() /* #i68079# */ )
+ {
+ DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "Window???" );
+ if( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() )
+ {
+ // #103087# to prevent an early release of the component
+ uno::Reference< accessibility::XAccessibleContext > xTmp = this;
+
+ ProcessWindowChildEvent( *(VclWindowEvent*)pEvent );
+ }
+ }
+ return 0;
+}
+
+uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::GetChildAccessible( const VclWindowEvent& rVclWindowEvent )
+{
+ // checks if the data in the window event is our direct child
+ // and returns its accessible
+
+ // MT: Change this later, normaly a show/hide event shouldn't have the Window* in pData.
+ Window* pChildWindow = (Window *) rVclWindowEvent.GetData();
+ if( pChildWindow && GetWindow() == pChildWindow->GetAccessibleParentWindow() )
+ return pChildWindow->GetAccessible( rVclWindowEvent.GetId() == VCLEVENT_WINDOW_SHOW );
+ else
+ return uno::Reference< accessibility::XAccessible > ();
+}
+
+void VCLXAccessibleComponent::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ uno::Any aOldValue, aNewValue;
+ uno::Reference< accessibility::XAccessible > xAcc;
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children
+ {
+ xAcc = GetChildAccessible( rVclWindowEvent );
+ if( xAcc.is() )
+ {
+ aNewValue <<= xAcc;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_HIDE: // send destroy on hide for direct accessible children
+ {
+ xAcc = GetChildAccessible( rVclWindowEvent );
+ if( xAcc.is() )
+ {
+ aOldValue <<= xAcc;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+ break;
+ }
+}
+
+void VCLXAccessibleComponent::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ uno::Any aOldValue, aNewValue;
+
+ Window* pAccWindow = rVclWindowEvent.GetWindow();
+ DBG_ASSERT( pAccWindow, "VCLXAccessibleComponent::ProcessWindowEvent - Window?" );
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_OBJECT_DYING:
+ {
+ pAccWindow->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
+ pAccWindow->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
+ mxWindow.clear();
+ mpVCLXindow = NULL;
+ }
+ break;
+ //
+ // dont handle CHILDCREATED events here
+ // they are handled separately as child events, see ProcessWindowChildEvent above
+ //
+ /*
+ case VCLEVENT_WINDOW_CHILDCREATED:
+ {
+ Window* pWindow = (Window*) rVclWindowEvent.GetData();
+ DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDCREATED - Window=?" );
+ aNewValue <<= pWindow->GetAccessible();
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ break;
+ */
+ case VCLEVENT_WINDOW_CHILDDESTROYED:
+ {
+ Window* pWindow = (Window*) rVclWindowEvent.GetData();
+ DBG_ASSERT( pWindow, "VCLEVENT_WINDOW_CHILDDESTROYED - Window=?" );
+ if ( pWindow->GetAccessible( FALSE ).is() )
+ {
+ aOldValue <<= pWindow->GetAccessible( FALSE );
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+ break;
+
+ //
+ // show and hide will be handled as child events only and are
+ // responsible for sending create/destroy events, see ProcessWindowChildEvent above
+ //
+ /*
+ case VCLEVENT_WINDOW_SHOW:
+ {
+ aNewValue <<= accessibility::AccessibleStateType::VISIBLE;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+
+ aNewValue <<= accessibility::AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+
+ aNewValue.clear();
+ aOldValue <<= accessibility::AccessibleStateType::INVALID;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ aOldValue <<= accessibility::AccessibleStateType::VISIBLE;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+
+ aOldValue <<= accessibility::AccessibleStateType::SHOWING;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+
+ aOldValue.clear();
+ aNewValue <<= accessibility::AccessibleStateType::INVALID;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ */
+ case VCLEVENT_WINDOW_ACTIVATE:
+ {
+ // avoid notification if a child frame is already active
+ // only one frame may be active at a given time
+ if ( !pAccWindow->HasActiveChildFrame() &&
+ ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||
+ getAccessibleRole() == accessibility::AccessibleRole::ALERT ||
+ getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) ) // #i18891#
+ {
+ aNewValue <<= accessibility::AccessibleStateType::ACTIVE;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_DEACTIVATE:
+ {
+ if ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||
+ getAccessibleRole() == accessibility::AccessibleRole::ALERT ||
+ getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) // #i18891#
+ {
+ aOldValue <<= accessibility::AccessibleStateType::ACTIVE;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ case VCLEVENT_CONTROL_GETFOCUS:
+ {
+ if( (pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS) ||
+ (!pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS) )
+ {
+ // if multiple listeners were registered it is possible that the
+ // focus was changed during event processing (eg SfxTopWindow )
+ // #106082# allow ChildPathFocus only for CompoundControls, for windows the focus must be in the window itself
+ if( (pAccWindow->IsCompoundControl() && pAccWindow->HasChildPathFocus()) ||
+ (!pAccWindow->IsCompoundControl() && pAccWindow->HasFocus()) )
+ {
+ aNewValue <<= accessibility::AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ case VCLEVENT_CONTROL_LOSEFOCUS:
+ {
+ if( (pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS) ||
+ (!pAccWindow->IsCompoundControl() && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS) )
+ {
+ aOldValue <<= accessibility::AccessibleStateType::FOCUSED;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_FRAMETITLECHANGED:
+ {
+ ::rtl::OUString aOldName( *((::rtl::OUString*) rVclWindowEvent.GetData()) );
+ ::rtl::OUString aNewName( getAccessibleName() );
+ aOldValue <<= aOldName;
+ aNewValue <<= aNewName;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_ENABLED:
+ {
+ aNewValue <<= accessibility::AccessibleStateType::ENABLED;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ aNewValue <<= accessibility::AccessibleStateType::SENSITIVE;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_DISABLED:
+ {
+ aOldValue <<= accessibility::AccessibleStateType::SENSITIVE;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+
+ aOldValue <<= accessibility::AccessibleStateType::ENABLED;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_MOVE:
+ case VCLEVENT_WINDOW_RESIZE:
+ {
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::BOUNDRECT_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_MENUBARADDED:
+ {
+ MenuBar* pMenuBar = (MenuBar*) rVclWindowEvent.GetData();
+ if ( pMenuBar )
+ {
+ uno::Reference< accessibility::XAccessible > xChild( pMenuBar->GetAccessible() );
+ if ( xChild.is() )
+ {
+ aNewValue <<= xChild;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MENUBARREMOVED:
+ {
+ MenuBar* pMenuBar = (MenuBar*) rVclWindowEvent.GetData();
+ if ( pMenuBar )
+ {
+ uno::Reference< accessibility::XAccessible > xChild( pMenuBar->GetAccessible() );
+ if ( xChild.is() )
+ {
+ aOldValue <<= xChild;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::CHILD, aOldValue, aNewValue );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MINIMIZE:
+ {
+ aNewValue <<= accessibility::AccessibleStateType::ICONIFIED;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ case VCLEVENT_WINDOW_NORMALIZE:
+ {
+ aOldValue <<= accessibility::AccessibleStateType::ICONIFIED;
+ NotifyAccessibleEvent( accessibility::AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+}
+
+void VCLXAccessibleComponent::disposing()
+{
+ if ( mpVCLXindow && mpVCLXindow->GetWindow() )
+ {
+ mpVCLXindow->GetWindow()->RemoveEventListener( LINK( this, VCLXAccessibleComponent, WindowEventListener ) );
+ mpVCLXindow->GetWindow()->RemoveChildEventListener( LINK( this, VCLXAccessibleComponent, WindowChildEventListener ) );
+ }
+
+ AccessibleExtendedComponentHelper_BASE::disposing();
+
+ mxWindow.clear();
+ mpVCLXindow = NULL;
+}
+
+Window* VCLXAccessibleComponent::GetWindow() const
+{
+ return GetVCLXWindow() ? GetVCLXWindow()->GetWindow() : NULL;
+}
+
+void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
+{
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ Window *pLabeledBy = pWindow->GetLabeledBy();
+ if ( pLabeledBy && pLabeledBy != pWindow )
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+ aSequence[0] = pLabeledBy->GetAccessible();
+ rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
+ }
+
+ Window* pLabelFor = pWindow->GetLabelFor();
+ if ( pLabelFor && pLabelFor != pWindow )
+ {
+ uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+ aSequence[0] = pLabelFor->GetAccessible();
+ rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) );
+ }
+ }
+}
+
+void VCLXAccessibleComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ if ( pWindow->IsVisible() )
+ {
+ rStateSet.AddState( accessibility::AccessibleStateType::VISIBLE );
+ rStateSet.AddState( accessibility::AccessibleStateType::SHOWING );
+ }
+ else
+ {
+ rStateSet.AddState( accessibility::AccessibleStateType::INVALID );
+ }
+
+ if ( pWindow->IsEnabled() )
+ {
+ rStateSet.AddState( accessibility::AccessibleStateType::ENABLED );
+ rStateSet.AddState( accessibility::AccessibleStateType::SENSITIVE );
+ }
+
+ if ( pWindow->HasChildPathFocus() &&
+ ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||
+ getAccessibleRole() == accessibility::AccessibleRole::ALERT ||
+ getAccessibleRole() == accessibility::AccessibleRole::DIALOG ) ) // #i18891#
+ rStateSet.AddState( accessibility::AccessibleStateType::ACTIVE );
+
+ // #104290# MT: This way, a ComboBox doesn't get state FOCUSED.
+ // I also don't understand
+ // a) why WINDOW_FIRSTCHILD is used here (which btw is a border window in the case of a combo box)
+ // b) why HasFocus() is nout "enough" for a compound control
+ /*
+ Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ if ( ( !pWindow->IsCompoundControl() && pWindow->HasFocus() ) ||
+ ( pWindow->IsCompoundControl() && pChild && pChild->HasFocus() ) )
+ rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED );
+ */
+ if ( pWindow->HasFocus() || ( pWindow->IsCompoundControl() && pWindow->HasChildPathFocus() ) )
+ rStateSet.AddState( accessibility::AccessibleStateType::FOCUSED );
+
+ if ( pWindow->IsWait() )
+ rStateSet.AddState( accessibility::AccessibleStateType::BUSY );
+
+ if ( pWindow->GetStyle() & WB_SIZEABLE )
+ rStateSet.AddState( accessibility::AccessibleStateType::RESIZABLE );
+
+ if( pWindow->IsDialog() )
+ {
+ Dialog *pDlg = static_cast< Dialog* >( pWindow );
+ if( pDlg->IsInExecute() )
+ rStateSet.AddState( accessibility::AccessibleStateType::MODAL );
+ }
+ }
+ else
+ {
+ rStateSet.AddState( accessibility::AccessibleStateType::DEFUNC );
+ }
+
+/*
+
+MUST BE SET FROM DERIVED CLASSES:
+
+CHECKED
+COLLAPSED
+EXPANDED
+EXPANDABLE
+EDITABLE
+FOCUSABLE
+HORIZONTAL
+VERTICAL
+ICONIFIED
+MULTILINE
+MULTI_SELECTABLE
+PRESSED
+SELECTABLE
+SELECTED
+SINGLE_LINE
+TRANSIENT
+
+ */
+}
+
+
+// accessibility::XAccessibleContext
+sal_Int32 VCLXAccessibleComponent::getAccessibleChildCount() throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nChildren = 0;
+ if ( GetWindow() )
+ nChildren = GetWindow()->GetAccessibleChildWindowCount();
+
+ return nChildren;
+}
+
+uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleChild( sal_Int32 i ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ if ( i >= getAccessibleChildCount() )
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference< accessibility::XAccessible > xAcc;
+ if ( GetWindow() )
+ {
+ Window* pChild = GetWindow()->GetAccessibleChildWindow( (USHORT)i );
+ if ( pChild )
+ xAcc = pChild->GetAccessible();
+ }
+
+ return xAcc;
+}
+
+uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getVclParent() const
+{
+ uno::Reference< accessibility::XAccessible > xAcc;
+ if ( GetWindow() )
+ {
+ Window* pParent = GetWindow()->GetAccessibleParentWindow();
+ if ( pParent )
+ xAcc = pParent->GetAccessible();
+ }
+ return xAcc;
+}
+
+uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleParent( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() );
+ if ( !xAcc.is() )
+ // we do _not_ have a foreign-controlled parent -> default to our VCL parent
+ xAcc = getVclParent();
+
+ return xAcc;
+}
+
+sal_Int32 VCLXAccessibleComponent::getAccessibleIndexInParent( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nIndex = -1;
+
+ uno::Reference< accessibility::XAccessible > xAcc( implGetForeignControlledParent() );
+ if ( xAcc.is() )
+ { // we _do_ have a foreign-controlled parent -> use the base class' implementation,
+ // which goes the UNO way
+ nIndex = AccessibleExtendedComponentHelper_BASE::getAccessibleIndexInParent( );
+ }
+ else
+ {
+ if ( GetWindow() )
+ {
+ Window* pParent = GetWindow()->GetAccessibleParentWindow();
+ if ( pParent )
+ {
+ /*
+ for ( USHORT n = pParent->GetAccessibleChildWindowCount(); n; )
+ {
+ Window* pChild = pParent->GetAccessibleChildWindow( --n );
+ if ( pChild == GetWindow() )
+ {
+ nIndex = n;
+ break;
+ }
+ }
+ */
+ // Iterate over all the parent's children and search for this object.
+ // this should be compatible with the code in SVX
+ uno::Reference< accessibility::XAccessible > xParentAcc( pParent->GetAccessible() );
+ if ( xParentAcc.is() )
+ {
+ uno::Reference< accessibility::XAccessibleContext > xParentContext ( xParentAcc->getAccessibleContext() );
+ if ( xParentContext.is() )
+ {
+ sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
+ for ( sal_Int32 i=0; i<nChildCount; i++ )
+ {
+ uno::Reference< accessibility::XAccessible > xChild( xParentContext->getAccessibleChild(i) );
+ if ( xChild.is() )
+ {
+ uno::Reference< accessibility::XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+ if ( xChildContext == (accessibility::XAccessibleContext*) this )
+ {
+ nIndex = i;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return nIndex;
+}
+
+sal_Int16 VCLXAccessibleComponent::getAccessibleRole( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int16 nRole = 0;
+
+ if ( GetWindow() )
+ nRole = GetWindow()->GetAccessibleRole();
+
+ return nRole;
+}
+
+::rtl::OUString VCLXAccessibleComponent::getAccessibleDescription( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString aDescription;
+
+ if ( GetWindow() )
+ aDescription = GetWindow()->GetAccessibleDescription();
+
+ return aDescription;
+}
+
+::rtl::OUString VCLXAccessibleComponent::getAccessibleName( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString aName;
+ if ( GetWindow() )
+ {
+ aName = GetWindow()->GetAccessibleName();
+#if OSL_DEBUG_LEVEL > 1
+ aName += String( RTL_CONSTASCII_USTRINGPARAM( " (Type = " ) );
+ aName += String::CreateFromInt32( GetWindow()->GetType() );
+ aName += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
+#endif
+ }
+ return aName;
+}
+
+uno::Reference< accessibility::XAccessibleRelationSet > VCLXAccessibleComponent::getAccessibleRelationSet( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+ uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+ FillAccessibleRelationSet( *pRelationSetHelper );
+ return xSet;
+}
+
+uno::Reference< accessibility::XAccessibleStateSet > VCLXAccessibleComponent::getAccessibleStateSet( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+ uno::Reference< accessibility::XAccessibleStateSet > xSet = pStateSetHelper;
+ FillAccessibleStateSet( *pStateSetHelper );
+ return xSet;
+}
+
+lang::Locale VCLXAccessibleComponent::getLocale() throw (accessibility::IllegalAccessibleComponentStateException, uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ return Application::GetSettings().GetLocale();
+}
+
+uno::Reference< accessibility::XAccessible > VCLXAccessibleComponent::getAccessibleAtPoint( const awt::Point& rPoint ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ uno::Reference< accessibility::XAccessible > xChild;
+ for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ {
+ uno::Reference< accessibility::XAccessible > xAcc = getAccessibleChild( i );
+ if ( xAcc.is() )
+ {
+ uno::Reference< accessibility::XAccessibleComponent > xComp( xAcc->getAccessibleContext(), uno::UNO_QUERY );
+ if ( xComp.is() )
+ {
+ Rectangle aRect = VCLRectangle( xComp->getBounds() );
+ Point aPos = VCLPoint( rPoint );
+ if ( aRect.IsInside( aPos ) )
+ {
+ xChild = xAcc;
+ break;
+ }
+ }
+ }
+ }
+
+ return xChild;
+}
+
+// accessibility::XAccessibleComponent
+awt::Rectangle VCLXAccessibleComponent::implGetBounds() throw (uno::RuntimeException)
+{
+ awt::Rectangle aBounds ( 0, 0, 0, 0 );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
+ aBounds = AWTRectangle( aRect );
+ Window* pParent = pWindow->GetAccessibleParentWindow();
+ if ( pParent )
+ {
+ Rectangle aParentRect = pParent->GetWindowExtentsRelative( NULL );
+ awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() );
+ aBounds.X -= aParentScreenLoc.X;
+ aBounds.Y -= aParentScreenLoc.Y;
+ }
+ }
+
+ uno::Reference< accessibility::XAccessible > xParent( implGetForeignControlledParent() );
+ if ( xParent.is() )
+ { // hmm, we can't rely on our VCL coordinates, as in the Accessibility Hierarchy, somebody gave
+ // us a parent which is different from our VCL parent
+ // (actually, we did not check if it's really different ...)
+
+ // the screen location of the foreign parent
+ uno::Reference< accessibility::XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), uno::UNO_QUERY );
+ DBG_ASSERT( xParentComponent.is(), "VCLXAccessibleComponent::implGetBounds: invalid (foreign) parent component!" );
+
+ awt::Point aScreenLocForeign( 0, 0 );
+ if ( xParentComponent.is() )
+ aScreenLocForeign = xParentComponent->getLocationOnScreen();
+
+ // the screen location of the VCL parent
+ xParent = getVclParent();
+ if ( xParent.is() )
+ xParentComponent = xParentComponent.query( xParent->getAccessibleContext() );
+
+ awt::Point aScreenLocVCL( 0, 0 );
+ if ( xParentComponent.is() )
+ aScreenLocVCL = xParentComponent->getLocationOnScreen();
+
+ // the difference between them
+ awt::Size aOffset( aScreenLocVCL.X - aScreenLocForeign.X, aScreenLocVCL.Y - aScreenLocForeign.Y );
+ // move the bounds
+ aBounds.X += aOffset.Width;
+ aBounds.Y += aOffset.Height;
+ }
+
+ return aBounds;
+}
+
+awt::Point VCLXAccessibleComponent::getLocationOnScreen( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ awt::Point aPos;
+ if ( GetWindow() )
+ {
+ Rectangle aRect = GetWindow()->GetWindowExtentsRelative( NULL );
+ aPos.X = aRect.Left();
+ aPos.Y = aRect.Top();
+ }
+
+ return aPos;
+}
+
+void VCLXAccessibleComponent::grabFocus( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ uno::Reference< accessibility::XAccessibleStateSet > xStates = getAccessibleStateSet();
+ if ( mxWindow.is() && xStates.is() && xStates->contains( accessibility::AccessibleStateType::FOCUSABLE ) )
+ mxWindow->setFocus();
+}
+
+sal_Int32 SAL_CALL VCLXAccessibleComponent::getForeground( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ if ( pWindow->IsControlForeground() )
+ nColor = pWindow->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( pWindow->IsControlFont() )
+ aFont = pWindow->GetControlFont();
+ else
+ aFont = pWindow->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
+ }
+
+ return nColor;
+}
+
+sal_Int32 SAL_CALL VCLXAccessibleComponent::getBackground( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ sal_Int32 nColor = 0;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ if ( pWindow->IsControlBackground() )
+ nColor = pWindow->GetControlBackground().GetColor();
+ else
+ nColor = pWindow->GetBackground().GetColor().GetColor();
+ }
+
+ return nColor;
+}
+
+// XAccessibleExtendedComponent
+
+uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ uno::Reference< awt::XFont > xFont;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY );
+ if ( xDev.is() )
+ {
+ Font aFont;
+ if ( pWindow->IsControlFont() )
+ aFont = pWindow->GetControlFont();
+ else
+ aFont = pWindow->GetFont();
+ VCLXFont* pVCLXFont = new VCLXFont;
+ pVCLXFont->Init( *xDev.get(), aFont );
+ xFont = pVCLXFont;
+ }
+ }
+
+ return xFont;
+}
+
+::rtl::OUString SAL_CALL VCLXAccessibleComponent::getTitledBorderText( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sRet;
+ if ( GetWindow() )
+ sRet = GetWindow()->GetText();
+
+ return sRet;
+}
+
+::rtl::OUString SAL_CALL VCLXAccessibleComponent::getToolTipText( ) throw (uno::RuntimeException)
+{
+ OExternalLockGuard aGuard( this );
+
+ ::rtl::OUString sRet;
+ if ( GetWindow() )
+ sRet = GetWindow()->GetQuickHelpText();
+
+ return sRet;
+}
+
diff --git a/toolkit/source/awt/vclxbitmap.cxx b/toolkit/source/awt/vclxbitmap.cxx
new file mode 100644
index 000000000000..44d909674ca4
--- /dev/null
+++ b/toolkit/source/awt/vclxbitmap.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+
+#include <toolkit/awt/vclxbitmap.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/stream.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+// ----------------------------------------------------
+// class VCLXBitmap
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXBitmap::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XBitmap*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDisplayBitmap*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXBitmap )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXBitmap )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+// ::com::sun::star::awt::XBitmap
+::com::sun::star::awt::Size VCLXBitmap::getSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSize( maBitmap.GetSizePixel().Width(), maBitmap.GetSizePixel().Height() );
+ return aSize;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getDIB() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ SvMemoryStream aMem;
+ aMem << maBitmap.GetBitmap();
+ return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ SvMemoryStream aMem;
+ aMem << maBitmap.GetMask();
+ return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
+}
+
+
+
+
diff --git a/toolkit/source/awt/vclxbutton.cxx b/toolkit/source/awt/vclxbutton.cxx
new file mode 100644
index 000000000000..3701eee409c3
--- /dev/null
+++ b/toolkit/source/awt/vclxbutton.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "vclxbutton.hxx"
+
+#include <layout/core/helper.hxx>
+#include <com/sun/star/awt/ImagePosition.hpp>
+#include <vcl/button.hxx>
+
+namespace css = com::sun::star;
+
+namespace layoutimpl
+{
+
+VCLXIconButton::VCLXIconButton( Window *p, rtl::OUString aDefaultLabel, char const *pGraphName )
+ : VCLXButton()
+{
+ /* FIXME: before Window is set, setLabel, setProperty->setImage
+ * are silent no-ops. */
+ p->SetComponentInterface( this );
+
+ setLabel( aDefaultLabel );
+ setProperty( rtl::OUString::createFromAscii( "Graphic" ),
+ css::uno::Any( layoutimpl::loadGraphic( pGraphName ) ) );
+ setProperty( rtl::OUString::createFromAscii( "ImagePosition" ),
+ css::uno::Any( css::awt::ImagePosition::LeftCenter ) );
+ setProperty( rtl::OUString::createFromAscii( "Align" ),
+ css::uno::Any( (sal_Int16) 1 /* magic - center */ ) );
+}
+
+// FIXME: l10n/i18n of Reset & Apply
+
+VCLXOKButton::VCLXOKButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_OK ),
+ "res/commandimagelist/sc_ok.png" )
+{
+}
+
+VCLXCancelButton::VCLXCancelButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_CANCEL ),
+// : VCLXIconButton( xButton, rtl::OUString::createFromAscii( "~Cancel " ),
+ "res/commandimagelist/sc_cancel.png" )
+{
+}
+
+VCLXYesButton::VCLXYesButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_YES ),
+ "res/commandimagelist/sc_yes.png" )
+{
+}
+
+VCLXNoButton::VCLXNoButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_NO ),
+ "res/commandimagelist/sc_no.png" )
+{
+}
+
+VCLXRetryButton::VCLXRetryButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_RETRY ),
+ "res/commandimagelist/sc_retry.png" )
+{
+}
+
+VCLXIgnoreButton::VCLXIgnoreButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_IGNORE ),
+ "res/commandimagelist/sc_ignore.png" )
+{
+}
+
+VCLXResetButton::VCLXResetButton( Window *p )
+ : VCLXIconButton( p, rtl::OUString::createFromAscii( "~Reset " ),
+ "res/commandimagelist/sc_reset.png" )
+{
+}
+
+VCLXApplyButton::VCLXApplyButton( Window *p )
+ : VCLXIconButton( p, rtl::OUString::createFromAscii( "Apply" ),
+ "res/commandimagelist/sc_apply.png" )
+{
+}
+
+VCLXHelpButton::VCLXHelpButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_HELP ),
+ "res/commandimagelist/sc_help.png" )
+{
+}
+
+VCLXMoreButton::VCLXMoreButton( Window *p )
+ : VCLXIconButton( p, Button::GetStandardText( BUTTON_MORE ),
+// : VCLXIconButton( p, rtl::OUString::createFromAscii( "More " ),
+ "res/commandimagelist/sc_more.png" )
+{
+}
+
+VCLXAdvancedButton::VCLXAdvancedButton( Window *p )
+// : VCLXIconButton( p, Button::GetStandardText( BUTTON_ADVANCED ),
+ : VCLXIconButton( p, rtl::OUString::createFromAscii( "Advanced " ),
+ "res/commandimagelist/sc_advanced.png" )
+{
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxbutton.hxx b/toolkit/source/awt/vclxbutton.hxx
new file mode 100644
index 000000000000..5ec29321cb4f
--- /dev/null
+++ b/toolkit/source/awt/vclxbutton.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_AWT_VCLXBUTTON_HXX
+#define LAYOUT_AWT_VCLXBUTTON_HXX
+
+#include <toolkit/awt/vclxwindows.hxx>
+
+/* Replacements for broken toolkit/ impls. of ok, cancel, help button, etc. */
+
+namespace layoutimpl
+{
+
+class VCLXIconButton : public VCLXButton
+{
+public:
+ VCLXIconButton( Window* p, rtl::OUString aDefaultLabel, const char *pGraphName );
+ void Show ();
+};
+
+class VCLXOKButton : public VCLXIconButton
+{
+public:
+ VCLXOKButton( Window *p );
+};
+
+class VCLXCancelButton : public VCLXIconButton
+{
+public:
+ VCLXCancelButton( Window *p );
+};
+
+class VCLXYesButton : public VCLXIconButton
+{
+public:
+ VCLXYesButton( Window *p );
+};
+
+class VCLXNoButton : public VCLXIconButton
+{
+public:
+ VCLXNoButton( Window *p );
+};
+
+class VCLXRetryButton : public VCLXIconButton
+{
+public:
+ VCLXRetryButton( Window *p );
+};
+
+class VCLXIgnoreButton : public VCLXIconButton
+{
+public:
+ VCLXIgnoreButton( Window *p );
+};
+
+class VCLXResetButton : public VCLXIconButton
+{
+public:
+ VCLXResetButton( Window *p );
+};
+
+class VCLXApplyButton : public VCLXIconButton
+{
+public:
+ VCLXApplyButton( Window *p );
+};
+
+class VCLXHelpButton : public VCLXIconButton
+{
+public:
+ VCLXHelpButton( Window *p );
+};
+
+// TODO. Reuse vcl/Morebutton, or make AdvancedButton reuse me?
+class VCLXMoreButton : public VCLXIconButton
+{
+public:
+ VCLXMoreButton( Window *p );
+};
+
+class VCLXAdvancedButton : public VCLXIconButton
+{
+public:
+ VCLXAdvancedButton( Window *p );
+};
+
+} // namespace layoutimpl
+
+#endif // LAYOUT_AWT_VCLXBUTTON_HXX
diff --git a/toolkit/source/awt/vclxcontainer.cxx b/toolkit/source/awt/vclxcontainer.cxx
new file mode 100644
index 000000000000..d86b3bbb5591
--- /dev/null
+++ b/toolkit/source/awt/vclxcontainer.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <toolkit/awt/vclxcontainer.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/window.hxx>
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class VCLXContainer
+// ----------------------------------------------------
+
+void VCLXContainer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXContainer::VCLXContainer()
+{
+}
+
+VCLXContainer::~VCLXContainer()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXContainer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XVclContainer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XVclContainerPeer*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXContainer )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainer>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerPeer>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+
+// ::com::sun::star::awt::XVclContainer
+void VCLXContainer::addVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetContainerListeners().addInterface( rxListener );
+}
+
+void VCLXContainer::removeVclContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclContainerListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ GetContainerListeners().removeInterface( rxListener );
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > VCLXContainer::getWindows( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // Bei allen Childs das Container-Interface abfragen...
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aSeq;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ sal_uInt16 nChilds = pWindow->GetChildCount();
+ if ( nChilds )
+ {
+ aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >( nChilds );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pChildRefs = aSeq.getArray();
+ for ( sal_uInt16 n = 0; n < nChilds; n++ )
+ {
+ Window* pChild = pWindow->GetChild( n );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xWP = pChild->GetComponentInterface( sal_True );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xW( xWP, ::com::sun::star::uno::UNO_QUERY );
+ pChildRefs[n] = xW;
+ }
+ }
+ }
+ return aSeq;
+}
+
+
+// ::com::sun::star::awt::XVclContainerPeer
+void VCLXContainer::enableDialogControl( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( bEnable )
+ nStyle |= WB_DIALOGCONTROL;
+ else
+ nStyle &= (~WB_DIALOGCONTROL);
+ pWindow->SetStyle( nStyle );
+ }
+}
+
+void VCLXContainer::setTabOrder( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Components, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Tabs, sal_Bool bGroupControl ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_uInt32 nCount = Components.getLength();
+ DBG_ASSERT( nCount == (sal_uInt32)Tabs.getLength(), "setTabOrder: TabCount != ComponentCount" );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = Components.getConstArray();
+ const ::com::sun::star::uno::Any* pTabs = Tabs.getConstArray();
+
+ Window* pPrevWin = NULL;
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
+ {
+ // ::com::sun::star::style::TabStop
+ Window* pWin = VCLUnoHelper::GetWindow( pComps[n] );
+ // NULL kann vorkommen, wenn die ::com::sun::star::uno::Sequence vom TabController kommt und eine Peer fehlt!
+ if ( pWin )
+ {
+ // Reihenfolge der Fenster vor der Manipulation des Styles,
+ // weil z.B. der RadioButton in StateChanged das PREV-Window beruecksichtigt.
+ if ( pPrevWin )
+ pWin->SetZOrder( pPrevWin, WINDOW_ZORDER_BEHIND );
+
+ WinBits nStyle = pWin->GetStyle();
+ nStyle &= ~(WB_TABSTOP|WB_NOTABSTOP|WB_GROUP);
+ if ( pTabs[n].getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN )
+ {
+ sal_Bool bTab = false;
+ pTabs[n] >>= bTab;
+ nStyle |= ( bTab ? WB_TABSTOP : WB_NOTABSTOP );
+ }
+ pWin->SetStyle( nStyle );
+
+ if ( bGroupControl )
+ {
+ if ( n == 0 )
+ pWin->SetDialogControlStart( sal_True );
+ else
+ pWin->SetDialogControlStart( sal_False );
+ }
+
+ pPrevWin = pWin;
+ }
+ }
+}
+
+void VCLXContainer::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > >& Components ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_uInt32 nCount = Components.getLength();
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > * pComps = Components.getConstArray();
+
+ Window* pPrevWin = NULL;
+ Window* pPrevRadio = NULL;
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
+ {
+ Window* pWin = VCLUnoHelper::GetWindow( pComps[n] );
+ if ( pWin )
+ {
+ Window* pSortBehind = pPrevWin;
+ // #57096# Alle Radios hintereinander sortieren...
+ sal_Bool bNewPrevWin = sal_True;
+ if ( pWin->GetType() == WINDOW_RADIOBUTTON )
+ {
+ if ( pPrevRadio )
+ {
+ bNewPrevWin = ( pPrevWin == pPrevRadio ); // Radio-Button wurde vor das PreWin sortiert....
+ pSortBehind = pPrevRadio;
+ }
+ pPrevRadio = pWin;
+ }
+
+ // Z-Order
+ if ( pSortBehind )
+ pWin->SetZOrder( pSortBehind, WINDOW_ZORDER_BEHIND );
+
+ WinBits nStyle = pWin->GetStyle();
+ if ( n == 0 )
+ nStyle |= WB_GROUP;
+ else
+ nStyle &= (~WB_GROUP);
+ pWin->SetStyle( nStyle );
+
+ // Ein WB_GROUP hinter die Gruppe, falls keine Gruppe mehr folgt.
+ if ( n == ( nCount - 1 ) )
+ {
+ Window* pBehindLast = pWin->GetWindow( WINDOW_NEXT );
+ if ( pBehindLast )
+ {
+ WinBits nLastStyle = pBehindLast->GetStyle();
+ nLastStyle |= WB_GROUP;
+ pBehindLast->SetStyle( nLastStyle );
+ }
+ }
+
+ if ( bNewPrevWin )
+ pPrevWin = pWin;
+ }
+ }
+}
+
+
+
+
+
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx
new file mode 100644
index 000000000000..310f01a97679
--- /dev/null
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -0,0 +1,382 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/DeviceCapability.hpp>
+
+#include <com/sun/star/util/MeasureUnit.hpp>
+
+#include <toolkit/awt/vclxdevice.hxx>
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/awt/vclxbitmap.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
+#include <vcl/print.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/font.hxx>
+
+// ----------------------------------------------------
+// class VCLXDevice
+// ----------------------------------------------------
+VCLXDevice::VCLXDevice() : mrMutex( Application::GetSolarMutex() )
+{
+ mpOutputDevice = NULL;
+ nFlags = 0;
+}
+
+VCLXDevice::~VCLXDevice()
+{
+// Was thought for #88347#, but didn't help, because the interface will not be released
+// But would be a good idea anyway, check after 6.0, it's a little bit dangerous now
+// if( mpOutputDevice && IsCreatedWithToolkit() )
+// {
+// delete mpOutputDevice;
+// }
+}
+
+void VCLXDevice::DestroyOutputDevice()
+{
+ delete mpOutputDevice;
+ mpOutputDevice = NULL;
+}
+
+void VCLXDevice::SetCreatedWithToolkit( sal_Bool bCreatedWithToolkit )
+{
+ if ( bCreatedWithToolkit )
+ nFlags |= FLAGS_CREATEDWITHTOOLKIT;
+ else
+ nFlags &= ~FLAGS_CREATEDWITHTOOLKIT;
+}
+
+sal_Bool VCLXDevice::IsCreatedWithToolkit() const
+{
+ return ( nFlags & FLAGS_CREATEDWITHTOOLKIT ) != 0;
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXDevice::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDevice*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XUnitConversion*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXDevice )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXDevice )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XUnitConversion>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+// ::com::sun::star::awt::XDevice,
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXDevice::createGraphics( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > xRef;
+
+ if ( mpOutputDevice )
+ xRef = mpOutputDevice->CreateUnoGraphics();
+
+ return xRef;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXDevice::createDevice( sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef;
+ if ( GetOutputDevice() )
+ {
+ VCLXVirtualDevice* pVDev = new VCLXVirtualDevice;
+ VirtualDevice* pVclVDev = new VirtualDevice( *GetOutputDevice() );
+ pVclVDev->SetOutputSizePixel( Size( nWidth, nHeight ) );
+ pVDev->SetVirtualDevice( pVclVDev );
+ xRef = pVDev;
+ }
+ return xRef;
+}
+
+::com::sun::star::awt::DeviceInfo VCLXDevice::getInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::DeviceInfo aInfo;
+
+ if( mpOutputDevice )
+ {
+ Size aDevSz;
+ OutDevType eDevType = mpOutputDevice->GetOutDevType();
+ if ( eDevType == OUTDEV_WINDOW )
+ {
+ aDevSz = ((Window*)mpOutputDevice)->GetSizePixel();
+ ((Window*)mpOutputDevice)->GetBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
+ }
+ else if ( eDevType == OUTDEV_PRINTER )
+ {
+ aDevSz = ((Printer*)mpOutputDevice)->GetPaperSizePixel();
+ Size aOutSz = mpOutputDevice->GetOutputSizePixel();
+ Point aOffset = ((Printer*)mpOutputDevice)->GetPageOffset();
+ aInfo.LeftInset = aOffset.X();
+ aInfo.TopInset = aOffset.Y();
+ aInfo.RightInset = aDevSz.Width() - aOutSz.Width() - aOffset.X();
+ aInfo.BottomInset = aDevSz.Height() - aOutSz.Height() - aOffset.Y();
+ }
+ else // VirtualDevice
+ {
+ aDevSz = mpOutputDevice->GetOutputSizePixel();
+ aInfo.LeftInset = 0;
+ aInfo.TopInset = 0;
+ aInfo.RightInset = 0;
+ aInfo.BottomInset = 0;
+ }
+
+ aInfo.Width = aDevSz.Width();
+ aInfo.Height = aDevSz.Height();
+
+ Size aTmpSz = mpOutputDevice->LogicToPixel( Size( 1000, 1000 ), MapMode( MAP_CM ) );
+ aInfo.PixelPerMeterX = aTmpSz.Width()/10;
+ aInfo.PixelPerMeterY = aTmpSz.Height()/10;
+
+ aInfo.BitsPerPixel = mpOutputDevice->GetBitCount();
+
+ aInfo.Capabilities = 0;
+ if ( mpOutputDevice->GetOutDevType() != OUTDEV_PRINTER )
+ aInfo.Capabilities = ::com::sun::star::awt::DeviceCapability::RASTEROPERATIONS|::com::sun::star::awt::DeviceCapability::GETBITS;
+ }
+
+ return aInfo;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor > VCLXDevice::getFontDescriptors( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor> aFonts;
+ if( mpOutputDevice )
+ {
+ int nFonts = mpOutputDevice->GetDevFontCount();
+ if ( nFonts )
+ {
+ aFonts = ::com::sun::star::uno::Sequence< ::com::sun::star::awt::FontDescriptor>( nFonts );
+ ::com::sun::star::awt::FontDescriptor* pFonts = aFonts.getArray();
+ for ( int n = 0; n < nFonts; n++ )
+ pFonts[n] = VCLUnoHelper::CreateFontDescriptor( mpOutputDevice->GetDevFont( n ) );
+ }
+ }
+ return aFonts;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > VCLXDevice::getFont( const ::com::sun::star::awt::FontDescriptor& rDescriptor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > xRef;
+ if( mpOutputDevice )
+ {
+ VCLXFont* pMetric = new VCLXFont;
+ pMetric->Init( *this, VCLUnoHelper::CreateFont( rDescriptor, mpOutputDevice->GetFont() ) );
+ xRef = pMetric;
+ }
+ return xRef;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > VCLXDevice::createBitmap( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBmp;
+ if( mpOutputDevice )
+ {
+ Bitmap aBmp = mpOutputDevice->GetBitmap( Point( nX, nY ), Size( nWidth, nHeight ) );
+
+ VCLXBitmap* pBmp = new VCLXBitmap;
+ pBmp->SetBitmap( BitmapEx( aBmp ) );
+ xBmp = pBmp;
+ }
+ return xBmp;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > VCLXDevice::createDisplayBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap >& rxBitmap ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ BitmapEx aBmp = VCLUnoHelper::GetBitmap( rxBitmap );
+ VCLXBitmap* pBmp = new VCLXBitmap;
+ pBmp->SetBitmap( aBmp );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap > xDBmp = pBmp;
+ return xDBmp;
+}
+
+
+VCLXVirtualDevice::~VCLXVirtualDevice()
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DestroyOutputDevice();
+}
+
+
+// -----------------------------------------------------------------------------
+// ::com::sun::star::awt::XTextConstraints
+// -----------------------------------------------------------------------------
+// ::sal_Int32 SAL_CALL VCLXDevice::getTextWidth( const ::rtl::OUString& Text ) throw (::com::sun::star::uno::RuntimeException)
+// {
+// ::vos::OGuard aGuard( GetMutex() );
+// if (Text.getLength() == 0)
+// {
+// return 0;
+// }
+//
+// return 1;
+// }
+//
+// ::sal_Int32 SAL_CALL VCLXDevice::getTextHeight( ) throw (::com::sun::star::uno::RuntimeException)
+// {
+// ::vos::OGuard aGuard( GetMutex() );
+// return 1;
+// }
+
+
+// -----------------------------------------------------------------------------
+// Interface implementation of ::com::sun::star::awt::XUnitConversion
+// -----------------------------------------------------------------------------
+
+::com::sun::star::awt::Point SAL_CALL VCLXDevice::convertPointToLogic( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ (void)aPoint;
+ ::vos::OGuard aGuard( GetMutex() );
+ if (TargetUnit == com::sun::star::util::MeasureUnit::PERCENT )
+ {
+ // percentage not allowed here
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+
+ ::com::sun::star::awt::Point aAWTPoint(0,0);
+ // X,Y
+
+ if( mpOutputDevice )
+ {
+ MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(TargetUnit));
+ ::Point aVCLPoint = VCLUnoHelper::ConvertToVCLPoint(aPoint);
+ ::Point aDevPoint = mpOutputDevice->PixelToLogic(aVCLPoint, aMode );
+ aAWTPoint = VCLUnoHelper::ConvertToAWTPoint(aDevPoint);
+ }
+
+ return aAWTPoint;
+}
+
+
+::com::sun::star::awt::Point SAL_CALL VCLXDevice::convertPointToPixel( const ::com::sun::star::awt::Point& aPoint, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ (void)aPoint;
+ ::vos::OGuard aGuard( GetMutex() );
+ if (SourceUnit == com::sun::star::util::MeasureUnit::PERCENT ||
+ SourceUnit == com::sun::star::util::MeasureUnit::PIXEL )
+ {
+ // pixel or percentage not allowed here
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+
+ ::com::sun::star::awt::Point aAWTPoint(0,0);
+
+ if( mpOutputDevice )
+ {
+ MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(SourceUnit));
+ ::Point aVCLPoint = VCLUnoHelper::ConvertToVCLPoint(aPoint);
+ ::Point aDevPoint = mpOutputDevice->LogicToPixel(aVCLPoint, aMode );
+ aAWTPoint = VCLUnoHelper::ConvertToAWTPoint(aDevPoint);
+ }
+
+ return aAWTPoint;
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXDevice::convertSizeToLogic( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ (void)aSize;
+ ::vos::OGuard aGuard( GetMutex() );
+ if (TargetUnit == com::sun::star::util::MeasureUnit::PERCENT)
+ {
+ // percentage not allowed here
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+
+ ::com::sun::star::awt::Size aAWTSize(0,0);
+ // Width, Height
+
+
+ if( mpOutputDevice )
+ {
+ MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(TargetUnit));
+ ::Size aVCLSize = VCLUnoHelper::ConvertToVCLSize(aSize);
+ ::Size aDevSz = mpOutputDevice->PixelToLogic(aVCLSize, aMode );
+ aAWTSize = VCLUnoHelper::ConvertToAWTSize(aDevSz);
+ }
+
+ return aAWTSize;
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXDevice::convertSizeToPixel( const ::com::sun::star::awt::Size& aSize, ::sal_Int16 SourceUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ (void)aSize;
+ ::vos::OGuard aGuard( GetMutex() );
+ if (SourceUnit == com::sun::star::util::MeasureUnit::PERCENT ||
+ SourceUnit == com::sun::star::util::MeasureUnit::PIXEL)
+ {
+ // pixel or percentage not allowed here
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+
+ ::com::sun::star::awt::Size aAWTSize(0,0);
+ // Width, Height
+ if( mpOutputDevice )
+ {
+ MapMode aMode(VCLUnoHelper::ConvertToMapModeUnit(SourceUnit));
+ ::Size aVCLSize = VCLUnoHelper::ConvertToVCLSize(aSize);
+ ::Size aDevSz = mpOutputDevice->LogicToPixel(aVCLSize, aMode );
+ aAWTSize = VCLUnoHelper::ConvertToAWTSize(aDevSz);
+ }
+
+ return aAWTSize;
+}
+
diff --git a/toolkit/source/awt/vclxdialog.cxx b/toolkit/source/awt/vclxdialog.cxx
new file mode 100644
index 000000000000..43861c3ed347
--- /dev/null
+++ b/toolkit/source/awt/vclxdialog.cxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "vclxdialog.hxx"
+
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/SystemDependentXWindow.hpp>
+#include <com/sun/star/lang/SystemDependent.hpp>
+
+#include <cppuhelper/typeprovider.hxx>
+
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/property.hxx>
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include <windows.h>
+#include <tools/postwin.h>
+#elif defined ( QUARTZ )
+#include "premac.h"
+#include <Cocoa/Cocoa.h>
+#include "postmac.h"
+#endif
+
+#include <vcl/dialog.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/sysdata.hxx>
+#include <vcl/wrkwin.hxx>
+
+#include "forward.hxx"
+
+namespace layoutimpl
+{
+
+DBG_NAME( VCLXDialog )
+
+VCLXDialog::VCLXDialog()
+ : VCLXWindow()
+ , VCLXTopWindow_Base( true )
+ , VCLXDialog_Base()
+ , Bin()
+ , bRealized( false )
+ , bResizeSafeguard( false )
+{
+ DBG_CTOR( VCLXDialog, NULL );
+
+/* mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() );
+ assert(mxLayoutUnit.is());*/
+}
+
+VCLXDialog::~VCLXDialog()
+{
+ DBG_DTOR( VCLXDialog, NULL );
+}
+
+vos::IMutex& VCLXDialog::GetMutexImpl()
+{
+ return VCLXWindow::GetMutex();
+}
+
+Window* VCLXDialog::GetWindowImpl()
+{
+ return VCLXWindow::GetWindow();
+}
+
+::cppu::OInterfaceContainerHelper& VCLXDialog::GetTopWindowListenersImpl()
+{
+ return GetTopWindowListeners();
+}
+
+IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXDialog, VCLXWindow, Bin, VCLXDialog_Base );
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXDialog, VCLXWindow, VCLXDialog_Base );
+
+void SAL_CALL VCLXDialog::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aDisposeEvent;
+ aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+// maTabListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ VCLXWindow::dispose();
+}
+
+void VCLXDialog::resizedCb()
+{
+ queueResize();
+}
+
+void SAL_CALL VCLXDialog::allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException)
+{
+ ::com::sun::star::awt::Size reqSize = Bin::getMinimumSize();
+ reqSize.Height = getHeightForWidth( rArea.Width );
+
+ if ( !bRealized )
+ {
+ setPosSize( 0, 0, reqSize.Width, reqSize.Height, ::com::sun::star::awt::PosSize::SIZE );
+ bRealized = true;
+ setVisible( true );
+ }
+ else
+ {
+ ::com::sun::star::awt::Size curSize = getSize();
+ if ( reqSize.Width > curSize.Width )
+ setPosSize( 0, 0, reqSize.Width, 0, ::com::sun::star::awt::PosSize::WIDTH );
+ if ( reqSize.Height > curSize.Height )
+ setPosSize( 0, 0, 0, reqSize.Height, ::com::sun::star::awt::PosSize::HEIGHT );
+ }
+
+ ::com::sun::star::awt::Size size = getSize();
+ maAllocation.Width = size.Width;
+ maAllocation.Height = size.Height;
+
+ Bin::allocateArea( maAllocation );
+}
+
+void VCLXDialog::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_RESIZE:
+ resizedCb();
+ default:
+ aGuard.clear();
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ break;
+ }
+}
+
+void SAL_CALL VCLXDialog::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any &Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+/* sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ default:
+*/
+ VCLXWindow::setProperty( PropertyName, Value );
+/* }
+*/
+ }
+}
+
+::com::sun::star::uno::Any SAL_CALL VCLXDialog::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aReturn;
+ if ( GetWindow() )
+ {
+/*
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ default:
+*/
+ aReturn = VCLXWindow::getProperty( PropertyName );
+/*
+ }
+*/
+ }
+ return aReturn;
+}
+
+void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( Title );
+}
+
+void VCLXDialog::setHelpId( sal_Int32 id ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetHelpId( id );
+}
+
+::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aTitle;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aTitle = pWindow->GetText();
+ return aTitle;
+}
+
+sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int16 nRet = 0;
+ if ( GetWindow() )
+ {
+ Dialog* pDlg = (Dialog*) GetWindow();
+ Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
+ Window* pOldParent = NULL;
+ if ( pParent && !pParent->IsReallyVisible() )
+ {
+ pOldParent = pDlg->GetParent();
+ Window* pFrame = pDlg->GetWindow( WINDOW_FRAME );
+ if ( pFrame != pDlg )
+ pDlg->SetParent( pFrame );
+ }
+ nRet = pDlg->Execute();
+ if ( pOldParent )
+ pDlg->SetParent( pOldParent );
+ }
+ return nRet;
+}
+
+void VCLXDialog::endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( nResult == BUTTONID_HELP )
+ {
+ // UGH: c&p button.cxx
+ ::Window* pFocusWin = Application::GetFocusWindow();
+ if ( !pFocusWin )
+ pFocusWin = GetWindow();
+
+ HelpEvent aEvt( pFocusWin->GetPointerPosPixel(), HELPMODE_CONTEXT );
+ pFocusWin->RequestHelp( aEvt );
+ return;
+ }
+
+ Dialog* pDlg = (Dialog*) GetWindow();
+ if ( pDlg )
+ pDlg->EndDialog( nResult );
+}
+
+void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
+{
+ endDialog( 0 );
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxdialog.hxx b/toolkit/source/awt/vclxdialog.hxx
new file mode 100644
index 000000000000..64b2c03f90d5
--- /dev/null
+++ b/toolkit/source/awt/vclxdialog.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 LAYOUT_AWT_VCLXDIALOG_HXX
+#define LAYOUT_AWT_VCLXDIALOG_HXX
+
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <comphelper/uno3.hxx>
+#include <layout/core/bin.hxx>
+#include <toolkit/awt/vclxtopwindow.hxx>
+
+namespace layoutimpl
+{
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XDialog2 > VCLXDialog_Base;
+
+class TOOLKIT_DLLPUBLIC VCLXDialog : public VCLXWindow
+ , public VCLXTopWindow_Base
+ , public VCLXDialog_Base
+ , public Bin
+{
+private:
+ bool bRealized, bResizeSafeguard;
+ css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
+
+ VCLXDialog( const VCLXDialog& ); // never implemented
+ VCLXDialog& operator=( const VCLXDialog& ); // never implemented
+
+protected:
+ vos::IMutex& GetMutexImpl();
+ Window* GetWindowImpl();
+ ::cppu::OInterfaceContainerHelper& GetTopWindowListenersImpl();
+
+ ~VCLXDialog();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+ // ::com::sun::star::awt::XDialog
+ void SAL_CALL setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getTitle() throw(::com::sun::star::uno::RuntimeException);
+ sal_Int16 SAL_CALL execute() throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL endExecute() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutContainer
+ virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException);
+
+ void resizedCb();
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &/*aIds*/ )
+ {
+ }
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+
+
+public:
+ VCLXDialog();
+
+ // ::com::sun::star::awt::XDialog2
+ void SAL_CALL endDialog( sal_Int32 nResult ) throw(::com::sun::star::uno::RuntimeException);
+ void SAL_CALL setHelpId( sal_Int32 id ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_AWT_VCLXDIALOG_HXX */
diff --git a/toolkit/source/awt/vclxfixedline.cxx b/toolkit/source/awt/vclxfixedline.cxx
new file mode 100644
index 000000000000..8c77a4f35e19
--- /dev/null
+++ b/toolkit/source/awt/vclxfixedline.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "vclxfixedline.hxx"
+
+#include <com/sun/star/awt/PosSize.hpp>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <tools/debug.hxx>
+#include <vcl/fixed.hxx>
+
+#include "forward.hxx"
+
+namespace layoutimpl
+{
+
+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;
+
+DBG_NAME( VCLXFixedLine )
+
+VCLXFixedLine::VCLXFixedLine()
+ : VCLXWindow()
+{
+ DBG_CTOR( VCLXFixedLine, NULL );
+}
+
+VCLXFixedLine::~VCLXFixedLine()
+{
+ DBG_DTOR( VCLXFixedLine, NULL );
+}
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXFixedLine, VCLXWindow );
+
+void SAL_CALL VCLXFixedLine::dispose() throw(RuntimeException)
+{
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+ }
+
+ VCLXWindow::dispose();
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXFixedLine::getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return awt::Size( 8, 8 );
+}
+
+void VCLXFixedLine::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+/*
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ default:
+ aGuard.clear();
+*/
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+/*
+ break;
+ }
+*/
+}
+
+void SAL_CALL VCLXFixedLine::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+/*
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ default:
+*/
+ VCLXWindow::setProperty( PropertyName, Value );
+// }
+ }
+}
+
+Any SAL_CALL VCLXFixedLine::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Any aReturn;
+ if ( GetWindow() )
+ {
+/*
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ default:
+*/
+ aReturn = VCLXWindow::getProperty( PropertyName );
+ // }
+ }
+ return aReturn;
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxfixedline.hxx b/toolkit/source/awt/vclxfixedline.hxx
new file mode 100644
index 000000000000..d7dfd76d961f
--- /dev/null
+++ b/toolkit/source/awt/vclxfixedline.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 LAYOUT_AWT_VCLXFIXEDLINE_HXX
+#define LAYOUT_AWT_VCLXFIXEDLINE_HXX
+
+#include <comphelper/uno3.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+/* We just provide our own FixedLine, because default has no width... */
+
+class FixedLine;
+
+namespace layoutimpl
+{
+
+class VCLXFixedLine :public VCLXWindow
+{
+public:
+ VCLXFixedLine();
+
+protected:
+ ~VCLXFixedLine();
+
+ // XInterface
+ // DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+private:
+ VCLXFixedLine( const VCLXFixedLine& ); // never implemented
+ VCLXFixedLine& operator=( const VCLXFixedLine& ); // never implemented
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_AWT_VCLXFIXEDLINE_HXX */
diff --git a/toolkit/source/awt/vclxfont.cxx b/toolkit/source/awt/vclxfont.cxx
new file mode 100644
index 000000000000..53175ec79d24
--- /dev/null
+++ b/toolkit/source/awt/vclxfont.cxx
@@ -0,0 +1,252 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <rtl/ustring.h>
+
+#include <vcl/outdev.hxx>
+
+// ----------------------------------------------------
+// class VCLXFont
+// ----------------------------------------------------
+VCLXFont::VCLXFont()
+{
+ mpFontMetric = NULL;
+}
+
+VCLXFont::~VCLXFont()
+{
+ delete mpFontMetric;
+}
+
+void VCLXFont::Init( ::com::sun::star::awt::XDevice& rxDev, const Font& rFont )
+{
+ mxDevice = &rxDev;
+
+ delete mpFontMetric;
+ mpFontMetric = NULL;
+
+ maFont = rFont;
+}
+
+BOOL VCLXFont::ImplAssertValidFontMetric()
+{
+ if ( !mpFontMetric && mxDevice.is() )
+ {
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+ mpFontMetric = new FontMetric( pOutDev->GetFontMetric() );
+ pOutDev->SetFont( aOldFont );
+ }
+ }
+ return mpFontMetric ? TRUE : FALSE;
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXFont::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XFont*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XFont2*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXFont )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXFont )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont2>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+::com::sun::star::awt::FontDescriptor VCLXFont::getFontDescriptor( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return VCLUnoHelper::CreateFontDescriptor( maFont );
+
+}
+
+::com::sun::star::awt::SimpleFontMetric VCLXFont::getFontMetric( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::awt::SimpleFontMetric aFM;
+ if ( ImplAssertValidFontMetric() )
+ aFM = VCLUnoHelper::CreateFontMetric( *mpFontMetric );
+ return aFM;
+}
+
+sal_Int16 VCLXFont::getCharWidth( sal_Unicode c ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int16 nRet = -1;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+
+ nRet = sal::static_int_cast< sal_Int16 >(
+ pOutDev->GetTextWidth( String(c) ));
+
+ pOutDev->SetFont( aOldFont );
+ }
+ return nRet;
+}
+
+::com::sun::star::uno::Sequence< sal_Int16 > VCLXFont::getCharWidths( sal_Unicode nFirst, sal_Unicode nLast ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+
+ sal_Int16 nCount = nLast-nFirst + 1;
+ aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nCount );
+ for ( USHORT n = 0; n < nCount; n++ )
+ {
+ aSeq.getArray()[n] = sal::static_int_cast< sal_Int16 >(
+ pOutDev->GetTextWidth(
+ String(static_cast< sal_Unicode >(nFirst+n)) ));
+ }
+
+ pOutDev->SetFont( aOldFont );
+ }
+ return aSeq;
+}
+
+sal_Int32 VCLXFont::getStringWidth( const ::rtl::OUString& str ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nRet = -1;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+ nRet = pOutDev->GetTextWidth( str );
+ pOutDev->SetFont( aOldFont );
+ }
+ return nRet;
+}
+
+sal_Int32 VCLXFont::getStringWidthArray( const ::rtl::OUString& str, ::com::sun::star::uno::Sequence< sal_Int32 >& rDXArray ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nRet = -1;
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+ rDXArray = ::com::sun::star::uno::Sequence<sal_Int32>( str.getLength() );
+ nRet = pOutDev->GetTextArray( str, rDXArray.getArray() );
+ pOutDev->SetFont( aOldFont );
+ }
+ return nRet;
+}
+
+void VCLXFont::getKernPairs( ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars1, ::com::sun::star::uno::Sequence< sal_Unicode >& rnChars2, ::com::sun::star::uno::Sequence< sal_Int16 >& rnKerns ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if( pOutDev )
+ {
+ Font aOldFont = pOutDev->GetFont();
+ pOutDev->SetFont( maFont );
+
+ ULONG nPairs = pOutDev->GetKerningPairCount();
+ if ( nPairs )
+ {
+ KerningPair* pData = new KerningPair[ nPairs ];
+ pOutDev->GetKerningPairs( nPairs, pData );
+
+ rnChars1 = ::com::sun::star::uno::Sequence<sal_Unicode>( nPairs );
+ rnChars2 = ::com::sun::star::uno::Sequence<sal_Unicode>( nPairs );
+ rnKerns = ::com::sun::star::uno::Sequence<sal_Int16>( nPairs );
+
+ sal_Unicode* pChars1 = rnChars1.getArray();
+ sal_Unicode* pChars2 = rnChars2.getArray();
+ sal_Int16* pKerns = rnKerns.getArray();
+
+ for ( ULONG n = 0; n < nPairs; n++ )
+ {
+ pChars1[n] = pData[n].nChar1;
+ pChars2[n] = pData[n].nChar2;
+ pKerns[n] = sal::static_int_cast< sal_Int16 >(pData[n].nKern);
+ }
+
+
+ delete[] pData;
+ }
+ pOutDev->SetFont( aOldFont );
+ }
+}
+
+// ::com::sun::star::awt::XFont2
+sal_Bool VCLXFont::hasGlyphs( const ::rtl::OUString& aText )
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ OutputDevice* pOutDev = VCLUnoHelper::GetOutputDevice( mxDevice );
+ if ( pOutDev )
+ {
+ String aStr( aText );
+ if ( pOutDev->HasGlyphs( maFont, aStr, 0, aStr.Len() ) == STRING_LEN )
+ {
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx
new file mode 100644
index 000000000000..bfbdb531e8d2
--- /dev/null
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -0,0 +1,478 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+#include <toolkit/awt/vclxgraphics.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <vcl/gradient.hxx>
+#include <tools/debug.hxx>
+
+
+// ----------------------------------------------------
+// class VCLXGraphics
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXGraphics::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XGraphics*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXGraphics )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXGraphics )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+VCLXGraphics::VCLXGraphics() : mrMutex( Application::GetSolarMutex() )
+{
+ mpOutputDevice = NULL;
+ mpClipRegion = NULL;
+}
+
+VCLXGraphics::~VCLXGraphics()
+{
+ List* pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : NULL;
+ if ( pLst )
+ pLst->Remove( this );
+
+ delete mpClipRegion;
+}
+
+void VCLXGraphics::SetOutputDevice( OutputDevice* pOutDev )
+{
+ mpOutputDevice = pOutDev;
+ mxDevice = NULL;
+}
+
+void VCLXGraphics::Init( OutputDevice* pOutDev )
+{
+ DBG_ASSERT( !mpOutputDevice, "VCLXGraphics::Init allready has pOutDev !" );
+ mpOutputDevice = pOutDev;
+
+ maFont = mpOutputDevice->GetFont();
+ maTextColor = COL_BLACK;
+ maTextFillColor = COL_TRANSPARENT;
+ maLineColor = COL_BLACK;
+ maFillColor = COL_WHITE;
+ meRasterOp = ROP_OVERPAINT;
+ mpClipRegion = NULL;
+
+ // Register at OutputDevice
+ List* pLst = mpOutputDevice->GetUnoGraphicsList();
+ if ( !pLst )
+ pLst = mpOutputDevice->CreateUnoGraphicsList();
+ pLst->Insert( this, LIST_APPEND );
+}
+
+void VCLXGraphics::InitOutputDevice( sal_uInt16 nFlags )
+{
+ if(mpOutputDevice)
+ {
+ NAMESPACE_VOS(OGuard) aVclGuard( Application::GetSolarMutex() );
+
+ if ( nFlags & INITOUTDEV_FONT )
+ {
+ mpOutputDevice->SetFont( maFont );
+ mpOutputDevice->SetTextColor( maTextColor );
+ mpOutputDevice->SetTextFillColor( maTextFillColor );
+ }
+
+ if ( nFlags & INITOUTDEV_COLORS )
+ {
+ mpOutputDevice->SetLineColor( maLineColor );
+ mpOutputDevice->SetFillColor( maFillColor );
+ }
+
+ if ( nFlags & INITOUTDEV_RASTEROP )
+ {
+ mpOutputDevice->SetRasterOp( meRasterOp );
+ }
+
+ if ( nFlags & INITOUTDEV_CLIPREGION )
+ {
+ if( mpClipRegion )
+ mpOutputDevice->SetClipRegion( *mpClipRegion );
+ else
+ mpOutputDevice->SetClipRegion();
+ }
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXGraphics::getDevice() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( !mxDevice.is() && mpOutputDevice )
+ {
+ VCLXDevice* pDev = new VCLXDevice;
+ pDev->SetOutputDevice( mpOutputDevice );
+ mxDevice = pDev;
+ }
+ return mxDevice;
+}
+
+::com::sun::star::awt::SimpleFontMetric VCLXGraphics::getFontMetric() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::SimpleFontMetric aM;
+ if( mpOutputDevice )
+ {
+ mpOutputDevice->SetFont( maFont );
+ aM = VCLUnoHelper::CreateFontMetric( mpOutputDevice->GetFontMetric() );
+ }
+ return aM;
+}
+
+void VCLXGraphics::setFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maFont = VCLUnoHelper::CreateFont( rxFont );
+}
+
+void VCLXGraphics::selectFont( const ::com::sun::star::awt::FontDescriptor& rDescription ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maFont = VCLUnoHelper::CreateFont( rDescription, Font() );
+}
+
+void VCLXGraphics::setTextColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maTextColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setTextFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maTextFillColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setLineColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maLineColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setFillColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maFillColor = Color( (sal_uInt32)nColor );
+}
+
+void VCLXGraphics::setRasterOp( ::com::sun::star::awt::RasterOperation eROP ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ meRasterOp = (RasterOp)eROP;
+}
+
+void VCLXGraphics::setClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ delete mpClipRegion;
+ if ( rxRegion.is() )
+ mpClipRegion = new Region( VCLUnoHelper::GetRegion( rxRegion ) );
+ else
+ mpClipRegion = NULL;
+}
+
+void VCLXGraphics::intersectClipRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ {
+ Region aRegion( VCLUnoHelper::GetRegion( rxRegion ) );
+ if ( !mpClipRegion )
+ mpClipRegion = new Region( aRegion );
+ else
+ mpClipRegion->Intersect( aRegion );
+ }
+}
+
+void VCLXGraphics::push( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+
+ if( mpOutputDevice )
+ mpOutputDevice->Push();
+}
+
+void VCLXGraphics::pop( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+
+ if( mpOutputDevice )
+ mpOutputDevice->Pop();
+}
+
+void VCLXGraphics::copy( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >& rxSource, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( mpOutputDevice )
+ {
+ VCLXDevice* pFromDev = VCLXDevice::GetImplementation( rxSource );
+ DBG_ASSERT( pFromDev, "VCLXGraphics::copy - invalid device" );
+ if ( pFromDev )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP );
+ mpOutputDevice->DrawOutDev( Point( nDestX, nDestY ), Size( nDestWidth, nDestHeight ),
+ Point( nSourceX, nSourceY ), Size( nSourceWidth, nSourceHeight ), *pFromDev->GetOutputDevice() );
+ }
+ }
+}
+
+void VCLXGraphics::draw( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDisplayBitmap >& rxBitmapHandle, sal_Int32 nSourceX, sal_Int32 nSourceY, sal_Int32 nSourceWidth, sal_Int32 nSourceHeight, sal_Int32 nDestX, sal_Int32 nDestY, sal_Int32 nDestWidth, sal_Int32 nDestHeight ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP);
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap( rxBitmapHandle, ::com::sun::star::uno::UNO_QUERY );
+ BitmapEx aBmpEx = VCLUnoHelper::GetBitmap( xBitmap );
+
+ Point aPos(nDestX - nSourceX, nDestY - nSourceY);
+ Size aSz = aBmpEx.GetSizePixel();
+
+ if(nDestWidth != nSourceWidth)
+ {
+ float zoomX = (float)nDestWidth / (float)nSourceWidth;
+ aSz.Width() = (long) ((float)aSz.Width() * zoomX);
+ }
+
+ if(nDestHeight != nSourceHeight)
+ {
+ float zoomY = (float)nDestHeight / (float)nSourceHeight;
+ aSz.Height() = (long) ((float)aSz.Height() * zoomY);
+ }
+
+ if(nSourceX || nSourceY || aSz.Width() != nSourceWidth || aSz.Height() != nSourceHeight)
+ mpOutputDevice->IntersectClipRegion(Region(Rectangle(nDestX, nDestY, nDestX + nDestWidth - 1, nDestY + nDestHeight - 1)));
+
+ mpOutputDevice->DrawBitmapEx( aPos, aSz, aBmpEx );
+ }
+}
+
+void VCLXGraphics::drawPixel( sal_Int32 x, sal_Int32 y ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPixel( Point( x, y ) );
+ }
+}
+
+void VCLXGraphics::drawLine( sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawLine( Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ) );
+ }
+}
+
+void VCLXGraphics::drawRoundedRect( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 nHorzRound, sal_Int32 nVertRound ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawRect( Rectangle( Point( x, y ), Size( width, height ) ), nHorzRound, nVertRound );
+ }
+}
+
+void VCLXGraphics::drawPolyLine( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPolyLine( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
+ }
+}
+
+void VCLXGraphics::drawPolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPolygon( VCLUnoHelper::CreatePolygon( DataX, DataY ) );
+ }
+}
+
+void VCLXGraphics::drawPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataX, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > >& DataY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ sal_uInt16 nPolys = (sal_uInt16) DataX.getLength();
+ PolyPolygon aPolyPoly( nPolys );
+ for ( sal_uInt16 n = 0; n < nPolys; n++ )
+ aPolyPoly[n] = VCLUnoHelper::CreatePolygon( DataX.getConstArray()[n], DataY.getConstArray()[n] );
+
+ mpOutputDevice->DrawPolyPolygon( aPolyPoly );
+ }
+}
+
+void VCLXGraphics::drawEllipse( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawEllipse( Rectangle( Point( x, y ), Size( width, height ) ) );
+ }
+}
+
+void VCLXGraphics::drawArc( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawArc( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawPie( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawPie( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawChord( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, sal_Int32 x1, sal_Int32 y1, sal_Int32 x2, sal_Int32 y2 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ mpOutputDevice->DrawChord( Rectangle( Point( x, y ), Size( width, height ) ), Point( x1, y1 ), Point( x2, y2 ) );
+ }
+}
+
+void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_Int32 height, const ::com::sun::star::awt::Gradient& rGradient ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS );
+ Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor);
+ aGradient.SetAngle(rGradient.Angle);
+ aGradient.SetBorder(rGradient.Border);
+ aGradient.SetOfsX(rGradient.XOffset);
+ aGradient.SetOfsY(rGradient.YOffset);
+ aGradient.SetStartIntensity(rGradient.StartIntensity);
+ aGradient.SetEndIntensity(rGradient.EndIntensity);
+ aGradient.SetSteps(rGradient.StepCount);
+ mpOutputDevice->DrawGradient( Rectangle( Point( x, y ), Size( width, height ) ), aGradient );
+ }
+}
+
+void VCLXGraphics::drawText( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS |INITOUTDEV_FONT);
+ mpOutputDevice->DrawText( Point( x, y ), rText );
+ }
+}
+
+void VCLXGraphics::drawTextArray( sal_Int32 x, sal_Int32 y, const ::rtl::OUString& rText, const ::com::sun::star::uno::Sequence< sal_Int32 >& rLongs ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if( mpOutputDevice )
+ {
+ InitOutputDevice( INITOUTDEV_CLIPREGION|INITOUTDEV_RASTEROP|INITOUTDEV_COLORS|INITOUTDEV_FONT );
+ mpOutputDevice->DrawTextArray( Point( x, y ), rText, rLongs.getConstArray() );
+ }
+}
+
+
+
+
diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx
new file mode 100644
index 000000000000..1992a8d721a6
--- /dev/null
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -0,0 +1,1059 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <vcl/menu.hxx>
+#include <vcl/keycod.hxx>
+#include <vcl/image.hxx>
+#include <vcl/mnemonic.hxx>
+
+#include <com/sun/star/awt/KeyModifier.hpp>
+
+
+#ifdef DBG_UTIL
+ #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \
+ if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \
+ throw ::com::sun::star::container::NoSuchElementException( \
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \
+ += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item with " ) ) \
+ += ::rtl::OUString::valueOf( sal_Int32( nItemId ) ) \
+ += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " as identifier" ) ), \
+ *this \
+ );
+ #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \
+ if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \
+ throw ::com::sun::star::container::NoSuchElementException( \
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( Func ) ) \
+ += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": There is no menu item at position " ) ) \
+ += ::rtl::OUString::valueOf( sal_Int32( nPos ) ), \
+ *this \
+ );
+#else
+ #define THROW_MENUITEM_NOT_FOUND( Func, nItemId ) \
+ if ( MENU_ITEM_NOTFOUND == mpMenu->GetItemPos( nItemId ) ) \
+ throw ::com::sun::star::container::NoSuchElementException();
+ #define THROW_MENUPOS_NOT_FOUND( Func, nPos ) \
+ if ( MENU_ITEM_NOTFOUND == sal_uInt16( nPos ) ) \
+ throw ::com::sun::star::container::NoSuchElementException();
+#endif
+
+
+// ----------------------------------------------------
+// class VCLXMenu
+// ----------------------------------------------------
+
+DBG_NAME(VCLXMenu)
+
+VCLXMenu::VCLXMenu() : maMenuListeners( *this )
+{
+ DBG_CTOR( VCLXMenu, 0 );
+ mpMenu = NULL;
+}
+
+VCLXMenu::VCLXMenu( Menu* pMenu ) : maMenuListeners( *this )
+{
+ DBG_CTOR( VCLXMenu, 0 );
+ mpMenu = pMenu;
+}
+
+VCLXMenu::~VCLXMenu()
+{
+ DBG_DTOR( VCLXMenu, 0 );
+ for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n );
+ delete pRef;
+ }
+ if ( mpMenu )
+ {
+ mpMenu->RemoveEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
+ delete mpMenu;
+ }
+}
+
+BOOL VCLXMenu::IsPopupMenu() const
+{
+ return (mpMenu && ! mpMenu->IsMenuBar());
+}
+
+void VCLXMenu::ImplCreateMenu( sal_Bool bPopup )
+{
+ DBG_ASSERT( !mpMenu, "CreateMenu: Menu exists!" );
+
+ if ( bPopup )
+ mpMenu = new PopupMenu;
+ else
+ mpMenu = new MenuBar;
+
+ mpMenu->AddEventListener( LINK( this, VCLXMenu, MenuEventListener ) );
+}
+
+IMPL_LINK( VCLXMenu, MenuEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclMenuEvent ), "Unknown Event!" );
+ if ( pEvent && pEvent->ISA( VclMenuEvent ) )
+ {
+ DBG_ASSERT( ((VclMenuEvent*)pEvent)->GetMenu() && mpMenu, "Menu???" );
+
+ VclMenuEvent* pMenuEvent = (VclMenuEvent*)pEvent;
+ if ( pMenuEvent->GetMenu() == mpMenu ) // Also called for the root menu
+ {
+ switch ( pMenuEvent->GetId() )
+ {
+ case VCLEVENT_MENU_SELECT:
+ {
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.select( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_OBJECT_DYING:
+ {
+ mpMenu = NULL;
+ }
+ break;
+ case VCLEVENT_MENU_HIGHLIGHT:
+ {
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.highlight( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_MENU_ACTIVATE:
+ {
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.activate( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_MENU_DEACTIVATE:
+ {
+ if ( maMenuListeners.getLength() )
+ {
+ ::com::sun::star::awt::MenuEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.MenuId = mpMenu->GetCurItemId();
+ maMenuListeners.deactivate( aEvent );
+ }
+ }
+ break;
+
+ // ignore accessibility events
+ case VCLEVENT_MENU_ENABLE:
+ case VCLEVENT_MENU_INSERTITEM:
+ case VCLEVENT_MENU_REMOVEITEM:
+ case VCLEVENT_MENU_SUBMENUACTIVATE:
+ case VCLEVENT_MENU_SUBMENUDEACTIVATE:
+ case VCLEVENT_MENU_SUBMENUCHANGED:
+ case VCLEVENT_MENU_DEHIGHLIGHT:
+ case VCLEVENT_MENU_DISABLE:
+ case VCLEVENT_MENU_ITEMTEXTCHANGED:
+ case VCLEVENT_MENU_ITEMCHECKED:
+ case VCLEVENT_MENU_ITEMUNCHECKED:
+ case VCLEVENT_MENU_SHOW:
+ case VCLEVENT_MENU_HIDE:
+ break;
+
+ default: DBG_ERROR( "MenuEventListener - Unknown event!" );
+ }
+ }
+ }
+ return 0;
+}
+
+
+//=============================================================================
+//=============================================================================
+//=============================================================================
+
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString SAL_CALL VCLXMenu::getImplementationName( )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() );
+ const sal_Bool bIsPopupMenu = IsPopupMenu();
+ aGuard.clear();
+
+ ::rtl::OUString implName( RTL_CONSTASCII_USTRINGPARAM( "stardiv.Toolkit." ) );
+ if ( bIsPopupMenu )
+ implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXPopupMenu" ) );
+ else
+ implName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VCLXMenuBar" ) );
+
+ return implName;
+}
+
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL VCLXMenu::getSupportedServiceNames( )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() );
+ const sal_Bool bIsPopupMenu = IsPopupMenu();
+ aGuard.clear();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( 1 );
+ if ( bIsPopupMenu )
+ aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_PopupMenu );
+ else
+ aNames[ 0 ] = ::rtl::OUString::createFromAscii( szServiceName2_MenuBar );
+
+ return aNames;
+}
+
+
+::sal_Bool SAL_CALL VCLXMenu::supportsService( const ::rtl::OUString& rServiceName )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
+
+ if ( aServiceNames[ 0 ] == rServiceName )
+ return sal_True;
+
+ return sal_False;
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXMenu::queryInterface( const ::com::sun::star::uno::Type & rType )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() );
+ const sal_Bool bIsPopupMenu = IsPopupMenu();
+ aGuard.clear();
+
+ ::com::sun::star::uno::Any aRet;
+
+ if ( bIsPopupMenu )
+ aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenu*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPopupMenuExtended*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XPopupMenuExtended*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XPopupMenuExtended*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
+ else
+ aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenu*, (::com::sun::star::awt::XMenuBar*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBar*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenuBarExtended*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended*, (::com::sun::star::awt::XMenuBarExtended*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMenuExtended2*, (::com::sun::star::awt::XMenuBarExtended*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
+
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXMenu )
+
+// ::com::sun::star::lang::XTypeProvider
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXMenu::getTypes()
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() );
+ const sal_Bool bIsPopupMenu = IsPopupMenu();
+ aGuard.clear();
+
+ static ::cppu::OTypeCollection* pCollectionMenuBar = NULL;
+ static ::cppu::OTypeCollection* pCollectionPopupMenu = NULL;
+
+ if ( bIsPopupMenu )
+ {
+ if( !pCollectionPopupMenu )
+ {
+ ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pCollectionPopupMenu )
+ {
+ static ::cppu::OTypeCollection collectionPopupMenu(
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenuExtended>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) );
+ pCollectionPopupMenu = &collectionPopupMenu;
+ }
+ }
+
+ return (*pCollectionPopupMenu).getTypes();
+ }
+ else
+ {
+ if( !pCollectionMenuBar )
+ {
+ ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pCollectionMenuBar )
+ {
+ static ::cppu::OTypeCollection collectionMenuBar(
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenu>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBarExtended>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuExtended2>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ) );
+ pCollectionMenuBar = &collectionMenuBar;
+ }
+ }
+ return (*pCollectionMenuBar).getTypes();
+ }
+}
+
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXMenu::getImplementationId()
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( GetMutex() );
+ const sal_Bool bIsPopupMenu = IsPopupMenu();
+ aGuard.clear();
+
+ static ::cppu::OImplementationId* pIdMenuBar = NULL;
+ static ::cppu::OImplementationId* pIdPopupMenu = NULL;
+
+ if ( bIsPopupMenu )
+ {
+ if( !pIdPopupMenu )
+ {
+ ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pIdPopupMenu )
+ {
+ static ::cppu::OImplementationId idPopupMenu( sal_False );
+ pIdPopupMenu = &idPopupMenu;
+ }
+ }
+
+ return (*pIdPopupMenu).getImplementationId();
+ }
+ else
+ {
+ if( !pIdMenuBar )
+ {
+ ::osl::Guard< ::osl::Mutex > aGlobalGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pIdMenuBar )
+ {
+ static ::cppu::OImplementationId idMenuBar( sal_False );
+ pIdMenuBar = &idMenuBar;
+ }
+ }
+
+ return (*pIdMenuBar).getImplementationId();
+ }
+}
+
+
+//=============================================================================
+//=============================================================================
+//=============================================================================
+
+
+void VCLXMenu::addMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maMenuListeners.addInterface( rxListener );
+}
+
+void VCLXMenu::removeMenuListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maMenuListeners.removeInterface( rxListener );
+}
+
+void VCLXMenu::insertItem( sal_Int16 nItemId, const ::rtl::OUString& aText, sal_Int16 nItemStyle, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->InsertItem( nItemId, aText, (MenuItemBits)nItemStyle, nPos );
+}
+
+void VCLXMenu::removeItem( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nItemCount = (sal_Int32)mpMenu->GetItemCount();
+ if ( mpMenu && ( nCount > 0 ) && ( nPos >= 0 ) && ( nPos < nItemCount ) && ( nItemCount > 0 ))
+ {
+ sal_Int16 nP = sal::static_int_cast< sal_Int16 >(
+ Min( (int)(nPos+nCount), (int)nItemCount ));
+ while( nP-nPos > 0 )
+ mpMenu->RemoveItem( --nP );
+ }
+}
+
+sal_Int16 VCLXMenu::getItemCount( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu ? mpMenu->GetItemCount() : 0;
+}
+
+sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu ? mpMenu->GetItemId( nPos ) : 0;
+}
+
+sal_Int16 VCLXMenu::getItemPos( sal_Int16 nId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu ? mpMenu->GetItemPos( nId ) : 0;
+}
+
+void VCLXMenu::enableItem( sal_Int16 nItemId, sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->EnableItem( nItemId, bEnable );
+}
+
+sal_Bool VCLXMenu::isItemEnabled( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu ? mpMenu->IsItemEnabled( nItemId ) : sal_False;
+}
+
+void VCLXMenu::setItemText( sal_Int16 nItemId, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->SetItemText( nItemId, aText );
+}
+
+::rtl::OUString VCLXMenu::getItemText( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::rtl::OUString aItemText;
+ if ( mpMenu )
+ aItemText = mpMenu->GetItemText( nItemId );
+ return aItemText;
+}
+
+void VCLXMenu::setPopupMenu( sal_Int16 nItemId, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu >& rxPopupMenu ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ VCLXMenu* pVCLMenu = VCLXMenu::GetImplementation( rxPopupMenu );
+ DBG_ASSERT( pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu(), "setPopupMenu: Invalid Menu!" );
+
+ if ( mpMenu && pVCLMenu && pVCLMenu->GetMenu() && pVCLMenu->IsPopupMenu() )
+ {
+ // Selbst eine Ref halten!
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pNewRef = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > ;
+ *pNewRef = rxPopupMenu;
+ maPopupMenueRefs.Insert( pNewRef, LIST_APPEND );
+
+ mpMenu->SetPopupMenu( nItemId, (PopupMenu*) pVCLMenu->GetMenu() );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > VCLXMenu::getPopupMenu( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > aRef;
+ Menu* pMenu = mpMenu ? mpMenu->GetPopupMenu( nItemId ) : NULL;
+ if ( pMenu )
+ {
+ for ( sal_uInt32 n = maPopupMenueRefs.Count(); n; )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPopupMenu > * pRef = maPopupMenueRefs.GetObject( --n );
+ Menu* pM = ((VCLXMenu*)pRef->get())->GetMenu();
+ if ( pM == pMenu )
+ {
+ aRef = *pRef;
+ break;
+ }
+ }
+ }
+ return aRef;
+}
+
+// ::com::sun::star::awt::XPopupMenu
+void VCLXMenu::insertSeparator( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->InsertSeparator( nPos );
+}
+
+void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->SetDefaultItem( nItemId );
+}
+
+sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu ? mpMenu->GetDefaultItem() : 0;
+}
+
+void VCLXMenu::checkItem( sal_Int16 nItemId, sal_Bool bCheck ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->CheckItem( nItemId, bCheck );
+}
+
+sal_Bool VCLXMenu::isItemChecked( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu ? mpMenu->IsItemChecked( nItemId ) : sal_False;
+}
+
+sal_Int16 VCLXMenu::execute( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxWindowPeer, const ::com::sun::star::awt::Rectangle& rArea, sal_Int16 nFlags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int16 nRet = 0;
+ if ( mpMenu && IsPopupMenu() )
+ nRet = ((PopupMenu*)mpMenu)->Execute( VCLUnoHelper::GetWindow( rxWindowPeer ), VCLRectangle(rArea), nFlags | POPUPMENU_NOMOUSEUPCLOSE );
+ return nRet;
+}
+
+
+void SAL_CALL VCLXMenu::setCommand( sal_Int16 nItemId, const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->SetItemCommand( nItemId, aCommand );
+}
+
+::rtl::OUString SAL_CALL VCLXMenu::getCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::rtl::OUString aItemCommand;
+ if ( mpMenu )
+ aItemCommand = mpMenu->GetItemCommand( nItemId );
+ return aItemCommand;
+}
+
+void SAL_CALL VCLXMenu::setHelpCommand( sal_Int16 nItemId, const ::rtl::OUString& aHelp ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->SetHelpCommand( nItemId, aHelp );
+}
+
+::rtl::OUString SAL_CALL VCLXMenu::getHelpCommand( sal_Int16 nItemId ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::rtl::OUString aHelpCommand;
+ if ( mpMenu )
+ aHelpCommand = mpMenu->GetHelpCommand( nItemId );
+ return aHelpCommand;
+}
+
+
+// ============================================================================
+// ============================================================================
+// ============================================================================
+
+
+// BEGIN ANONYMOUS NAMESPACE
+namespace
+{
+ namespace css = ::com::sun::star;
+
+ Image lcl_XGraphic2VCLImage(
+ const css::uno::Reference< css::graphic::XGraphic >& xGraphic,
+ sal_Bool bResize )
+ {
+ Image aImage;
+ if ( !xGraphic.is() )
+ return aImage;
+
+ aImage = Image( xGraphic );
+ const ::Size aCurSize = aImage.GetSizePixel();
+ const sal_Int32 nCurWidth = aCurSize.Width();
+ const sal_Int32 nCurHeight = aCurSize.Height();
+ const sal_Int32 nIdeal( 16 );
+
+ if ( nCurWidth > 0 && nCurHeight > 0 )
+ {
+ if ( bResize && ( nCurWidth > nIdeal || nCurHeight > nIdeal ) )
+ {
+ sal_Int32 nIdealWidth = nCurWidth > nIdeal ? nIdeal : nCurWidth;
+ sal_Int32 nIdealHeight = nCurHeight > nIdeal ? nIdeal : nCurHeight;
+
+ ::Size aNewSize( nIdealWidth, nIdealHeight );
+
+ sal_Bool bModified( sal_False );
+ BitmapEx aBitmapEx = aImage.GetBitmapEx();
+ bModified = aBitmapEx.Scale( aNewSize, BMP_SCALE_INTERPOLATE );
+
+ if ( bModified )
+ aImage = Image( aBitmapEx );
+ }
+ }
+ return aImage;
+ }
+
+ /**
+ As svtools builds after toolkit, we can not include/use
+ svtools/inc/acceleratorexecute.hxx
+ So I just copy here svt::AcceleratorExecute::st_AWTKey2VCLKey
+ and svt::AcceleratorExecute::st_VCLKey2AWTKey
+ */
+ css::awt::KeyEvent lcl_VCLKey2AWTKey(const KeyCode& aVCLKey)
+ {
+ css::awt::KeyEvent aAWTKey;
+ aAWTKey.Modifiers = 0;
+ aAWTKey.KeyCode = (sal_Int16)aVCLKey.GetCode();
+
+ if (aVCLKey.IsShift())
+ aAWTKey.Modifiers |= css::awt::KeyModifier::SHIFT;
+ if (aVCLKey.IsMod1())
+ aAWTKey.Modifiers |= css::awt::KeyModifier::MOD1;
+ if (aVCLKey.IsMod2())
+ aAWTKey.Modifiers |= css::awt::KeyModifier::MOD2;
+ if (aVCLKey.IsMod3())
+ aAWTKey.Modifiers |= css::awt::KeyModifier::MOD3;
+
+ return aAWTKey;
+ }
+
+ KeyCode lcl_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey)
+ {
+ sal_Bool bShift = ((aAWTKey.Modifiers & css::awt::KeyModifier::SHIFT) == css::awt::KeyModifier::SHIFT );
+ sal_Bool bMod1 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 );
+ sal_Bool bMod2 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 );
+ sal_Bool bMod3 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 );
+ USHORT nKey = (USHORT)aAWTKey.KeyCode;
+
+ return KeyCode(nKey, bShift, bMod1, bMod2, bMod3);
+ }
+
+} // END ANONYMOUS NAMESPACE
+
+
+// ============================================================================
+// ============================================================================
+// ============================================================================
+
+
+// XMenuExtended2 Methods
+
+::sal_Bool SAL_CALL VCLXMenu::isPopupMenu( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return IsPopupMenu();
+}
+
+void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( mpMenu )
+ mpMenu->Clear();
+}
+
+
+::com::sun::star::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( ::sal_Int16 nItemPos )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::awt::MenuItemType aMenuItemType =
+ ::com::sun::star::awt::MenuItemType_DONTKNOW;
+ if ( mpMenu )
+ {
+ THROW_MENUPOS_NOT_FOUND( "VCLXMenu::getItemType()", nItemPos )
+ aMenuItemType = ( (::com::sun::star::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) );
+ }
+
+ return aMenuItemType;
+}
+
+void SAL_CALL VCLXMenu::hideDisabledEntries( ::sal_Bool bHide )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( mpMenu )
+ {
+ if ( bHide )
+ mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() | MENU_FLAG_HIDEDISABLEDENTRIES );
+ else
+ mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() & ~MENU_FLAG_HIDEDISABLEDENTRIES );
+ }
+}
+
+
+// ============================================================================
+// ============================================================================
+// ============================================================================
+
+
+// XPopupMenuExtended Methods
+
+::sal_Bool SAL_CALL VCLXMenu::isInExecute( )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ return ( (PopupMenu*) mpMenu )->IsInExecute();
+ else
+ return sal_False;
+}
+
+
+void SAL_CALL VCLXMenu::endExecute()
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ ( (PopupMenu*) mpMenu )->EndExecute();
+}
+
+
+void SAL_CALL VCLXMenu::setLogo( const ::com::sun::star::awt::MenuLogo& aMenuLogo )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ {
+ if ( aMenuLogo.Graphic.is() )
+ {
+ Image aImage = lcl_XGraphic2VCLImage( aMenuLogo.Graphic, sal_False );
+ MenuLogo aVCLMenuLogo;
+
+ aVCLMenuLogo.aBitmap = aImage.GetBitmapEx();
+ aVCLMenuLogo.aStartColor = Color( (sal_uInt32)(aMenuLogo.StartColor) );
+ aVCLMenuLogo.aEndColor = Color( (sal_uInt32)(aMenuLogo.EndColor) );
+
+ mpMenu->SetLogo( aVCLMenuLogo );
+ }
+ else
+ mpMenu->SetLogo();
+ }
+}
+
+
+::com::sun::star::awt::MenuLogo SAL_CALL VCLXMenu::getLogo( )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::awt::MenuLogo aAWTMenuLogo;
+ if ( mpMenu )
+ {
+ if ( mpMenu->HasLogo() )
+ {
+ MenuLogo aVCLMenuLogo = mpMenu->GetLogo();
+ aAWTMenuLogo.Graphic = Image(aVCLMenuLogo.aBitmap).GetXGraphic();
+ aAWTMenuLogo.StartColor = aVCLMenuLogo.aStartColor.GetColor();
+ aAWTMenuLogo.EndColor = aVCLMenuLogo.aEndColor.GetColor();
+ }
+ }
+ return aAWTMenuLogo;
+}
+
+
+void SAL_CALL VCLXMenu::enableAutoMnemonics( ::sal_Bool bEnable )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( mpMenu )
+ {
+ if ( !bEnable )
+ mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() | MENU_FLAG_NOAUTOMNEMONICS );
+ else
+ mpMenu->SetMenuFlags( mpMenu->GetMenuFlags() & ~MENU_FLAG_NOAUTOMNEMONICS );
+ }
+}
+
+
+void SAL_CALL VCLXMenu::setAcceleratorKeyEvent( ::sal_Int16 nItemId,
+ const ::com::sun::star::awt::KeyEvent& aKeyEvent )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setAcceleratorKeyEvent()", nItemId )
+ KeyCode aVCLKeyCode = lcl_AWTKey2VCLKey( aKeyEvent );
+ mpMenu->SetAccelKey( nItemId, aVCLKeyCode );
+ }
+}
+
+
+::com::sun::star::awt::KeyEvent SAL_CALL VCLXMenu::getAcceleratorKeyEvent( ::sal_Int16 nItemId )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::awt::KeyEvent aKeyEvent;
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getAcceleratorKeyEvent()", nItemId )
+ KeyCode nKeyCode = mpMenu->GetAccelKey( nItemId );
+ aKeyEvent = lcl_VCLKey2AWTKey( nKeyCode );
+ }
+
+ return aKeyEvent;
+}
+
+
+void SAL_CALL VCLXMenu::setHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sHelpText )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setHelpText()", nItemId )
+ mpMenu->SetHelpText( nItemId, sHelpText );
+ }
+}
+
+
+::rtl::OUString SAL_CALL VCLXMenu::getHelpText( ::sal_Int16 nItemId )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ rtl::OUString sHelpText;
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getHelpText()", nItemId )
+ sHelpText = mpMenu->GetHelpText( nItemId );
+ }
+
+ return sHelpText;
+}
+
+
+void SAL_CALL VCLXMenu::setTipHelpText( ::sal_Int16 nItemId, const ::rtl::OUString& sTipHelpText )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setTipHelpText()", nItemId )
+ mpMenu->SetTipHelpText( nItemId, sTipHelpText );
+ }
+}
+
+
+::rtl::OUString SAL_CALL VCLXMenu::getTipHelpText( ::sal_Int16 nItemId )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ rtl::OUString sTipHelpText;
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getTipHelpText()", nItemId )
+ sTipHelpText = mpMenu->GetTipHelpText( nItemId );
+ }
+ return sTipHelpText;
+}
+
+
+void SAL_CALL VCLXMenu::setItemImage(
+ ::sal_Int16 nItemId,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& xGraphic, ::sal_Bool bScale )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImage()", nItemId )
+ Image aImage = lcl_XGraphic2VCLImage( xGraphic, bScale );
+ mpMenu->SetItemImage( nItemId, aImage );
+ }
+}
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > SAL_CALL VCLXMenu::getItemImage( ::sal_Int16 nItemId )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > rxGraphic;
+
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImage()", nItemId )
+ Image aImage = mpMenu->GetItemImage( nItemId );
+ if ( !!aImage )
+ rxGraphic = aImage.GetXGraphic();
+ }
+ return rxGraphic;
+}
+
+
+void SAL_CALL VCLXMenu::setItemImageAngle( ::sal_Int16 nItemId, ::sal_Int32 nAngle )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageAngle()", nItemId )
+ mpMenu->SetItemImageAngle( nItemId, nAngle );
+ }
+}
+
+
+::sal_Int32 SAL_CALL VCLXMenu::getItemImageAngle( ::sal_Int16 nItemId )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::sal_Int32 nItemImageAngle( 0 );
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::getItemImageAngle()", nItemId )
+ nItemImageAngle = mpMenu->GetItemImageAngle( nItemId );
+ }
+ return nItemImageAngle;
+}
+
+
+void SAL_CALL VCLXMenu::setItemImageMirrorMode( ::sal_Int16 nItemId, ::sal_Bool bMirror )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::setItemImageMirrorMode()", nItemId )
+ mpMenu->SetItemImageMirrorMode( nItemId, bMirror );
+ }
+}
+
+
+::sal_Bool SAL_CALL VCLXMenu::isItemImageInMirrorMode( ::sal_Int16 nItemId )
+throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Bool bMirrorMode( sal_False );
+ if ( mpMenu && IsPopupMenu() )
+ {
+ THROW_MENUITEM_NOT_FOUND( "VCLXMenu::isItemImageInMirrorMode()", nItemId )
+ bMirrorMode = mpMenu->GetItemImageMirrorMode( nItemId );
+ }
+ return bMirrorMode;
+}
+
+
+// ----------------------------------------------------
+// class VCLXMenuBar
+// ----------------------------------------------------
+
+DBG_NAME(VCLXMenuBar);
+
+VCLXMenuBar::VCLXMenuBar()
+{
+ DBG_CTOR( VCLXMenuBar, 0 );
+ ImplCreateMenu( FALSE );
+}
+
+VCLXMenuBar::VCLXMenuBar( MenuBar* pMenuBar ) : VCLXMenu( (Menu *)pMenuBar )
+{
+ DBG_CTOR( VCLXMenuBar, 0 );
+}
+
+// ----------------------------------------------------
+// class VCLXPopupMenu
+// ----------------------------------------------------
+
+DBG_NAME(VCLXPopupMenu);
+
+VCLXPopupMenu::VCLXPopupMenu()
+{
+ DBG_CTOR( VCLXPopupMenu, 0 );
+ ImplCreateMenu( TRUE );
+}
diff --git a/toolkit/source/awt/vclxplugin.cxx b/toolkit/source/awt/vclxplugin.cxx
new file mode 100644
index 000000000000..29264ef0a85d
--- /dev/null
+++ b/toolkit/source/awt/vclxplugin.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "vclxplugin.hxx"
+
+#include <com/sun/star/awt/PosSize.hpp>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/helper/property.hxx>
+#include <vcl/ctrl.hxx>
+
+#include "forward.hxx"
+
+namespace layoutimpl
+{
+
+using namespace ::com::sun::star;
+
+VCLXPlugin::VCLXPlugin( Window *p, WinBits b )
+ : VCLXWindow()
+ , mpWindow( p )
+ , mpPlugin( 0 )
+ , mStyle( b )
+{
+}
+
+VCLXPlugin::~VCLXPlugin()
+{
+}
+
+void SAL_CALL VCLXPlugin::dispose() throw(uno::RuntimeException)
+{
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ lang::EventObject aDisposeEvent;
+ aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+ }
+
+ VCLXWindow::dispose();
+}
+
+void VCLXPlugin::SetPlugin( ::Control *p )
+{
+ mpPlugin = p;
+}
+
+awt::Size SAL_CALL VCLXPlugin::getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ if ( mpPlugin )
+ return AWTSize( mpPlugin->GetSizePixel() );
+ return awt::Size();
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxplugin.hxx b/toolkit/source/awt/vclxplugin.hxx
new file mode 100644
index 000000000000..49a2b2950854
--- /dev/null
+++ b/toolkit/source/awt/vclxplugin.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_AWT_VCLXPLUGIN_HXX
+#define LAYOUT_AWT_VCLXPLUGIN_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <vcl/wintypes.hxx>
+
+class Control;
+namespace layoutimpl
+{
+
+namespace css = ::com::sun::star;
+
+class VCLXPlugin : public VCLXWindow
+{
+public:
+ Window *mpWindow;
+ ::Control *mpPlugin;
+ WinBits mStyle;
+
+ VCLXPlugin( Window *p, WinBits b );
+
+ void SetPlugin( ::Control *p );
+
+protected:
+ ~VCLXPlugin();
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException);
+
+private:
+ VCLXPlugin( VCLXPlugin const & );
+ VCLXPlugin& operator=( VCLXPlugin const & );
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_AWT_VCLXPLUGIN_HXX */
diff --git a/toolkit/source/awt/vclxpointer.cxx b/toolkit/source/awt/vclxpointer.cxx
new file mode 100644
index 000000000000..d6f2160fb694
--- /dev/null
+++ b/toolkit/source/awt/vclxpointer.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+// ----------------------------------------------------
+// class VCLXPointer
+// ----------------------------------------------------
+VCLXPointer::VCLXPointer()
+{
+}
+
+VCLXPointer::~VCLXPointer()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPointer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPointer*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXPointer )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPointer )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+void VCLXPointer::setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maPointer = Pointer( (PointerStyle)nType );
+}
+
+sal_Int32 VCLXPointer::getType() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return (sal_Int32)maPointer.GetStyle();
+}
+
+
+
diff --git a/toolkit/source/awt/vclxprinter.cxx b/toolkit/source/awt/vclxprinter.cxx
new file mode 100644
index 000000000000..3c100c7c2186
--- /dev/null
+++ b/toolkit/source/awt/vclxprinter.cxx
@@ -0,0 +1,463 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <toolkit/awt/vclxprinter.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+
+#include <vcl/print.hxx>
+#include <vcl/jobset.hxx>
+#include <vcl/svapp.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+
+#include <toolkit/awt/vclxdevice.hxx>
+
+
+#define BINARYSETUPMARKER 0x23864691
+
+#define PROPERTY_Orientation 0
+#define PROPERTY_Horizontal 1
+
+::com::sun::star::beans::Property* ImplGetProperties( sal_uInt16& rElementCount )
+{
+ static ::com::sun::star::beans::Property* pProperties = NULL;
+ static sal_uInt16 nElements = 0;
+ if( !pProperties )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pProperties )
+ {
+ static ::com::sun::star::beans::Property __FAR_DATA aPropTable[] =
+ {
+ ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Orientation" ), PROPERTY_Orientation, ::getCppuType((const sal_Int16*)0), 0 ),
+ ::com::sun::star::beans::Property( ::rtl::OUString::createFromAscii( "Horizontal" ), PROPERTY_Horizontal, ::getBooleanCppuType(), 0 )
+ };
+ pProperties = aPropTable;
+ nElements = sizeof( aPropTable ) / sizeof( ::com::sun::star::beans::Property );
+ }
+ }
+ rElementCount = nElements;
+ return pProperties;
+}
+
+// ----------------------------------------------------
+// class VCLXPrinterPropertySet
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPrinterPropertySet::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::beans::XMultiPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XFastPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySet*, (::cppu::OPropertySetHelper*) this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPrinterPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OPropertySetHelper::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPrinterPropertySet )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterPropertySet>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+VCLXPrinterPropertySet::VCLXPrinterPropertySet( const String& rPrinterName )
+ : OPropertySetHelper( BrdcstHelper )
+ , mpPrinter( new Printer( rPrinterName ) )
+{
+ osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
+
+ mnOrientation = 0;
+ mbHorizontal = sal_False;
+}
+
+VCLXPrinterPropertySet::~VCLXPrinterPropertySet()
+{
+ osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
+ mpPrinter.reset();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinterPropertySet::GetDevice()
+{
+ if ( !mxPrnDevice.is() )
+ {
+ VCLXDevice* pDev = new VCLXDevice;
+ pDev->SetOutputDevice( GetPrinter() );
+ mxPrnDevice = pDev;
+ }
+ return mxPrnDevice;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXPrinterPropertySet::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& VCLXPrinterPropertySet::getInfoHelper()
+{
+ static ::cppu::OPropertyArrayHelper* pPropertyArrayHelper = NULL;
+ if ( !pPropertyArrayHelper )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pPropertyArrayHelper )
+ {
+ sal_uInt16 nElements;
+ ::com::sun::star::beans::Property* pProps = ImplGetProperties( nElements );
+ pPropertyArrayHelper = new ::cppu::OPropertyArrayHelper( pProps, nElements, sal_False );
+ }
+ }
+ return *pPropertyArrayHelper ;
+}
+
+sal_Bool VCLXPrinterPropertySet::convertFastPropertyValue( ::com::sun::star::uno::Any & rConvertedValue, ::com::sun::star::uno::Any & rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_Bool bDifferent = sal_False;
+ switch ( nHandle )
+ {
+ case PROPERTY_Orientation:
+ {
+ sal_Int16 n;
+ if( ( rValue >>= n ) && ( n != mnOrientation ) )
+ {
+ rConvertedValue <<= n;
+ rOldValue <<= mnOrientation;
+ bDifferent = sal_True;
+ }
+ }
+ break;
+ case PROPERTY_Horizontal:
+ {
+ sal_Bool b;
+ if( ( rValue >>= b ) && ( b != mbHorizontal ) )
+ {
+ rConvertedValue <<= b;
+ rOldValue <<= mbHorizontal;
+ bDifferent = sal_True;
+ }
+ }
+ break;
+ default:
+ {
+ DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
+ }
+ }
+ return bDifferent;
+}
+
+void VCLXPrinterPropertySet::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ switch( nHandle )
+ {
+ case PROPERTY_Orientation:
+ {
+ rValue >>= mnOrientation;
+ }
+ break;
+ case PROPERTY_Horizontal:
+ {
+ rValue >>= mbHorizontal;
+ }
+ break;
+ default:
+ {
+ DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
+ }
+ }
+}
+
+void VCLXPrinterPropertySet::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( ((VCLXPrinterPropertySet*)this)->Mutex );
+
+ switch( nHandle )
+ {
+ case PROPERTY_Orientation:
+ rValue <<= mnOrientation;
+ break;
+ case PROPERTY_Horizontal:
+ rValue <<= mbHorizontal;
+ break;
+ default:
+ {
+ DBG_ERROR( "VCLXPrinterPropertySet_Impl::convertFastPropertyValue - invalid Handle" );
+ }
+ }
+}
+
+// ::com::sun::star::awt::XPrinterPropertySet
+void VCLXPrinterPropertySet::setHorizontal( sal_Bool bHorizontal ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ ::com::sun::star::uno::Any aValue;
+ aValue <<= bHorizontal;
+ setFastPropertyValue( PROPERTY_Horizontal, aValue );
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterPropertySet::getFormDescriptions( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_uInt16 nPaperBinCount = GetPrinter()->GetPaperBinCount();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aDescriptions( nPaperBinCount );
+ for ( sal_uInt16 n = 0; n < nPaperBinCount; n++ )
+ {
+ // Format: <DisplayFormName;FormNameId;DisplayPaperBinName;PaperBinNameId;DisplayPaperName;PaperNameId>
+ String aDescr( RTL_CONSTASCII_USTRINGPARAM( "*;*;" ) );
+ aDescr += GetPrinter()->GetPaperBinName( n );
+ aDescr += ';';
+ aDescr += n;
+ aDescr.AppendAscii( ";*;*", 4 );
+
+ aDescriptions.getArray()[n] = aDescr;
+ }
+ return aDescriptions;
+}
+
+void VCLXPrinterPropertySet::selectForm( const ::rtl::OUString& rFormDescription ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_Int32 nIndex = 0;
+ sal_uInt16 nPaperBin = sal::static_int_cast< sal_uInt16 >(
+ rFormDescription.getToken( 3, ';', nIndex ).toInt32());
+ GetPrinter()->SetPaperBin( nPaperBin );
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXPrinterPropertySet::getBinarySetup( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ SvMemoryStream aMem;
+ aMem << BINARYSETUPMARKER;
+ aMem << GetPrinter()->GetJobSetup();
+ return ::com::sun::star::uno::Sequence<sal_Int8>( (sal_Int8*) aMem.GetData(), aMem.Tell() );
+}
+
+void VCLXPrinterPropertySet::setBinarySetup( const ::com::sun::star::uno::Sequence< sal_Int8 >& data ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ SvMemoryStream aMem( (char*) data.getConstArray(), data.getLength(), STREAM_READ );
+ sal_uInt32 nMarker;
+ aMem >> nMarker;
+ DBG_ASSERT( nMarker == BINARYSETUPMARKER, "setBinarySetup - invalid!" );
+ if ( nMarker == BINARYSETUPMARKER )
+ {
+ JobSetup aSetup;
+ aMem >> aSetup;
+ GetPrinter()->SetJobSetup( aSetup );
+ }
+}
+
+
+// ----------------------------------------------------
+// class VCLXPrinter
+// ----------------------------------------------------
+VCLXPrinter::VCLXPrinter( const String& rPrinterName )
+ : VCLXPrinterPropertySet( rPrinterName )
+{
+}
+
+VCLXPrinter::~VCLXPrinter()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPrinter::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPrinter*, this ) );
+
+ if ( !aRet.hasValue() )
+ aRet = VCLXPrinterPropertySet::queryInterface( rType );
+
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPrinter )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter>* ) NULL ),
+ VCLXPrinterPropertySet::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+sal_Bool VCLXPrinter::start( const ::rtl::OUString& /*rJobName*/, sal_Int16 /*nCopies*/, sal_Bool /*bCollate*/ ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ sal_Bool bDone = sal_True;
+ if ( mpListener.get() )
+ {
+ maInitJobSetup = mpPrinter->GetJobSetup();
+ mpListener.reset( new vcl::OldStylePrintAdaptor( mpPrinter ) );
+ }
+
+ return bDone;
+}
+
+void VCLXPrinter::end( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ if ( mpListener.get() )
+ {
+ Printer::PrintJob( mpListener, maInitJobSetup );
+ mpListener.reset();
+ }
+}
+
+void VCLXPrinter::terminate( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ mpListener.reset();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXPrinter::startPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ if ( mpListener.get() )
+ {
+ mpListener->StartPage();
+ }
+ return GetDevice();
+}
+
+void VCLXPrinter::endPage( ) throw(::com::sun::star::awt::PrinterException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ if ( mpListener.get() )
+ {
+ mpListener->EndPage();
+ }
+}
+
+
+// ----------------------------------------------------
+// class VCLXInfoPrinter
+// ----------------------------------------------------
+
+VCLXInfoPrinter::VCLXInfoPrinter( const String& rPrinterName )
+ : VCLXPrinterPropertySet( rPrinterName )
+{
+}
+
+VCLXInfoPrinter::~VCLXInfoPrinter()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXInfoPrinter::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XInfoPrinter*, this ) );
+
+ if ( !aRet.hasValue() )
+ aRet = VCLXPrinterPropertySet::queryInterface( rType );
+
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXInfoPrinter )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter>* ) NULL ),
+ VCLXPrinterPropertySet::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XInfoPrinter
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXInfoPrinter::createDevice( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( Mutex );
+
+ return GetDevice();
+}
+
+// ----------------------------------------------------
+// class VCLXPrinterServer
+// ----------------------------------------------------
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPrinterServer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPrinterServer*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPrinterServer )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinterServer>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XPrinterServer
+::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXPrinterServer::getPrinterNames( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ const std::vector<rtl::OUString>& rQueues = Printer::GetPrinterQueues();
+ sal_uInt32 nPrinters = rQueues.size();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames( nPrinters );
+ for ( sal_uInt32 n = 0; n < nPrinters; n++ )
+ aNames.getArray()[n] = rQueues[n];
+
+ return aNames;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > VCLXPrinterServer::createPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPrinter > xP;
+ xP = new VCLXPrinter( rPrinterName );
+ return xP;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > VCLXPrinterServer::createInfoPrinter( const ::rtl::OUString& rPrinterName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XInfoPrinter > xP;
+ xP = new VCLXInfoPrinter( rPrinterName );
+ return xP;
+}
+
+
+
diff --git a/toolkit/source/awt/vclxregion.cxx b/toolkit/source/awt/vclxregion.cxx
new file mode 100644
index 000000000000..3c4bbcad2d79
--- /dev/null
+++ b/toolkit/source/awt/vclxregion.cxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <toolkit/awt/vclxregion.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <vcl/svapp.hxx>
+
+// ----------------------------------------------------
+// class VCLXRegion
+// ----------------------------------------------------
+VCLXRegion::VCLXRegion()
+{
+}
+
+VCLXRegion::~VCLXRegion()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXRegion::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XRegion*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( VCLXRegion )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXRegion )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+
+::com::sun::star::awt::Rectangle VCLXRegion::getBounds() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return AWTRectangle( maRegion.GetBoundRect() );
+}
+
+void VCLXRegion::clear() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.SetEmpty();
+}
+
+void VCLXRegion::move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Move( nHorzMove, nVertMove );
+}
+
+void VCLXRegion::unionRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Union( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::intersectRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Intersect( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::excludeRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.Exclude( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::xOrRectangle( const ::com::sun::star::awt::Rectangle& rRect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maRegion.XOr( VCLRectangle( rRect ) );
+}
+
+void VCLXRegion::unionRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.Union( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+void VCLXRegion::intersectRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.Intersect( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+void VCLXRegion::excludeRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.Exclude( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+void VCLXRegion::xOrRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( rxRegion.is() )
+ maRegion.XOr( VCLUnoHelper::GetRegion( rxRegion ) );
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > VCLXRegion::getRectangles() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ULONG nRects = maRegion.GetRectCount();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects( nRects );
+
+ Rectangle aRect;
+ sal_uInt32 nR = 0;
+ RegionHandle h = maRegion.BeginEnumRects();
+ while ( maRegion.GetNextEnumRect( h, aRect ) )
+ aRects.getArray()[nR++] = AWTRectangle( aRect );
+ maRegion.EndEnumRects( h );
+
+ return aRects;
+}
+
+
+
diff --git a/toolkit/source/awt/vclxscroller.cxx b/toolkit/source/awt/vclxscroller.cxx
new file mode 100644
index 000000000000..834632a7548b
--- /dev/null
+++ b/toolkit/source/awt/vclxscroller.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "vclxscroller.hxx"
+
+#include <assert.h>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <sal/macros.h>
+#include <toolkit/helper/property.hxx>
+#include <tools/debug.hxx>
+#include <vcl/scrbar.hxx>
+
+#include "forward.hxx"
+
+namespace layoutimpl
+{
+
+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;
+
+DBG_NAME( VCLXScroller )
+
+VCLXScroller::VCLXScroller()
+ : VCLXWindow()
+ , Bin()
+{
+ DBG_CTOR( VCLXScroller, NULL );
+ mpHorScrollBar = mpVerScrollBar = 0;
+}
+
+VCLXScroller::~VCLXScroller()
+{
+ DBG_DTOR( VCLXScroller, NULL );
+}
+
+IMPLEMENT_2_FORWARD_XINTERFACE1( VCLXScroller, VCLXWindow, Container );
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXScroller, VCLXWindow );
+
+void SAL_CALL VCLXScroller::dispose() throw(RuntimeException)
+{
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+// maTabListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ VCLXWindow::dispose();
+}
+
+void VCLXScroller::ensureScrollBars()
+{
+
+ if ( !mpVerScrollBar )
+ {
+ mpVerScrollBar = new ScrollBar( GetWindow() , WB_VERT );
+ mpVerScrollBar->SetLineSize( 4 );
+ mpVerScrollBar->SetPageSize( 15 );
+ mpVerScrollBar->Show();
+ mpVerScrollBar->SetScrollHdl( LINK( this, VCLXScroller, ScrollHdl ) );
+ }
+ if ( !mpHorScrollBar )
+ {
+ mpHorScrollBar = new ScrollBar( GetWindow() , WB_HORZ );
+ mpHorScrollBar->SetLineSize( 4 );
+ mpHorScrollBar->SetPageSize( 15 );
+ mpHorScrollBar->Show();
+ mpHorScrollBar->SetScrollHdl( LINK( this, VCLXScroller, ScrollHdl ) );
+ } // mpContent = new FixedImage( this, ImplGetWinBits( WindowAttributes, 0 ) );
+
+}
+
+void SAL_CALL VCLXScroller::allocateArea(
+ const ::com::sun::star::awt::Rectangle &rArea )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ensureScrollBars(); // shouldn't be needed
+
+ maAllocation = rArea;
+ setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, PosSize::POSSIZE );
+
+ mpHorScrollBar->SetRangeMin( 0 );
+ mpHorScrollBar->SetRangeMax( SAL_MAX( maChildRequisition.Width - rArea.Width, 0 ) );
+ mpVerScrollBar->SetRangeMin( 0 );
+ mpVerScrollBar->SetRangeMax( SAL_MAX( maChildRequisition.Height - rArea.Height, 0 ) );
+
+ int thumbX = mpHorScrollBar->GetThumbPos();
+ int thumbY = mpVerScrollBar->GetThumbPos();
+ int thumbWidth = mpVerScrollBar->GetSizePixel().getWidth();
+ int thumbHeight = mpHorScrollBar->GetSizePixel().getHeight();
+
+ mpHorScrollBar->SetPosSizePixel( rArea.X, rArea.Y + rArea.Height - thumbHeight - 2,
+ rArea.Width - thumbWidth, thumbHeight );
+ mpVerScrollBar->SetPosSizePixel( rArea.X + rArea.Width - thumbWidth - 2, rArea.Y-2,
+ thumbWidth, rArea.Height - thumbHeight );
+
+ awt::Rectangle childRect( rArea.X - thumbX, rArea.Y - thumbY,
+ SAL_MAX( maChildRequisition.Width, rArea.Width ) - thumbWidth - 4,
+ SAL_MAX( maChildRequisition.Height, rArea.Height ) - thumbHeight - 4 );
+ if ( mxChild.is() )
+ allocateChildAt( mxChild, childRect );
+}
+
+#define MAX_CHILD_REQ 40
+::com::sun::star::awt::Size SAL_CALL VCLXScroller::getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ ensureScrollBars();
+ assert( mpHorScrollBar && mpVerScrollBar );
+ awt::Size childSize = Bin::getMinimumSize();
+ int thumbWidth = mpVerScrollBar->GetSizePixel().getWidth();
+ int thumbHeight = mpHorScrollBar->GetSizePixel().getHeight();
+ maRequisition = awt::Size(
+ SAL_MIN( MAX_CHILD_REQ, childSize.Width ) + thumbWidth,
+ SAL_MIN( MAX_CHILD_REQ, childSize.Height ) + thumbHeight );
+ return maRequisition;
+}
+
+void VCLXScroller::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+/*
+ ::vos::OClearableGuard aGuard( GetMutex() );
+
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ default:
+ aGuard.clear();
+*/
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+/*
+ break;
+ }
+*/
+}
+
+void SAL_CALL VCLXScroller::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+/*
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ default:
+*/
+ VCLXWindow::setProperty( PropertyName, Value );
+/*
+ }
+*/
+ }
+}
+
+Any SAL_CALL VCLXScroller::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Any aReturn;
+ if ( GetWindow() )
+ {
+/*
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ default:
+*/
+ aReturn = VCLXWindow::getProperty( PropertyName );
+
+// }
+ }
+ return aReturn;
+}
+
+IMPL_LINK( VCLXScroller, ScrollHdl, ScrollBar *, pScrollBar )
+{
+ (void) pScrollBar;
+ forceRecalc();
+ return 0;
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxscroller.hxx b/toolkit/source/awt/vclxscroller.hxx
new file mode 100644
index 000000000000..be2524020c72
--- /dev/null
+++ b/toolkit/source/awt/vclxscroller.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 LAYOUT_AWT_VCLXSCROLLER_HXX
+#define LAYOUT_AWT_VCLXSCROLLER_HXX
+
+#include <comphelper/uno3.hxx>
+#include <layout/core/bin.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+class ScrollBar;
+class FixedImage;
+
+namespace layoutimpl
+{
+
+class VCLXScroller :public VCLXWindow
+ ,public Bin
+{
+public:
+ VCLXScroller();
+
+protected:
+ ~VCLXScroller();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutContainer
+ virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+private:
+ VCLXScroller( const VCLXScroller& ); // never implemented
+ VCLXScroller& operator=( const VCLXScroller& ); // never implemented
+
+ // because the underlying window is only setup-ed after construction, init
+ // scrollbars at play-time
+ void ensureScrollBars();
+
+ FixedImage *mpContent; // dummy
+ ScrollBar *mpHorScrollBar, *mpVerScrollBar;
+ DECL_LINK( ScrollHdl, ScrollBar* );
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_AWT_VCLXSCROLLER_HXX */
diff --git a/toolkit/source/awt/vclxspinbutton.cxx b/toolkit/source/awt/vclxspinbutton.cxx
new file mode 100644
index 000000000000..e9c2b3271396
--- /dev/null
+++ b/toolkit/source/awt/vclxspinbutton.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_toolkit.hxx"
+#include "toolkit/awt/vclxspinbutton.hxx"
+#include "toolkit/helper/property.hxx"
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+
+
+#include <tools/debug.hxx>
+#include <vcl/spin.hxx>
+
+namespace toolkit
+{
+ void setButtonLikeFaceColor( Window* _pWindow, const ::com::sun::star::uno::Any& _rColorValue );
+ ::com::sun::star::uno::Any getButtonLikeFaceColor( const Window* _pWindow );
+}
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+ //--------------------------------------------------------------------
+ namespace
+ {
+ void lcl_modifyStyle( Window* _pWindow, WinBits _nStyleBits, sal_Bool _bShouldBePresent )
+ {
+ WinBits nStyle = _pWindow->GetStyle();
+ if ( _bShouldBePresent )
+ nStyle |= _nStyleBits;
+ else
+ nStyle &= ~_nStyleBits;
+ _pWindow->SetStyle( nStyle );
+ }
+ }
+
+ //====================================================================
+ //= VCLXSpinButton
+ //====================================================================
+ DBG_NAME( VCLXSpinButton )
+ //--------------------------------------------------------------------
+ VCLXSpinButton::VCLXSpinButton()
+ :maAdjustmentListeners( *this )
+ {
+ DBG_CTOR( VCLXSpinButton, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ VCLXSpinButton::~VCLXSpinButton()
+ {
+ DBG_DTOR( VCLXSpinButton, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2( VCLXSpinButton, VCLXWindow, VCLXSpinButton_Base )
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXSpinButton, VCLXWindow, VCLXSpinButton_Base )
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::dispose( ) throw(RuntimeException)
+ {
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = *this;
+ maAdjustmentListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ VCLXWindow::dispose();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::addAdjustmentListener( const Reference< XAdjustmentListener >& listener ) throw (RuntimeException)
+ {
+ if ( listener.is() )
+ maAdjustmentListeners.addInterface( listener );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::removeAdjustmentListener( const Reference< XAdjustmentListener >& listener ) throw (RuntimeException)
+ {
+ if ( listener.is() )
+ maAdjustmentListeners.removeInterface( listener );
+ }
+
+ namespace
+ {
+ typedef void (SpinButton::*SetSpinButtonValue) (long);
+ typedef long (SpinButton::*GetSpinButtonValue) (void) const;
+
+ //................................................................
+ void lcl_setSpinButtonValue( ::vos::IMutex& _rMutex, Window* _pWindow, SetSpinButtonValue _pSetter, sal_Int32 _nValue )
+ {
+ ::vos::OGuard aGuard( _rMutex );
+
+ SpinButton* pSpinButton = static_cast< SpinButton* >( _pWindow );
+ if ( pSpinButton )
+ (pSpinButton->*_pSetter)( _nValue );
+ }
+
+ //................................................................
+ sal_Int32 lcl_getSpinButtonValue( ::vos::IMutex& _rMutex, const Window* _pWindow, GetSpinButtonValue _pGetter )
+ {
+ ::vos::OGuard aGuard( _rMutex );
+
+ sal_Int32 nValue = 0;
+
+ const SpinButton* pSpinButton = static_cast< const SpinButton* >( _pWindow );
+ if ( pSpinButton )
+ nValue = (pSpinButton->*_pGetter)( );
+ return nValue;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::setValue( sal_Int32 n ) throw (RuntimeException)
+ {
+ lcl_setSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::SetValue, n );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ setMinimum( minValue );
+ setMaximum( maxValue );
+ setValue( currentValue );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL VCLXSpinButton::getValue( ) throw (RuntimeException)
+ {
+ return lcl_getSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::GetValue );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::setMinimum( sal_Int32 minValue ) throw (RuntimeException)
+ {
+ lcl_setSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::SetRangeMin, minValue );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::setMaximum( sal_Int32 maxValue ) throw (RuntimeException)
+ {
+ lcl_setSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::SetRangeMax, maxValue );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL VCLXSpinButton::getMinimum( ) throw (RuntimeException)
+ {
+ return lcl_getSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::GetRangeMin );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL VCLXSpinButton::getMaximum( ) throw (RuntimeException)
+ {
+ return lcl_getSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::GetRangeMax );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::setSpinIncrement( sal_Int32 spinIncrement ) throw (RuntimeException)
+ {
+ lcl_setSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::SetValueStep, spinIncrement );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL VCLXSpinButton::getSpinIncrement( ) throw (RuntimeException)
+ {
+ return lcl_getSpinButtonValue( GetMutex(), GetWindow(), &SpinButton::GetValueStep );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::setOrientation( sal_Int32 orientation ) throw (NoSupportException, RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ lcl_modifyStyle( GetWindow(), WB_HSCROLL, orientation == ScrollBarOrientation::HORIZONTAL );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL VCLXSpinButton::getOrientation( ) throw (RuntimeException)
+ {
+ return ( 0 != ( GetWindow()->GetStyle() & WB_HSCROLL ) )
+ ? ScrollBarOrientation::HORIZONTAL
+ : ScrollBarOrientation::VERTICAL;
+ }
+
+ //--------------------------------------------------------------------
+ void VCLXSpinButton::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+ {
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ Reference< XSpinValue > xKeepAlive( this );
+ SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
+ if ( !pSpinButton )
+ return;
+
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_SPINBUTTON_UP:
+ case VCLEVENT_SPINBUTTON_DOWN:
+ if ( maAdjustmentListeners.getLength() )
+ {
+ AdjustmentEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Value = pSpinButton->GetValue();
+
+ aGuard.clear();
+ maAdjustmentListeners.adjustmentValueChanged( aEvent );
+ }
+ break;
+
+ default:
+ xKeepAlive.clear();
+ aGuard.clear();
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ break;
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL VCLXSpinButton::setProperty( const ::rtl::OUString& PropertyName, const Any& Value ) throw(RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nValue = 0;
+ sal_Bool bIsLongValue = ( Value >>= nValue );
+
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ // the default implementation of the base class doesn't work here, since our
+ // interpretation for this property is slightly different
+ setButtonLikeFaceColor( GetWindow(), Value);
+ break;
+
+ case BASEPROPERTY_SPINVALUE:
+ if ( bIsLongValue )
+ setValue( nValue );
+ break;
+
+ case BASEPROPERTY_SPINVALUE_MIN:
+ if ( bIsLongValue )
+ setMinimum( nValue );
+ break;
+
+ case BASEPROPERTY_SPINVALUE_MAX:
+ if ( bIsLongValue )
+ setMaximum( nValue );
+ break;
+
+ case BASEPROPERTY_SPININCREMENT:
+ if ( bIsLongValue )
+ setSpinIncrement( nValue );
+ break;
+
+ case BASEPROPERTY_ORIENTATION:
+ if ( bIsLongValue )
+ lcl_modifyStyle( GetWindow(), WB_HSCROLL, nValue == ScrollBarOrientation::HORIZONTAL );
+ break;
+
+ default:
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL VCLXSpinButton::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Any aReturn;
+
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ // the default implementation of the base class doesn't work here, since our
+ // interpretation for this property is slightly different
+ aReturn = getButtonLikeFaceColor( GetWindow() );
+ break;
+
+ case BASEPROPERTY_SPINVALUE:
+ aReturn <<= (sal_Int32)getValue( );
+ break;
+
+ case BASEPROPERTY_SPINVALUE_MIN:
+ aReturn <<= (sal_Int32)getMinimum( );
+ break;
+
+ case BASEPROPERTY_SPINVALUE_MAX:
+ aReturn <<= (sal_Int32)getMaximum( );
+ break;
+
+ case BASEPROPERTY_SPININCREMENT:
+ aReturn <<= (sal_Int32)getSpinIncrement( );
+ break;
+
+ case BASEPROPERTY_ORIENTATION:
+ aReturn <<= (sal_Int32)
+ ( ( 0 != ( GetWindow()->GetStyle() & WB_HSCROLL ) )
+ ? ScrollBarOrientation::HORIZONTAL
+ : ScrollBarOrientation::VERTICAL
+ );
+ break;
+
+ default:
+ aReturn = VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ return aReturn;
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/awt/vclxsplitter.cxx b/toolkit/source/awt/vclxsplitter.cxx
new file mode 100644
index 000000000000..07fcf96cb813
--- /dev/null
+++ b/toolkit/source/awt/vclxsplitter.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "vclxsplitter.hxx"
+
+#include <assert.h>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <sal/macros.h>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/split.hxx>
+
+#include "forward.hxx"
+
+namespace layoutimpl
+{
+
+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;
+
+VCLXSplitter::ChildProps::ChildProps( VCLXSplitter::ChildData *pData )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Shrink" ),
+ ::getCppuType( static_cast< const rtl::OUString* >( NULL ) ),
+ &(pData->mbShrink) );
+}
+
+VCLXSplitter::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ : Box_Base::ChildData( xChild )
+ , mbShrink( false )
+{
+}
+
+VCLXSplitter::ChildData*
+VCLXSplitter::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
+{
+ return new ChildData( xChild );
+}
+
+VCLXSplitter::ChildProps*
+VCLXSplitter::createChildProps( Box_Base::ChildData *pData )
+{
+ return new ChildProps( static_cast<VCLXSplitter::ChildData*> ( pData ) );
+}
+
+
+DBG_NAME( VCLXSplitter );
+
+VCLXSplitter::VCLXSplitter( bool bHorizontal )
+ : VCLXWindow()
+ , Box_Base()
+{
+ DBG_CTOR( VCLXSplitter, NULL );
+ mnHandleRatio = 0.5;
+ mbHandlePressed = false;
+ mbHorizontal = bHorizontal;
+ mpSplitter = NULL;
+}
+
+VCLXSplitter::~VCLXSplitter()
+{
+ DBG_DTOR( VCLXSplitter, NULL );
+}
+
+IMPLEMENT_2_FORWARD_XINTERFACE1( VCLXSplitter, VCLXWindow, Container );
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXSplitter, VCLXWindow );
+
+VCLXSplitter::ChildData*
+VCLXSplitter::getChild( int i )
+{
+ if ( maChildren.size() && i == 0 )
+ return static_cast<VCLXSplitter::ChildData*>( maChildren.front() );
+ else if ( maChildren.size() > 1 && i == 1 )
+ return static_cast<VCLXSplitter::ChildData*>( maChildren.back() );
+ return 0;
+}
+
+void SAL_CALL VCLXSplitter::dispose() throw(RuntimeException)
+{
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+// maTabListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ VCLXWindow::dispose();
+}
+
+void VCLXSplitter::ensureSplitter()
+{
+ if ( !mpSplitter )
+ {
+ mpSplitter = new Splitter( GetWindow() , mbHorizontal ? WB_HORZ : WB_VERT );
+ mpSplitter->Show();
+ mpSplitter->SetEndSplitHdl( LINK( this, VCLXSplitter, HandleMovedHdl ) );
+ }
+}
+
+void SAL_CALL VCLXSplitter::addChild(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > &xChild )
+ throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException)
+{
+ if ( maChildren.size() == 2 )
+ throw css::awt::MaxChildrenException();
+ Box_Base::addChild( xChild );
+}
+
+void SAL_CALL VCLXSplitter::allocateArea(
+ const ::com::sun::star::awt::Rectangle &rArea )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ ensureSplitter(); // shouldn't be needed...
+ getMinimumSize();
+ int splitDiff;
+ if ( mbHorizontal )
+ splitDiff = rArea.Width - maAllocation.Width;
+ else
+ splitDiff = rArea.Height - maAllocation.Height;
+
+ assert( mpSplitter );
+ if ( splitDiff )
+ mpSplitter->SetSplitPosPixel( mpSplitter->GetSplitPosPixel() + splitDiff/2 );
+
+ maAllocation = rArea;
+ int width = mbHorizontal ? rArea.Width : rArea.Height;
+ int splitLen = 2;
+ int splitPos = mpSplitter->GetSplitPosPixel();
+ setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height, PosSize::POSSIZE );
+ if ( mbHorizontal )
+ mpSplitter->SetPosSizePixel( splitPos, 0, splitLen, rArea.Height, PosSize::POSSIZE );
+ else
+ mpSplitter->SetPosSizePixel( 0, splitPos, rArea.Width, splitLen, PosSize::POSSIZE );
+ mpSplitter->SetDragRectPixel( ::Rectangle( 0, 0, rArea.Width, rArea.Height ) );
+ int leftWidth = splitPos;
+ int rightWidth = width - splitPos;
+
+ if ( getChild( 0 ) && getChild( 0 )->mxChild.is() )
+ {
+ awt::Rectangle childRect( 0, 0, rArea.Width, rArea.Height );
+
+ if ( mbHorizontal )
+ childRect.Width = leftWidth - 2;
+ else
+ childRect.Height = leftWidth - 2;
+ allocateChildAt( getChild( 0 )->mxChild, childRect );
+ }
+ if ( getChild( 0 ) && getChild( 0 )->mxChild.is() )
+ {
+ awt::Rectangle childRect( 0, 0, rArea.Width, rArea.Height );
+
+ if ( mbHorizontal )
+ {
+ childRect.X += leftWidth + splitLen + 2;
+ childRect.Width = rightWidth;
+ }
+ else
+ {
+ childRect.Y += leftWidth + splitLen + 2;
+ childRect.Height = rightWidth;
+ }
+ allocateChildAt( getChild( 1 )->mxChild, childRect );
+ }
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXSplitter::getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ ensureSplitter();
+
+ awt::Size size( mbHorizontal ? 2 : 0, mbHorizontal ? 0 : 2 );
+ for ( unsigned int i = 0; i < 2; i++ )
+ {
+ if ( getChild( i ) && getChild( i )->mxChild.is() )
+ {
+ awt::Size childSize = getChild( i )->mxChild->getMinimumSize();
+ if ( mbHorizontal )
+ {
+ size.Width += childSize.Width;
+ size.Height = SAL_MAX( size.Height, childSize.Height );
+ }
+ else
+ {
+ size.Width = SAL_MAX( size.Width, childSize.Width );
+ size.Height += childSize.Height;
+ }
+ }
+ }
+
+ maRequisition = size;
+ return size;
+}
+
+void VCLXSplitter::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+}
+
+void SAL_CALL VCLXSplitter::setProperty( const ::rtl::OUString& PropertyName, const Any &Value ) throw(RuntimeException)
+{
+ VCLXWindow::setProperty( PropertyName, Value );
+}
+
+Any SAL_CALL VCLXSplitter::getProperty( const ::rtl::OUString& PropertyName ) throw(RuntimeException)
+{
+ return VCLXWindow::getProperty( PropertyName );
+}
+
+IMPL_LINK( VCLXSplitter, HandleMovedHdl, Splitter *, pSplitter )
+{
+ (void) pSplitter;
+ forceRecalc();
+ return 0;
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxsplitter.hxx b/toolkit/source/awt/vclxsplitter.hxx
new file mode 100644
index 000000000000..69be466e6be8
--- /dev/null
+++ b/toolkit/source/awt/vclxsplitter.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 LAYOUT_AWT_VCLXSPLITTER_HXX
+#define LAYOUT_AWT_VCLXSPLITTER_HXX
+
+#include <com/sun/star/awt/MaxChildrenException.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <comphelper/uno3.hxx>
+#include <layout/core/box-base.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+class Splitter;
+
+namespace layoutimpl
+{
+
+class VCLXSplitter :public VCLXWindow
+ ,public Box_Base
+{
+private:
+ VCLXSplitter( const VCLXSplitter& ); // never implemented
+ VCLXSplitter& operator=( const VCLXSplitter& ); // never implemented
+
+public:
+ VCLXSplitter( bool bHorizontal );
+
+protected:
+ ~VCLXSplitter();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutContainer
+ virtual void SAL_CALL addChild(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child )
+ throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException);
+
+ virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // unimplemented:
+ virtual sal_Bool SAL_CALL hasHeightForWidth()
+ throw(css::uno::RuntimeException)
+ { return false; }
+ virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ )
+ throw(css::uno::RuntimeException)
+ { return maRequisition.Height; }
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+public:
+ // Maps page ids to child references
+ struct ChildData : public Box_Base::ChildData
+ {
+ sal_Bool mbShrink;
+ ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ };
+
+ struct ChildProps : public Box_Base::ChildProps
+ {
+ ChildProps( VCLXSplitter::ChildData *pData );
+ };
+
+protected:
+
+ ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ ChildProps *createChildProps( Box_Base::ChildData* pData );
+
+ ChildData* getChild( int i );
+
+ float mnHandleRatio;
+ bool mbHandlePressed;
+
+ DECL_LINK( HandleMovedHdl, Splitter* );
+ bool mbHorizontal;
+ Splitter *mpSplitter;
+ void ensureSplitter();
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_AWT_VCLXSPLITTER_HXX */
diff --git a/toolkit/source/awt/vclxsystemdependentwindow.cxx b/toolkit/source/awt/vclxsystemdependentwindow.cxx
new file mode 100644
index 000000000000..a0d8febb44f0
--- /dev/null
+++ b/toolkit/source/awt/vclxsystemdependentwindow.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <com/sun/star/lang/SystemDependent.hpp>
+
+#if defined UNX && ! defined QUARTZ && ! defined _COM_SUN_STAR_AWT_SYSTEMDEPENDENTXWINDOW_HPP_
+#include <com/sun/star/awt/SystemDependentXWindow.hpp>
+#endif
+
+#include <toolkit/awt/vclxsystemdependentwindow.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include <windows.h>
+#include <tools/postwin.h>
+#elif defined ( QUARTZ )
+#include "premac.h"
+#include <Cocoa/Cocoa.h>
+#include "postmac.h"
+#endif
+
+#include <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
+
+// ----------------------------------------------------
+// class VCLXSystemDependentWindow
+// ----------------------------------------------------
+VCLXSystemDependentWindow::VCLXSystemDependentWindow()
+{
+}
+
+VCLXSystemDependentWindow::~VCLXSystemDependentWindow()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXSystemDependentWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XSystemDependentWindowPeer*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXSystemDependentWindow )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Any VCLXSystemDependentWindow::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // TODO, check the process id
+ ::com::sun::star::uno::Any aRet;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ const SystemEnvData* pSysData = ((SystemChildWindow *)pWindow)->GetSystemData();
+ if( pSysData )
+ {
+#if (defined WNT)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
+ {
+ aRet <<= (sal_Int32)pSysData->hWnd;
+ }
+#elif (defined OS2)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 )
+ {
+ aRet <<= (sal_Int32)pSysData->hWnd;
+ }
+#elif (defined QUARTZ)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC )
+ {
+ aRet <<= (sal_IntPtr)pSysData->pView;
+ }
+#elif (defined UNX)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
+ {
+ ::com::sun::star::awt::SystemDependentXWindow aSD;
+ aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay));
+ aSD.WindowHandle = pSysData->aWindow;
+ aRet <<= aSD;
+ }
+#endif
+ }
+ }
+ return aRet;
+}
+
+
+
+
+
diff --git a/toolkit/source/awt/vclxtabcontrol.cxx b/toolkit/source/awt/vclxtabcontrol.cxx
new file mode 100644
index 000000000000..1dfd52678957
--- /dev/null
+++ b/toolkit/source/awt/vclxtabcontrol.cxx
@@ -0,0 +1,540 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "vclxtabcontrol.hxx"
+
+#include <com/sun/star/awt/PosSize.hpp>
+#include <sal/macros.h>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+
+#include "forward.hxx"
+
+namespace layoutimpl
+{
+
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star;
+
+VCLXTabControl::ChildProps::ChildProps( VCLXTabControl::ChildData *pData )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Title" ),
+ ::getCppuType( static_cast< const rtl::OUString* >( NULL ) ),
+ &(pData->maTitle) );
+}
+
+VCLXTabControl::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ : Box_Base::ChildData( xChild )
+ , maTitle()
+{
+}
+
+VCLXTabControl::ChildData*
+VCLXTabControl::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
+{
+ return new ChildData( xChild );
+}
+
+VCLXTabControl::ChildProps*
+VCLXTabControl::createChildProps( Box_Base::ChildData *pData )
+{
+ return new ChildProps( static_cast<VCLXTabControl::ChildData*> ( pData ) );
+}
+
+DBG_NAME( VCLXTabControl );
+
+#if !defined (__GNUC__)
+#define __PRETTY_FUNCTION__ __FUNCTION__
+#endif /* !__GNUC__ */
+
+VCLXTabControl::VCLXTabControl()
+ : VCLXWindow()
+ , VCLXTabControl_Base()
+ , Box_Base()
+ , mTabId (1)
+ , bRealized (false)
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("\n********%s:%x", __PRETTY_FUNCTION__, this);
+#endif
+ DBG_CTOR( VCLXTabControl, NULL );
+}
+
+VCLXTabControl::~VCLXTabControl()
+{
+ DBG_DTOR( VCLXTabControl, NULL );
+}
+
+IMPLEMENT_2_FORWARD_XINTERFACE2( VCLXTabControl, VCLXWindow, Container, VCLXTabControl_Base );
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXTabControl, VCLXWindow, VCLXTabControl_Base );
+
+void SAL_CALL VCLXTabControl::dispose( ) throw(uno::RuntimeException)
+{
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+// maTabListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ VCLXWindow::dispose();
+}
+
+#if 0
+void SAL_CALL VCLXTabControl::addTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException)
+{
+ if ( listener.is() )
+ maTabListeners.addInterface( listener );
+}
+
+void SAL_CALL VCLXTabControl::removeTabListener( const Reference< XTabListener >& listener ) throw (uno::RuntimeException)
+{
+ if ( listener.is() )
+ maTabListeners.removeInterface( listener );
+}
+#endif
+
+TabControl *VCLXTabControl::getTabControl() const throw (uno::RuntimeException)
+{
+ TabControl *pTabControl = static_cast< TabControl* >( GetWindow() );
+ if ( pTabControl )
+ return pTabControl;
+ throw uno::RuntimeException();
+}
+
+sal_Int32 SAL_CALL VCLXTabControl::insertTab() throw (uno::RuntimeException)
+{
+ TabControl *pTabControl = getTabControl();
+ USHORT id = sal::static_int_cast< USHORT >( mTabId++ );
+ rtl::OUString title (RTL_CONSTASCII_USTRINGPARAM( "" ) );
+ pTabControl->InsertPage( id, title.getStr(), TAB_APPEND );
+ pTabControl->SetTabPage( id, new TabPage( pTabControl ) );
+ return id;
+}
+
+void SAL_CALL VCLXTabControl::removeTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException)
+{
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw IndexOutOfBoundsException();
+ pTabControl->RemovePage( sal::static_int_cast< USHORT >( ID ) );
+}
+
+void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException)
+{
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw IndexOutOfBoundsException();
+ pTabControl->SelectTabPage( sal::static_int_cast< USHORT >( ID ) );
+}
+
+sal_Int32 SAL_CALL VCLXTabControl::getActiveTabID() throw (uno::RuntimeException)
+{
+ return getTabControl()->GetCurPageId( );
+}
+
+void SAL_CALL VCLXTabControl::addTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
+{
+ for ( std::list< uno::Reference
+ < awt::XTabListener > >::const_iterator it
+ = mxTabListeners.begin(); it != mxTabListeners.end(); it++ )
+ {
+ if ( *it == xListener )
+ // already added
+ return;
+ }
+ mxTabListeners.push_back( xListener );
+}
+
+void SAL_CALL VCLXTabControl::removeTabListener( const uno::Reference< awt::XTabListener >& xListener ) throw (uno::RuntimeException)
+{
+ for ( std::list< uno::Reference
+ < awt::XTabListener > >::iterator it
+ = mxTabListeners.begin(); it != mxTabListeners.end(); it++ )
+ {
+ if ( *it == xListener )
+ {
+ mxTabListeners.erase( it );
+ break;
+ }
+ }
+}
+
+void SAL_CALL VCLXTabControl::setTabProps( sal_Int32 ID, const uno::Sequence< NamedValue >& Properties ) throw (uno::RuntimeException, IndexOutOfBoundsException)
+{
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw IndexOutOfBoundsException();
+
+ for ( int i = 0; i < Properties.getLength(); i++ )
+ {
+ const rtl::OUString &name = Properties[i].Name;
+ const uno::Any &value = Properties[i].Value;
+
+ if ( name == rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ) )
+ {
+ rtl::OUString title = value.get<rtl::OUString>();
+ pTabControl->SetPageText( sal::static_int_cast< USHORT >( ID ), title.getStr() );
+ }
+ }
+}
+
+uno::Sequence< NamedValue > SAL_CALL VCLXTabControl::getTabProps( sal_Int32 ID )
+ throw (IndexOutOfBoundsException, uno::RuntimeException)
+{
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( ID ) ) == NULL )
+ throw IndexOutOfBoundsException();
+
+#define ADD_PROP( seq, i, name, val ) { \
+ NamedValue value; \
+ value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
+ value.Value = uno::makeAny( val ); \
+ seq[i] = value; \
+ }
+
+ uno::Sequence< NamedValue > props( 2 );
+ ADD_PROP( props, 0, "Title", rtl::OUString( pTabControl->GetPageText( sal::static_int_cast< USHORT >( ID ) ) ) );
+ ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< USHORT >( ID ) ) );
+#undef ADD_PROP
+ return props;
+}
+
+// TODO: draw tab border here
+void SAL_CALL VCLXTabControl::draw( sal_Int32 nX, sal_Int32 nY ) throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TabControl *pTabControl = getTabControl();
+ TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< USHORT >( getActiveTabID() ) );
+ if ( pTabPage )
+ {
+ ::Point aPos( nX, nY );
+ ::Size aSize = pTabPage->GetSizePixel();
+
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ aPos = pDev->PixelToLogic( aPos );
+ aSize = pDev->PixelToLogic( aSize );
+
+ pTabPage->Draw( pDev, aPos, aSize, 0 );
+ }
+
+ VCLXWindow::draw( nX, nY );
+}
+
+void VCLXTabControl::AddChild (uno::Reference< awt::XLayoutConstrains > const& xChild)
+
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ());
+#endif
+ mIdMap[ xChild ] = mTabId++;
+ Box_Base::AddChild( xChild );
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: children: %d", __PRETTY_FUNCTION__, maChildren.size ());
+#endif
+}
+
+void SAL_CALL VCLXTabControl::addChild(
+ const uno::Reference< awt::XLayoutConstrains > &xChild )
+ throw (uno::RuntimeException, awt::MaxChildrenException)
+{
+ mIdMap[ xChild ] = insertTab();
+ Box_Base::addChild( xChild );
+}
+
+void SAL_CALL VCLXTabControl::removeChild( const uno::Reference< awt::XLayoutConstrains > &xChild )
+ throw (uno::RuntimeException)
+{
+ removeTab( mIdMap[xChild] );
+ mIdMap[ xChild ] = -1;
+ Box_Base::removeChild( xChild );
+}
+
+static void setChildrenVisible( uno::Reference < awt::XLayoutConstrains > xChild, bool visible )
+{
+ uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY);
+ if ( xWin.is() )
+ {
+ xWin->setVisible( visible );
+ }
+
+ uno::Reference < awt::XLayoutContainer > xCont( xChild, uno::UNO_QUERY );
+ if ( xCont.is())
+ {
+ uno::Sequence< uno::Reference < awt::XLayoutConstrains > > children = xCont->getChildren();
+ for ( int i = 0; i < children.getLength(); i++ )
+ {
+ setChildrenVisible( children[i], visible );
+ }
+ }
+}
+
+void SAL_CALL VCLXTabControl::allocateArea (awt::Rectangle const &area)
+ throw (uno::RuntimeException)
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
+#endif
+ maAllocation = area;
+
+ TabControl *pTabControl = getTabControl();
+
+// FIXME: this is wrong. We just want to set tab controls pos/size for
+// the tabs menu, otherwise, it gets events that should go to children
+// (I guess we could solve this by making the tabcontrol as the actual
+// XWindow parent of its children, when importing...) Not sure about
+// TabPage drawing... That doesn't work on gtk+; just ignoring that.
+// LATER: Nah, the proper fix is to get the XWindow hierarchy
+// straight.
+
+#if 0
+ setPosSize( area.X, area.Y, area.Width, area.Height, awt::PosSize::POSSIZE );
+#else
+ awt::Size currentSize = getSize();
+ awt::Size requestedSize (area.Width, area.Height);
+// requestedSize.Height = getHeightForWidth( area.Width );
+
+ awt::Size minimumSize = getMinimumSize();
+ if (requestedSize.Width < minimumSize.Width)
+ requestedSize.Width = minimumSize.Width;
+ if (requestedSize.Height < minimumSize.Height)
+ requestedSize.Height = minimumSize.Height;
+
+ Size pageSize = static_cast<TabControl*> (GetWindow ())->GetTabPageSizePixel ();
+ awt::Size pageBasedSize (0, 0);
+ pageBasedSize.Width = pageSize.Width ();
+ pageBasedSize.Height = pageSize.Height ();
+
+ const int wc = 0;
+ const int hc = 20;
+ static int pwc = 0;
+ static int phc = 40;
+
+ if (requestedSize.Width < pageBasedSize.Width)
+ requestedSize.Width = pageBasedSize.Width + wc;
+ if (requestedSize.Height < pageBasedSize.Height)
+ requestedSize.Height = pageBasedSize.Height + hc;
+
+ Size windowSize = GetWindow()->GetSizePixel();
+ Window *parent = GetWindow()->GetParent();
+ Size parentSize = parent->GetSizePixel();
+
+#ifndef __SUNPRO_CC
+#ifdef GCC_MAJOR
+ OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
+#endif /* GCC_MAJOR */
+ OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height );
+ OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height );
+ OSL_TRACE ("%s: minimum: %d, %d", __FUNCTION__, minimumSize.Width, minimumSize.Height );
+ OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
+ OSL_TRACE ("%s: pageBasedSize: %d, %d", __FUNCTION__, pageBasedSize.Width, pageBasedSize.Height );
+
+ //OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() );
+ //OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() );
+#endif
+
+ //bRealized = false;
+ if (!bRealized)
+ {
+ setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::POSSIZE );
+ bRealized = true;
+ }
+ else
+ {
+ if ( requestedSize.Width > currentSize.Width + 10)
+ setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH );
+ if ( requestedSize.Height > currentSize.Height + 10)
+ setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT );
+ }
+#endif
+
+ if (pageBasedSize.Width > parentSize.Width ()
+ || pageBasedSize.Height > parentSize.Height ())
+ //parent->SetSizePixel ( Size (pageBasedSize.Width, pageBasedSize.Height));
+ //parent->SetSizePixel ( Size (pageBasedSize.Width + pwc, pageBasedSize.Height + phc));
+ parent->SetSizePixel ( Size (requestedSize.Width + pwc, requestedSize.Height + phc));
+
+ // FIXME: we can save cycles by setting visibility more sensibly. Having
+ // it here does makes it easier when changing tabs (just needs a recalc())
+ unsigned i = 0;
+ for ( std::list<Box_Base::ChildData *>::const_iterator it
+ = maChildren.begin(); it != maChildren.end(); it++, i++ )
+ {
+ ChildData *child = static_cast<VCLXTabControl::ChildData*> ( *it );
+ uno::Reference
+ < awt::XLayoutConstrains > xChild( child->mxChild );
+ if ( xChild.is() )
+ {
+ uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY );
+ bool active = (i+1 == (unsigned) getActiveTabID());
+
+ // HACK: since our layout:: container don't implement XWindow, we have no easy
+ // way to set them invisible; lets just set all their children as such :P
+#if 0
+ if ( xWin.is() )
+ xWin->setVisible( active );
+#else
+ setChildrenVisible( xChild, active );
+#endif
+
+ if ( active )
+ {
+ ::Rectangle label_rect = pTabControl->GetTabBounds( sal::static_int_cast< USHORT >( i+1 ) );
+ ::Rectangle page_rect = pTabControl->GetTabPageBounds( sal::static_int_cast< USHORT >( i+1 ) );
+
+ awt::Rectangle childRect;
+ childRect.X = page_rect.Left();
+ childRect.Y = SAL_MAX( label_rect.Bottom(), page_rect.Top() );
+ childRect.Width = page_rect.Right() - page_rect.Left();
+ childRect.Height = page_rect.Bottom() - childRect.Y;
+
+ allocateChildAt( xChild, childRect );
+ }
+ }
+ }
+}
+
+awt::Size SAL_CALL VCLXTabControl::getMinimumSize()
+ throw(uno::RuntimeException)
+{
+ awt::Size requestedSize = VCLXWindow::getMinimumSize();
+ awt::Size childrenSize( 0, 0 );
+
+ TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
+ if ( !pTabControl )
+ return requestedSize;
+
+ // calculate size to accomodate all children
+ unsigned i = 0;
+ for ( std::list<Box_Base::ChildData *>::const_iterator it
+ = maChildren.begin(); it != maChildren.end(); it++, i++ )
+ {
+ ChildData *child = static_cast<VCLXTabControl::ChildData*> ( *it );
+ if ( child->mxChild.is() )
+ {
+ // set the title prop here...
+ pTabControl->SetPageText( sal::static_int_cast< USHORT >( i+1 ), child->maTitle.getStr() );
+
+ awt::Size childSize( child->mxChild->getMinimumSize() );
+ childrenSize.Width = SAL_MAX( childSize.Width, childrenSize.Width );
+ childrenSize.Height = SAL_MAX( childSize.Height, childrenSize.Height );
+ }
+ }
+
+#ifndef __SUNPRO_CC
+#ifdef GCC_MAJOR
+ OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
+#endif /* GCC_MAJOR */
+ OSL_TRACE ("%s: children: %d", __FUNCTION__, i);
+ OSL_TRACE ("%s: childrenSize: %d, %d", __FUNCTION__, childrenSize.Width, childrenSize.Height );
+#endif
+
+ requestedSize.Width += childrenSize.Width;
+ requestedSize.Height += childrenSize.Height + 20;
+
+ maRequisition = requestedSize;
+ return requestedSize;
+}
+
+void VCLXTabControl::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
+ if ( !pTabControl )
+ return;
+
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABPAGE_ACTIVATE:
+ forceRecalc();
+ case VCLEVENT_TABPAGE_DEACTIVATE:
+ case VCLEVENT_TABPAGE_INSERTED:
+ case VCLEVENT_TABPAGE_REMOVED:
+ case VCLEVENT_TABPAGE_REMOVEDALL:
+ case VCLEVENT_TABPAGE_PAGETEXTCHANGED:
+ {
+ ULONG page = (ULONG) _rVclWindowEvent.GetData();
+ for ( std::list< uno::Reference
+ < awt::XTabListener > >::iterator it
+ = mxTabListeners.begin(); it != mxTabListeners.end(); it++)
+ {
+ uno::Reference
+ < awt::XTabListener > listener = *it;
+
+ switch ( _rVclWindowEvent.GetId() )
+ {
+
+ case VCLEVENT_TABPAGE_ACTIVATE:
+ listener->activated( page );
+ break;
+ case VCLEVENT_TABPAGE_DEACTIVATE:
+ listener->deactivated( page );
+ break;
+ case VCLEVENT_TABPAGE_INSERTED:
+ listener->inserted( page );
+ break;
+ case VCLEVENT_TABPAGE_REMOVED:
+ listener->removed( page );
+ break;
+ case VCLEVENT_TABPAGE_REMOVEDALL:
+ for ( int i = 1; i < mTabId; i++)
+ {
+ if ( pTabControl->GetTabPage( sal::static_int_cast< USHORT >( i ) ) )
+ listener->removed( i );
+ }
+ break;
+ case VCLEVENT_TABPAGE_PAGETEXTCHANGED:
+ listener->changed( page, getTabProps( page ) );
+ break;
+ }
+ }
+ break;
+ }
+ default:
+ aGuard.clear();
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ break;
+ }
+}
+
+void SAL_CALL VCLXTabControl::setProperty( const ::rtl::OUString& PropertyName, const uno::Any &Value ) throw(uno::RuntimeException)
+{
+ VCLXWindow::setProperty( PropertyName, Value );
+}
+
+uno::Any SAL_CALL VCLXTabControl::getProperty( const ::rtl::OUString& PropertyName ) throw(uno::RuntimeException)
+{
+ return VCLXWindow::getProperty( PropertyName );
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxtabcontrol.hxx b/toolkit/source/awt/vclxtabcontrol.hxx
new file mode 100644
index 000000000000..8f5debf2626c
--- /dev/null
+++ b/toolkit/source/awt/vclxtabcontrol.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 LAYOUT_AWT_VCLXTABCONTROLLER_HXX
+#define LAYOUT_AWT_VCLXTABCONTROLLER_HXX
+
+#include <com/sun/star/awt/XSimpleTabController.hpp>
+#include <comphelper/uno3.hxx>
+#include <layout/core/box-base.hxx>
+#include <map>
+#include <toolkit/awt/vclxwindow.hxx>
+
+class TabControl;
+
+namespace layoutimpl
+{
+
+typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::XSimpleTabController
+ > VCLXTabControl_Base;
+
+class VCLXTabControl :public VCLXWindow
+ ,public VCLXTabControl_Base
+ ,public Box_Base
+{
+ int mTabId;
+ bool bRealized;
+
+public:
+ VCLXTabControl();
+
+ void AddChild (css::uno::Reference <css::awt::XLayoutConstrains> const &);
+
+protected:
+ ~VCLXTabControl();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // XComponent
+ void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSimpleTabController
+ virtual ::sal_Int32 SAL_CALL insertTab() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Properties ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL activateTab( ::sal_Int32 ID ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getActiveTabID() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutContainer
+ virtual void SAL_CALL addChild(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child )
+ throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::awt::MaxChildrenException);
+ virtual void SAL_CALL removeChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >& Child )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL allocateArea( const ::com::sun::star::awt::Rectangle &rArea )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::awt::Size SAL_CALL getMinimumSize()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // unimplemented:
+ virtual sal_Bool SAL_CALL hasHeightForWidth()
+ throw(css::uno::RuntimeException)
+ { return false; }
+ virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ )
+ throw(css::uno::RuntimeException)
+ { return maRequisition.Height; }
+
+ // VclWindowPeer
+ virtual void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent );
+
+public:
+ // Maps page ids to child references
+ struct ChildData : public Box_Base::ChildData
+ {
+ rtl::OUString maTitle;
+ ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ };
+
+ struct ChildProps : public Box_Base::ChildProps
+ {
+ ChildProps( VCLXTabControl::ChildData *pData );
+ };
+
+protected:
+ ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ ChildProps *createChildProps( Box_Base::ChildData* pData );
+
+
+ std::map< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains >, sal_Int32 > mIdMap;
+ // FIXME: we might want to use a Multiplexer
+ std::list< ::com::sun::star::uno::Reference
+ < ::com::sun::star::awt::XTabListener > > mxTabListeners;
+
+ inline TabControl *getTabControl() const throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ VCLXTabControl( const VCLXTabControl& ); // never implemented
+ VCLXTabControl& operator=( const VCLXTabControl& ); // never implemented
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_AWT_VCLXTABCONTROLLER_HXX */
diff --git a/toolkit/source/awt/vclxtabpage.cxx b/toolkit/source/awt/vclxtabpage.cxx
new file mode 100644
index 000000000000..6523f7e98c5f
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpage.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "vclxtabpage.hxx"
+#include "forward.hxx"
+
+#include <com/sun/star/awt/PosSize.hpp>
+#include <toolkit/helper/convert.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+
+#if !defined (__GNUC__)
+#define __PRETTY_FUNCTION__ __FUNCTION__
+#endif /* !__GNUC__ */
+
+namespace layoutimpl
+{
+
+using namespace ::com::sun::star;
+
+// XInterface
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXTabPage, VCLXWindow, Bin );
+
+// XTypeProvider
+IMPLEMENT_FORWARD_XTYPEPROVIDER1( VCLXTabPage, VCLXWindow );
+
+VCLXTabPage::VCLXTabPage( Window *p )
+ : VCLXWindow()
+ , Bin()
+ , bRealized( false )
+{
+ /* FIXME: before Window is set, setLabel, setProperty->setImage
+ * are silent no-ops. */
+ p->SetComponentInterface( this );
+}
+
+VCLXTabPage::~VCLXTabPage()
+{
+}
+
+void SAL_CALL VCLXTabPage::dispose() throw(uno::RuntimeException)
+{
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ lang::EventObject aDisposeEvent;
+ aDisposeEvent.Source = W3K_EXPLICIT_CAST (*this);
+ }
+
+ VCLXWindow::dispose();
+}
+
+void SAL_CALL VCLXTabPage::allocateArea( awt::Rectangle const& area )
+ throw (uno::RuntimeException)
+{
+ awt::Size currentSize = getSize();
+ awt::Size requestedSize = getMinimumSize();
+ requestedSize.Height = getHeightForWidth( area.Width );
+
+ if ( currentSize.Width > 0 && currentSize.Height > 0
+ && requestedSize.Width > currentSize.Width )
+ requestedSize.Width = currentSize.Width;
+ if ( currentSize.Width > 0 && currentSize.Height > 0
+ && requestedSize.Height > currentSize.Height )
+ requestedSize.Height = currentSize.Height;
+
+ // FIXME: missing destructor?
+ if ( !GetWindow() )
+ return;
+
+ Size windowSize = GetWindow()->GetSizePixel();
+ Window *parent = GetWindow()->GetParent();
+ Size parentSize = parent->GetSizePixel();
+
+ Point pos = GetWindow()->GetPosPixel();
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("\n%s", __PRETTY_FUNCTION__);
+ OSL_TRACE ("%s: curpos: %d ,%d", __FUNCTION__, pos.X(), pos.Y() );
+
+ OSL_TRACE ("%s: cursize: %d ,%d", __FUNCTION__, currentSize.Width, currentSize.Height );
+ OSL_TRACE ("%s: area: %d, %d", __FUNCTION__, area.Width, area.Height );
+ OSL_TRACE ("%s: requestedSize: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
+ OSL_TRACE ("%s: parent: %d, %d", __FUNCTION__, parentSize.Width(), parentSize.Height() );
+ OSL_TRACE ("%s: window: %d, %d", __FUNCTION__, windowSize.Width(), windowSize.Height() );
+#endif
+
+#if 0
+ if (requestedSize.Width > parentSize.Width ()
+ || requestedSize.Height > parentSize.Height ())
+ {
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: ***setting parent: %d, %d", __FUNCTION__, requestedSize.Width, requestedSize.Height );
+#endif
+ parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) );
+
+ if (Window *grand_parent = parent->GetParent ())
+ grand_parent->SetSizePixel ( Size (requestedSize.Width, requestedSize.Height) );
+ }
+#endif
+
+ if ( !bRealized )
+ {
+ setPosSize( area.X, area.Y, requestedSize.Width, requestedSize.Height, awt::PosSize::SIZE );
+ bRealized = true;
+ }
+ else
+ {
+ if ( requestedSize.Width > currentSize.Width + 10)
+ setPosSize( 0, 0, requestedSize.Width, 0, awt::PosSize::WIDTH );
+ if ( requestedSize.Height > currentSize.Height + 10)
+ setPosSize( 0, 0, 0, requestedSize.Height, awt::PosSize::HEIGHT );
+ }
+
+ awt::Size newSize = getSize();
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: newSize: %d, %d", __FUNCTION__, newSize.Width, newSize.Height );
+#endif
+ maAllocation.Width = newSize.Width;
+ maAllocation.Height = newSize.Height;
+
+ Bin::allocateArea( maAllocation );
+}
+
+awt::Size SAL_CALL VCLXTabPage::getMinimumSize()
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ return Bin::getMinimumSize();
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/awt/vclxtabpage.hxx b/toolkit/source/awt/vclxtabpage.hxx
new file mode 100644
index 000000000000..215ee49c5716
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpage.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 LAYOUT_AWT_VCLXTABPAGE_HXX
+#define LAYOUT_AWT_VCLXTABPAGE_HXX
+
+#include <toolkit/awt/vclxwindow.hxx>
+#include <layout/core/bin.hxx>
+#include <comphelper/uno3.hxx>
+
+namespace layoutimpl
+{
+
+namespace css = ::com::sun::star;
+
+class VCLXTabPage : public VCLXWindow
+ , public Bin
+{
+ bool bRealized;
+
+public:
+ VCLXTabPage( Window *p );
+
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+protected:
+ ~VCLXTabPage();
+
+ // XComponent
+ void SAL_CALL dispose() throw(css::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XLayoutContainer
+ virtual void SAL_CALL allocateArea( css::awt::Rectangle const& rArea )
+ throw (css::uno::RuntimeException);
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException);
+
+private:
+ VCLXTabPage( VCLXTabPage const & );
+ VCLXTabPage& operator=( VCLXTabPage const & );
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_AWT_VCLXTABPAGE_HXX */
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
new file mode 100644
index 000000000000..2eeafa73d2d2
--- /dev/null
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -0,0 +1,1697 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#ifndef _SVWIN_HXX
+#include <tools/svwin.h>
+#endif
+#include <stdio.h>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#include <com/sun/star/awt/WindowClass.hpp>
+#include <com/sun/star/awt/MessageBoxButtons.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/SystemDependent.hpp>
+#include <com/sun/star/awt/FocusEvent.hpp>
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <osl/conditn.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <rtl/process.h>
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include <windows.h>
+#include <tools/postwin.h>
+#elif (defined QUARTZ)
+#include "premac.h"
+#include <Cocoa/Cocoa.h>
+#include "postmac.h"
+#endif
+#include <vcl/sysdata.hxx>
+
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/awt/vclxsystemdependentwindow.hxx>
+#include <toolkit/awt/vclxregion.hxx>
+#include <toolkit/awt/vclxtoolkit.hxx>
+
+#include <toolkit/awt/xsimpleanimation.hxx>
+#include <toolkit/awt/xthrobber.hxx>
+#include <toolkit/awt/vclxtopwindow.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/unowrapper.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <vcl/unohelp.hxx>
+#include <vcl/btndlg.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/combobox.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/dockingarea.hxx>
+#include <vcl/dockwin.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/floatwin.hxx>
+#include <vcl/group.hxx>
+#include <vcl/imgctrl.hxx>
+#include <vcl/longcurr.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/menubtn.hxx>
+#include <vcl/morebtn.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/spin.hxx>
+#include <vcl/split.hxx>
+#include <vcl/splitwin.hxx>
+#include <vcl/status.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/syschild.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabdlg.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/virdev.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wrkwin.hxx>
+#include "toolkit/awt/vclxspinbutton.hxx"
+
+#include <tools/debug.hxx>
+#include <comphelper/processfactory.hxx>
+
+namespace css = ::com::sun::star;
+
+#define VCLWINDOW_FRAMEWINDOW 0x1000
+#define VCLWINDOW_SYSTEMCHILDWINDOW 0x1001
+
+#if (defined WNT)
+#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32
+#elif (defined OS2)
+#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_OS2
+#elif (defined QUARTZ)
+#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_MAC
+#elif (defined UNX)
+#define SYSTEM_DEPENDENT_TYPE ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW
+#endif
+
+TOOLKIT_DLLPUBLIC WinBits ImplGetWinBits( sal_uInt32 nComponentAttribs, sal_uInt16 nCompType )
+{
+ WinBits nWinBits = 0;
+
+ sal_Bool bMessBox = sal_False;
+ if ( ( nCompType == WINDOW_INFOBOX ) ||
+ ( nCompType == WINDOW_MESSBOX ) ||
+ ( nCompType == WINDOW_QUERYBOX ) ||
+ ( nCompType == WINDOW_WARNINGBOX ) ||
+ ( nCompType == WINDOW_ERRORBOX ) )
+ {
+ bMessBox = sal_True;
+ }
+
+ bool bDecoratedWindow = false;
+ if ( bMessBox
+ || ( nCompType == WINDOW_DIALOG )
+ || ( nCompType == WINDOW_MODELESSDIALOG )
+ || ( nCompType == WINDOW_MODALDIALOG )
+ || ( nCompType == WINDOW_SYSTEMDIALOG )
+ || ( nCompType == WINDOW_PATHDIALOG )
+ || ( nCompType == WINDOW_FILEDIALOG )
+ || ( nCompType == WINDOW_PRINTERSETUPDIALOG )
+ || ( nCompType == WINDOW_PRINTDIALOG )
+ || ( nCompType == WINDOW_COLORDIALOG )
+ || ( nCompType == WINDOW_FONTDIALOG )
+ || ( nCompType == WINDOW_DOCKINGWINDOW )
+ || ( nCompType == WINDOW_TABDIALOG )
+ || ( nCompType == WINDOW_BUTTONDIALOG )
+ || ( nCompType == WINDOW_SYSTEMCHILDWINDOW )
+ )
+ {
+ bDecoratedWindow = true;
+ }
+
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::BORDER )
+ nWinBits |= WB_BORDER;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOBORDER )
+ nWinBits |= WB_NOBORDER;
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::SIZEABLE )
+ nWinBits |= WB_SIZEABLE;
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::MOVEABLE )
+ nWinBits |= WB_MOVEABLE;
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::CLOSEABLE )
+ nWinBits |= WB_CLOSEABLE;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::HSCROLL )
+ nWinBits |= WB_HSCROLL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::VSCROLL )
+ nWinBits |= WB_VSCROLL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::LEFT )
+ nWinBits |= WB_LEFT;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CENTER )
+ nWinBits |= WB_CENTER;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RIGHT )
+ nWinBits |= WB_RIGHT;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SPIN )
+ nWinBits |= WB_SPIN;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::SORT )
+ nWinBits |= WB_SORT;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DROPDOWN )
+ nWinBits |= WB_DROPDOWN;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEFBUTTON )
+ nWinBits |= WB_DEFBUTTON;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::READONLY )
+ nWinBits |= WB_READONLY;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::CLIPCHILDREN )
+ nWinBits |= WB_CLIPCHILDREN;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::GROUP )
+ nWinBits |= WB_GROUP;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::NOLABEL ) //added for issue79712
+ nWinBits |= WB_NOLABEL;
+
+ // These bits are not uniqe
+ if ( bMessBox )
+ {
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK )
+ nWinBits |= WB_OK;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::OK_CANCEL )
+ nWinBits |= WB_OK_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO )
+ nWinBits |= WB_YES_NO;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::YES_NO_CANCEL )
+ nWinBits |= WB_YES_NO_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::RETRY_CANCEL )
+ nWinBits |= WB_RETRY_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_OK )
+ nWinBits |= WB_DEF_OK;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_CANCEL )
+ nWinBits |= WB_DEF_CANCEL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_RETRY )
+ nWinBits |= WB_DEF_RETRY;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_YES )
+ nWinBits |= WB_DEF_YES;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::DEF_NO )
+ nWinBits |= WB_DEF_NO;
+ }
+ if ( nCompType == WINDOW_MULTILINEEDIT )
+ {
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOHSCROLL )
+ nWinBits |= WB_AUTOHSCROLL;
+ if( nComponentAttribs & ::com::sun::star::awt::VclWindowPeerAttribute::AUTOVSCROLL )
+ nWinBits |= WB_AUTOVSCROLL;
+ }
+
+
+ if ( bDecoratedWindow )
+ {
+ if( nComponentAttribs & ::com::sun::star::awt::WindowAttribute::NODECORATION )
+ {
+ // No decoration removes several window attributes and must
+ // set WB_NOBORDER!
+ nWinBits &= ~WB_BORDER;
+ nWinBits &= ~WB_SIZEABLE;
+ nWinBits &= ~WB_MOVEABLE;
+ nWinBits &= ~WB_CLOSEABLE;
+ nWinBits |= WB_NOBORDER;
+ }
+ }
+
+ return nWinBits;
+}
+
+struct ComponentInfo
+{
+ const char* pName;
+ WindowType nWinType;
+};
+
+static ComponentInfo __FAR_DATA aComponentInfos [] =
+{
+ { "buttondialog", WINDOW_BUTTONDIALOG },
+ { "cancelbutton", WINDOW_CANCELBUTTON },
+ { "checkbox", WINDOW_CHECKBOX },
+ { "combobox", WINDOW_COMBOBOX },
+ { "control", WINDOW_CONTROL },
+ { "currencybox", WINDOW_CURRENCYBOX },
+ { "currencyfield", WINDOW_CURRENCYFIELD },
+ { "datebox", WINDOW_DATEBOX },
+ { "datefield", WINDOW_DATEFIELD },
+ { "dialog", WINDOW_DIALOG },
+ { "dockingarea", WINDOW_DOCKINGAREA },
+ { "dockingwindow", WINDOW_DOCKINGWINDOW },
+ { "edit", WINDOW_EDIT },
+ { "errorbox", WINDOW_ERRORBOX },
+ { "fixedbitmap", WINDOW_FIXEDBITMAP },
+ { "fixedimage", WINDOW_FIXEDIMAGE },
+ { "fixedline", WINDOW_FIXEDLINE },
+ { "fixedtext", WINDOW_FIXEDTEXT },
+ { "floatingwindow", WINDOW_FLOATINGWINDOW },
+ { "framewindow", VCLWINDOW_FRAMEWINDOW },
+ { "groupbox", WINDOW_GROUPBOX },
+ { "helpbutton", WINDOW_HELPBUTTON },
+ { "imagebutton", WINDOW_IMAGEBUTTON },
+ { "imageradiobutton", WINDOW_IMAGERADIOBUTTON },
+ { "infobox", WINDOW_INFOBOX },
+ { "listbox", WINDOW_LISTBOX },
+ { "longcurrencybox", WINDOW_LONGCURRENCYBOX },
+ { "longcurrencyfield", WINDOW_LONGCURRENCYFIELD },
+ { "menubutton", WINDOW_MENUBUTTON },
+ { "messbox", WINDOW_MESSBOX },
+ { "metricbox", WINDOW_METRICBOX },
+ { "metricfield", WINDOW_METRICFIELD },
+ { "modaldialog", WINDOW_MODALDIALOG },
+ { "modelessdialog", WINDOW_MODELESSDIALOG },
+ { "morebutton", WINDOW_MOREBUTTON },
+ { "multilineedit", WINDOW_MULTILINEEDIT },
+ { "multilistbox", WINDOW_MULTILISTBOX },
+ { "numericbox", WINDOW_NUMERICBOX },
+ { "numericfield", WINDOW_NUMERICFIELD },
+ { "okbutton", WINDOW_OKBUTTON },
+ { "patternbox", WINDOW_PATTERNBOX },
+ { "patternfield", WINDOW_PATTERNFIELD },
+ { "pushbutton", WINDOW_PUSHBUTTON },
+ { "querybox", WINDOW_QUERYBOX },
+ { "radiobutton", WINDOW_RADIOBUTTON },
+ { "scrollbar", WINDOW_SCROLLBAR },
+ { "scrollbarbox", WINDOW_SCROLLBARBOX },
+ { "simpleanimation", WINDOW_CONTROL },
+ { "spinbutton", WINDOW_SPINBUTTON },
+ { "spinfield", WINDOW_SPINFIELD },
+ { "throbber", WINDOW_CONTROL },
+ { "splitter", WINDOW_SPLITTER },
+ { "splitwindow", WINDOW_SPLITWINDOW },
+ { "statusbar", WINDOW_STATUSBAR },
+ { "systemchildwindow", VCLWINDOW_SYSTEMCHILDWINDOW },
+ { "tabcontrol", WINDOW_TABCONTROL },
+ { "tabdialog", WINDOW_TABDIALOG },
+ { "tabpage", WINDOW_TABPAGE },
+ { "timebox", WINDOW_TIMEBOX },
+ { "timefield", WINDOW_TIMEFIELD },
+ { "toolbox", WINDOW_TOOLBOX },
+ { "tristatebox", WINDOW_TRISTATEBOX },
+ { "warningbox", WINDOW_WARNINGBOX },
+ { "window", WINDOW_WINDOW },
+ { "workwindow", WINDOW_WORKWINDOW }
+};
+
+extern "C"
+{
+static int
+#if defined( WNT )
+ __cdecl
+#endif
+#if defined( ICC ) && defined( OS2 )
+_Optlink
+#endif
+ ComponentInfoCompare( const void* pFirst, const void* pSecond)
+{
+ return( strcmp( ((ComponentInfo*)pFirst)->pName,
+ ((ComponentInfo*)pSecond)->pName ) );
+}
+}
+
+sal_uInt16 ImplGetComponentType( const String& rServiceName )
+{
+ static sal_Bool bSorted = sal_False;
+ if( !bSorted )
+ {
+ qsort( (void*) aComponentInfos,
+ sizeof( aComponentInfos ) / sizeof( ComponentInfo ),
+ sizeof( ComponentInfo ),
+ ComponentInfoCompare );
+ bSorted = sal_True;
+ }
+
+
+ ComponentInfo aSearch;
+ ByteString aServiceName( rServiceName, gsl_getSystemTextEncoding() );
+ aServiceName.ToLowerAscii();
+ if ( aServiceName.Len() )
+ aSearch.pName = aServiceName.GetBuffer();
+ else
+ aSearch.pName = "window";
+
+ ComponentInfo* pInf = (ComponentInfo*) bsearch( &aSearch,
+ (void*) aComponentInfos,
+ sizeof( aComponentInfos ) / sizeof( ComponentInfo ),
+ sizeof( ComponentInfo ),
+ ComponentInfoCompare );
+
+ return pInf ? pInf->nWinType : 0;
+}
+
+
+// ----------------------------------------------------
+// class VCLXToolkit
+// ----------------------------------------------------
+
+static sal_Int32 nVCLToolkitInstanceCount = 0;
+static BOOL bInitedByVCLToolkit = sal_False;
+//static cppu::OInterfaceContainerHelper * pToolkits = 0;
+
+static osl::Mutex & getInitMutex()
+{
+ static osl::Mutex * pM;
+ if( !pM )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pM )
+ {
+ static osl::Mutex aMutex;
+ pM = &aMutex;
+ }
+ }
+ return *pM;
+}
+
+static osl::Condition & getInitCondition()
+{
+ static osl::Condition * pC = 0;
+ if( !pC )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pC )
+ {
+ static osl::Condition aCondition;
+ pC = &aCondition;
+ }
+ }
+ return *pC;
+}
+
+struct ToolkitThreadData
+{
+ VCLXToolkit * pTk;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
+
+ ToolkitThreadData( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr, VCLXToolkit * pTk_ )
+ : pTk( pTk_ )
+ , xSMgr( rSMgr )
+ {
+ }
+};
+
+extern "C"
+{
+static void SAL_CALL ToolkitWorkerFunction( void* pArgs )
+{
+ ToolkitThreadData * pTTD = (ToolkitThreadData *)pArgs;
+ bInitedByVCLToolkit = InitVCL( pTTD->xSMgr );
+ if( bInitedByVCLToolkit )
+ {
+ UnoWrapper* pUnoWrapper = new UnoWrapper( pTTD->pTk );
+ Application::SetUnoWrapper( pUnoWrapper );
+ }
+ getInitCondition().set();
+ if( bInitedByVCLToolkit )
+ {
+ {
+ osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() );
+ Application::Execute();
+ }
+ try
+ {
+ pTTD->pTk->dispose();
+ }
+ catch( com::sun::star::uno::Exception & )
+ {
+ }
+ /*
+ if( pToolkits )
+ {
+ cppu::OInterfaceIteratorHelper aIt( *pToolkits );
+ ::com::sun::star::uno::XInterface * pI;
+ while( pI = aIt.next() )
+ ((::com::sun::star::lang::XComponent *)pI)->dispose();
+
+ // delete toolkit container
+ osl::Guard< osl::Mutex > aGuard( getInitMutex() );
+ delete pToolkits;
+ pToolkits = 0;
+ }
+ */
+ DeInitVCL();
+ }
+ else
+ {
+ JoinMainLoopThread();
+ }
+ delete pTTD;
+}
+}
+
+// contructor, which might initialize VCL
+VCLXToolkit::VCLXToolkit( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ):
+ cppu::WeakComponentImplHelper7<
+ ::com::sun::star::awt::XToolkit,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::awt::XSystemChildFactory,
+ ::com::sun::star::awt::XMessageBoxFactory,
+ ::com::sun::star::awt::XDataTransferProviderAccess,
+ ::com::sun::star::awt::XExtendedToolkit,
+ ::com::sun::star::awt::XReschedule>( GetMutex() ),
+ m_aTopWindowListeners(rBHelper.rMutex),
+ m_aKeyHandlers(rBHelper.rMutex),
+ m_aFocusListeners(rBHelper.rMutex),
+ m_aEventListenerLink(LINK(this, VCLXToolkit, eventListenerHandler)),
+ m_aKeyListenerLink(LINK(this, VCLXToolkit, keyListenerHandler)),
+ m_bEventListener(false),
+ m_bKeyListener(false)
+{
+ hSvToolsLib = NULL;
+ fnSvtCreateWindow = NULL;
+
+ osl::Guard< osl::Mutex > aGuard( getInitMutex() );
+ nVCLToolkitInstanceCount++;
+ if( ( nVCLToolkitInstanceCount == 1 ) && ( !Application::IsInMain() ) )
+ {
+ // setup execute thread
+ CreateMainLoopThread( ToolkitWorkerFunction, new ToolkitThreadData( rSMgr, this ) );
+ getInitCondition().wait();
+ /*
+ if( bInitedByVCLToolkit )
+ {
+ // insert in disposing list
+ if( !pToolkits )
+ pToolkits = new cppu::OInterfaceContainerHelper( getInitMutex() );
+ pToolkits->addInterface( (::com::sun::star::lang::XComponent *)this );
+ }
+ */
+ }
+}
+
+VCLXToolkit::~VCLXToolkit()
+{
+}
+
+
+void SAL_CALL VCLXToolkit::disposing()
+{
+ if ( hSvToolsLib )
+ {
+ osl_unloadModule( hSvToolsLib );
+ hSvToolsLib = NULL;
+ fnSvtCreateWindow = NULL;
+ }
+
+ {
+ osl::Guard< osl::Mutex > aGuard( getInitMutex() );
+ if( --nVCLToolkitInstanceCount == 0 )
+ {
+ if( bInitedByVCLToolkit )
+ {
+ Application::Quit();
+ JoinMainLoopThread();
+ bInitedByVCLToolkit = sal_False;
+ }
+ }
+ }
+
+ if (m_bEventListener)
+ {
+ ::Application::RemoveEventListener(m_aEventListenerLink);
+ m_bEventListener = false;
+ }
+ if (m_bKeyListener)
+ {
+ ::Application::RemoveKeyListener(m_aKeyListenerLink);
+ m_bKeyListener = false;
+ }
+ ::css::lang::EventObject aEvent(
+ static_cast< ::cppu::OWeakObject * >(this));
+ m_aTopWindowListeners.disposeAndClear(aEvent);
+ m_aKeyHandlers.disposeAndClear(aEvent);
+ m_aFocusListeners.disposeAndClear(aEvent);
+
+/*
+ osl::Guard< osl::Mutex > aGuard( getInitMutex() );
+ // insert in disposing list
+ if( pToolkits )
+ {
+ // remove from the disposing list
+ pToolkits->removeInterface( (::com::sun::star::lang::XComponent *)this );
+ }
+*/
+}
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::getDesktopWindow( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef;
+ // 07/00: AppWindow doesn't exist anymore...
+ return xRef;
+}
+
+::com::sun::star::awt::Rectangle VCLXToolkit::getWorkArea( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::Rectangle aRect;
+ // 07/00: AppWindow doesn't exist anymore...
+ return aRect;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createWindow( const ::com::sun::star::awt::WindowDescriptor& rDescriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ return ImplCreateWindow( rDescriptor, WinBits(0) );
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > VCLXToolkit::createScreenCompatibleDevice( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice > xRef;
+ VCLXVirtualDevice* pVDev = new VCLXVirtualDevice;
+
+ osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
+
+ VirtualDevice* pV = new VirtualDevice;
+ pV->SetOutputSizePixel( Size( Width, Height ) );
+ pVDev->SetVirtualDevice( pV );
+
+ xRef = pVDev;
+ return xRef;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > VCLXToolkit::createRegion( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion > xRef = new VCLXRegion;
+ return xRef;
+}
+
+Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
+ const ::com::sun::star::awt::WindowDescriptor& rDescriptor,
+ Window* pParent, WinBits nWinBits )
+{
+ String aServiceName( rDescriptor.WindowServiceName );
+ aServiceName.ToLowerAscii();
+
+ Window* pNewWindow = NULL;
+ sal_uInt16 nType = ImplGetComponentType( aServiceName );
+
+ if ( !pParent )
+ {
+ // Wenn die Component einen Parent braucht, dann NULL zurueckgeben,
+ // spaeter mal ::com::sun::star::uno::Exception...
+ sal_Bool bException = sal_True;
+ if ( ( nType == WINDOW_DIALOG ) || ( nType == WINDOW_MODALDIALOG ) || ( nType == WINDOW_MODELESSDIALOG ) )
+ bException = sal_False;
+ else if ( ( nType == WINDOW_WINDOW ) ||
+ ( nType == WINDOW_WORKWINDOW ) ||
+ ( nType == VCLWINDOW_FRAMEWINDOW ) )
+ {
+ if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
+ bException = sal_False;
+ }
+
+ if ( bException )
+ {
+ *ppNewComp = NULL;
+ return NULL;
+ }
+ }
+
+ if ( nType )
+ {
+ NAMESPACE_VOS(OGuard) aVclGuard( Application::GetSolarMutex() );
+ switch ( (WindowType)nType )
+ {
+ case WINDOW_CANCELBUTTON:
+ pNewWindow = new CancelButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_CHECKBOX:
+ pNewWindow = new CheckBox( pParent, nWinBits );
+ *ppNewComp = new VCLXCheckBox;
+ break;
+ case WINDOW_COMBOBOX:
+ pNewWindow = new ComboBox( pParent, nWinBits|WB_AUTOHSCROLL );
+ ((ComboBox*)pNewWindow)->EnableAutoSize( sal_False );
+ *ppNewComp = new VCLXComboBox;
+ break;
+ case WINDOW_CURRENCYBOX:
+ pNewWindow = new CurrencyBox( pParent, nWinBits );
+ break;
+ case WINDOW_CURRENCYFIELD:
+ pNewWindow = new CurrencyField( pParent, nWinBits );
+ static_cast<CurrencyField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXNumericField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(CurrencyField*)pNewWindow );
+ break;
+ case WINDOW_DATEBOX:
+ pNewWindow = new DateBox( pParent, nWinBits );
+ break;
+ case WINDOW_DATEFIELD:
+ pNewWindow = new DateField( pParent, nWinBits );
+ static_cast<DateField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXDateField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(DateField*)pNewWindow );
+ break;
+ case WINDOW_DOCKINGAREA:
+ pNewWindow = new DockingAreaWindow( pParent );
+ break;
+ case WINDOW_MULTILINEEDIT:
+ case WINDOW_EDIT:
+ pNewWindow = new Edit( pParent, nWinBits );
+ *ppNewComp = new VCLXEdit;
+ break;
+ case WINDOW_ERRORBOX:
+ pNewWindow = new ErrorBox( pParent, nWinBits, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_FIXEDBITMAP:
+ pNewWindow = new FixedBitmap( pParent, nWinBits );
+ break;
+ case WINDOW_FIXEDIMAGE:
+ pNewWindow = new ImageControl( pParent, nWinBits );
+ *ppNewComp = new VCLXImageControl;
+ break;
+ case WINDOW_FIXEDLINE:
+ pNewWindow = new FixedLine( pParent, nWinBits );
+ break;
+ case WINDOW_FIXEDTEXT:
+ pNewWindow = new FixedText( pParent, nWinBits );
+ *ppNewComp = new VCLXFixedText;
+ break;
+ case WINDOW_FLOATINGWINDOW:
+ pNewWindow = new FloatingWindow( pParent, nWinBits );
+ break;
+ case WINDOW_GROUPBOX:
+ pNewWindow = new GroupBox( pParent, nWinBits );
+ break;
+ case WINDOW_HELPBUTTON:
+ pNewWindow = new HelpButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_IMAGEBUTTON:
+ pNewWindow = new ImageButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_IMAGERADIOBUTTON:
+ pNewWindow = new ImageRadioButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_INFOBOX:
+ pNewWindow = new InfoBox( pParent, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_LISTBOX:
+ pNewWindow = new ListBox( pParent, nWinBits|WB_SIMPLEMODE|WB_AUTOHSCROLL );
+ ((ListBox*)pNewWindow)->EnableAutoSize( sal_False );
+ *ppNewComp = new VCLXListBox;
+ break;
+ case WINDOW_LONGCURRENCYBOX:
+ pNewWindow = new LongCurrencyBox( pParent, nWinBits );
+ break;
+ case WINDOW_LONGCURRENCYFIELD:
+ pNewWindow = new LongCurrencyField( pParent, nWinBits );
+ *ppNewComp = new VCLXCurrencyField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(LongCurrencyField*)pNewWindow );
+ break;
+ case WINDOW_MENUBUTTON:
+ pNewWindow = new MenuButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_MESSBOX:
+ pNewWindow = new MessBox( pParent, nWinBits, String(), String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_METRICBOX:
+ pNewWindow = new MetricBox( pParent, nWinBits );
+ break;
+ case WINDOW_METRICFIELD:
+ pNewWindow = new MetricField( pParent, nWinBits );
+ *ppNewComp = new VCLXMetricField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(MetricField*)pNewWindow );
+ break;
+ case WINDOW_DIALOG:
+ case WINDOW_MODALDIALOG:
+ case WINDOW_MODELESSDIALOG:
+ {
+ // Modal/Modeless nur durch Show/Execute
+ if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) )
+ pParent = DIALOG_NO_PARENT;
+ pNewWindow = new Dialog( pParent, nWinBits );
+ *ppNewComp = new VCLXDialog;
+ }
+ break;
+ case WINDOW_MOREBUTTON:
+ pNewWindow = new MoreButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_MULTILISTBOX:
+ pNewWindow = new MultiListBox( pParent, nWinBits );
+ *ppNewComp = new VCLXListBox;
+ break;
+ case WINDOW_NUMERICBOX:
+ pNewWindow = new NumericBox( pParent, nWinBits );
+ break;
+ case WINDOW_NUMERICFIELD:
+ pNewWindow = new NumericField( pParent, nWinBits );
+ static_cast<NumericField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXNumericField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(NumericField*)pNewWindow );
+ break;
+ case WINDOW_OKBUTTON:
+ pNewWindow = new OKButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_PATTERNBOX:
+ pNewWindow = new PatternBox( pParent, nWinBits );
+ break;
+ case WINDOW_PATTERNFIELD:
+ pNewWindow = new PatternField( pParent, nWinBits );
+ *ppNewComp = new VCLXPatternField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(PatternField*)pNewWindow );
+ break;
+ case WINDOW_PUSHBUTTON:
+ pNewWindow = new PushButton( pParent, nWinBits );
+ *ppNewComp = new VCLXButton;
+ break;
+ case WINDOW_QUERYBOX:
+ pNewWindow = new QueryBox( pParent, nWinBits, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_RADIOBUTTON:
+ pNewWindow = new RadioButton( pParent, nWinBits );
+ *ppNewComp = new VCLXRadioButton;
+
+ // by default, disable RadioCheck
+ // Since the VCLXRadioButton really cares for it's RadioCheck settings, this is important:
+ // if we enable it, the VCLXRadioButton will use RadioButton::Check instead of RadioButton::SetState
+ // This leads to a strange behaviour if the control is newly created: when settings the initial
+ // state to "checked", the RadioButton::Check (called because RadioCheck=TRUE) will uncheck
+ // _all_other_ radio buttons in the same group. However, at this moment the grouping of the controls
+ // is not really valid: the controls are grouped after they have been created, but we're still in
+ // the creation process, so the RadioButton::Check relies on invalid grouping information.
+ // 07.08.2001 - #87254# - frank.schoenheit@sun.com
+ static_cast<RadioButton*>(pNewWindow)->EnableRadioCheck( FALSE );
+ break;
+ case WINDOW_SCROLLBAR:
+ pNewWindow = new ScrollBar( pParent, nWinBits );
+ *ppNewComp = new VCLXScrollBar;
+ break;
+ case WINDOW_SCROLLBARBOX:
+ pNewWindow = new ScrollBarBox( pParent, nWinBits );
+ break;
+ case WINDOW_SPINBUTTON:
+ pNewWindow = new SpinButton( pParent, nWinBits );
+ *ppNewComp = new ::toolkit::VCLXSpinButton;
+ break;
+ case WINDOW_SPINFIELD:
+ pNewWindow = new SpinField( pParent, nWinBits );
+ *ppNewComp = new VCLXNumericField;
+ break;
+ case WINDOW_SPLITTER:
+ pNewWindow = new Splitter( pParent, nWinBits );
+ break;
+ case WINDOW_SPLITWINDOW:
+ pNewWindow = new SplitWindow( pParent, nWinBits );
+ break;
+ case WINDOW_STATUSBAR:
+ pNewWindow = new StatusBar( pParent, nWinBits );
+ break;
+ case VCLWINDOW_SYSTEMCHILDWINDOW:
+ pNewWindow = new SystemChildWindow( pParent, nWinBits );
+ *ppNewComp = new VCLXSystemDependentWindow();
+ break;
+ case WINDOW_TABCONTROL:
+ pNewWindow = new TabControl( pParent, nWinBits );
+ break;
+ case WINDOW_TABDIALOG:
+ pNewWindow = new TabDialog( pParent, nWinBits );
+ break;
+ case WINDOW_TABPAGE:
+ pNewWindow = new TabPage( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPage;
+ break;
+ case WINDOW_TIMEBOX:
+ pNewWindow = new TimeBox( pParent, nWinBits );
+ break;
+ case WINDOW_TIMEFIELD:
+ pNewWindow = new TimeField( pParent, nWinBits );
+ static_cast<TimeField*>(pNewWindow)->EnableEmptyFieldValue( TRUE );
+ *ppNewComp = new VCLXTimeField;
+ ((VCLXFormattedSpinField*)*ppNewComp)->SetFormatter( (FormatterBase*)(TimeField*)pNewWindow );
+ break;
+ case WINDOW_TOOLBOX:
+ pNewWindow = new ToolBox( pParent, nWinBits );
+ *ppNewComp = new VCLXToolBox;
+ break;
+ case WINDOW_TRISTATEBOX:
+ pNewWindow = new TriStateBox( pParent, nWinBits );
+ break;
+ case WINDOW_WARNINGBOX:
+ pNewWindow = new WarningBox( pParent, nWinBits, String() );
+ *ppNewComp = new VCLXMessageBox;
+ break;
+ case WINDOW_WORKWINDOW:
+ case WINDOW_WINDOW:
+ case VCLWINDOW_FRAMEWINDOW:
+ case WINDOW_DOCKINGWINDOW:
+ if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_TOP )
+ {
+ if (nType == WINDOW_DOCKINGWINDOW )
+ pNewWindow = new DockingWindow( pParent, nWinBits );
+ else
+ {
+ if ((pParent == NULL) && rDescriptor.Parent.is())
+ {
+ // try to get a system dependent window handle
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSystemDependentWindowPeer > xSystemDepParent(rDescriptor.Parent, ::com::sun::star::uno::UNO_QUERY);
+
+ if (xSystemDepParent.is())
+ {
+ sal_Int8 processID[16];
+
+ rtl_getGlobalProcessId( (sal_uInt8*)processID );
+
+ ::com::sun::star::uno::Sequence<sal_Int8> processIdSeq(processID, 16);
+
+ ::com::sun::star::uno::Any anyHandle = xSystemDepParent->getWindowHandle(processIdSeq, SYSTEM_DEPENDENT_TYPE);
+
+ // use sal_Int64 here to accomodate all int types
+ // uno::Any shift operator whill upcast if necessary
+ sal_Int64 nWindowHandle = 0;
+ sal_Bool bXEmbed = sal_False;
+
+ bool bUseParentData = true;
+ if( ! (anyHandle >>= nWindowHandle) )
+ {
+ css::uno::Sequence< css::beans::NamedValue > aProps;
+ if( anyHandle >>= aProps )
+ {
+ const int nProps = aProps.getLength();
+ const css::beans::NamedValue* pProps = aProps.getConstArray();
+ for( int i = 0; i < nProps; i++ )
+ {
+ if( pProps[i].Name.equalsAscii( "WINDOW" ) )
+ pProps[i].Value >>= nWindowHandle;
+ else if( pProps[i].Name.equalsAscii( "XEMBED" ) )
+ pProps[i].Value >>= bXEmbed;
+ }
+ }
+ else
+ bUseParentData = false;
+ }
+
+ if( bUseParentData )
+ {
+ SystemParentData aParentData;
+ aParentData.nSize = sizeof( aParentData );
+ #if defined QUARTZ
+ aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle);
+ #elif defined UNX
+ aParentData.aWindow = nWindowHandle;
+ aParentData.bXEmbedSupport = bXEmbed;
+ #elif defined WNT
+ aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
+ #elif defined OS2
+ aParentData.hWnd = (HWND)nWindowHandle;
+ #endif
+ pNewWindow = new WorkWindow( &aParentData );
+ }
+ }
+ }
+
+ if (!pNewWindow)
+ pNewWindow = new WorkWindow( pParent, nWinBits );
+ }
+
+ *ppNewComp = new VCLXTopWindow( pNewWindow->GetType() == WINDOW_WORKWINDOW );
+ }
+ else if ( rDescriptor.Type == ::com::sun::star::awt::WindowClass_CONTAINER )
+ {
+ if (nType == WINDOW_DOCKINGWINDOW )
+ pNewWindow = new DockingWindow( pParent, nWinBits );
+ else
+ pNewWindow = new Window( pParent, nWinBits );
+ *ppNewComp = new VCLXContainer;
+ }
+ else
+ {
+ if (nType == WINDOW_DOCKINGWINDOW )
+ pNewWindow = new DockingWindow( pParent, nWinBits );
+ else
+ pNewWindow = new Window( pParent, nWinBits );
+ *ppNewComp = new VCLXWindow;
+ }
+ break;
+ case WINDOW_CONTROL:
+ if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("simpleanimation") ) )
+ {
+ nWinBits |= WB_SCALE;
+ pNewWindow = new FixedImage( pParent, nWinBits );
+ *ppNewComp = new ::toolkit::XSimpleAnimation;
+ }
+ else if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("throbber") ) )
+ {
+ nWinBits |= WB_SCALE;
+ pNewWindow = new FixedImage( pParent, nWinBits );
+ *ppNewComp = new ::toolkit::XThrobber;
+ }
+ break;
+ default: DBG_ERRORFILE( "UNO3!" );
+ }
+ }
+
+ return pNewWindow;
+}
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow(
+ const css::awt::WindowDescriptor& rDescriptor,
+ WinBits nForceWinBits )
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ osl::Guard< vos::IMutex > aSolarGuard( Application::GetSolarMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xRef;
+
+ Window* pParent = NULL;
+ if ( rDescriptor.Parent.is() )
+ {
+ VCLXWindow* pParentComponent = VCLXWindow::GetImplementation( rDescriptor.Parent );
+
+ // #103939# Don't through assertion, may be it's a system dependend window, used in ImplCreateWindow.
+ // DBG_ASSERT( pParentComponent, "ParentComponent not valid" );
+
+ if ( pParentComponent )
+ pParent = pParentComponent->GetWindow();
+ }
+
+ WinBits nWinBits = ImplGetWinBits( rDescriptor.WindowAttributes,
+ ImplGetComponentType( rDescriptor.WindowServiceName ) );
+ nWinBits |= nForceWinBits;
+
+ VCLXWindow* pNewComp = NULL;
+
+ Window* pNewWindow = NULL;
+ // Try to create the window with SvTools
+ // (do this _before_ creating it on our own: The old mechanism (extended toolkit in SvTools) did it this way,
+ // and we need to stay compatible)
+ // try to load the lib
+ if ( !fnSvtCreateWindow && !hSvToolsLib )
+ {
+ ::rtl::OUString aLibName = ::vcl::unohelper::CreateLibraryName( "svt", TRUE );
+ hSvToolsLib = osl_loadModuleRelative(
+ &thisModule, aLibName.pData, SAL_LOADMODULE_DEFAULT );
+ if ( hSvToolsLib )
+ {
+ ::rtl::OUString aFunctionName( RTL_CONSTASCII_USTRINGPARAM( "CreateWindow" ) );
+ fnSvtCreateWindow = (FN_SvtCreateWindow)osl_getFunctionSymbol( hSvToolsLib, aFunctionName.pData );
+ }
+ }
+ // ask the SvTool creation function
+ if ( fnSvtCreateWindow )
+ pNewWindow = fnSvtCreateWindow( &pNewComp, &rDescriptor, pParent, nWinBits );
+
+ // if SvTools could not provide a window, create it ourself
+ if ( !pNewWindow )
+ pNewWindow = ImplCreateWindow( &pNewComp, rDescriptor, pParent, nWinBits );
+
+ DBG_ASSERT( pNewWindow, "createWindow: Unknown Component!" );
+ DBG_ASSERTWARNING( pNewComp, "createWindow: No special Interface!" );
+
+ if ( pNewWindow )
+ {
+ pNewWindow->SetCreatedWithToolkit( sal_True );
+ //pNewWindow->SetPosPixel( Point() ); // do not force (0,0) position, keep default pos instead
+
+ if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::MINSIZE )
+ {
+ pNewWindow->SetSizePixel( Size() );
+ }
+ else if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::FULLSIZE )
+ {
+ if ( pParent )
+ pNewWindow->SetSizePixel( pParent->GetOutputSizePixel() );
+ }
+ else if ( !VCLUnoHelper::IsZero( rDescriptor.Bounds ) )
+ {
+ Rectangle aRect = VCLRectangle( rDescriptor.Bounds );
+ pNewWindow->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+ }
+
+ if ( !pNewComp )
+ {
+ // Default-Interface
+ xRef = pNewWindow->GetComponentInterface( sal_True );
+ }
+ else
+ {
+ pNewComp->SetCreatedWithToolkit( TRUE );
+ xRef = pNewComp;
+ pNewWindow->SetComponentInterface( xRef );
+ }
+ DBG_ASSERT( pNewWindow->GetComponentInterface( FALSE ) == xRef,
+ "VCLXToolkit::createWindow: did #133706# resurge?" );
+
+ if ( rDescriptor.WindowAttributes & ::com::sun::star::awt::WindowAttribute::SHOW )
+ pNewWindow->Show();
+ }
+
+ return xRef;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > VCLXToolkit::createWindows( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::WindowDescriptor >& rDescriptors ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nComponents = rDescriptors.getLength();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > > aSeq( nComponents );
+ for ( sal_uInt32 n = 0; n < nComponents; n++ )
+ {
+ ::com::sun::star::awt::WindowDescriptor aDescr = rDescriptors.getConstArray()[n];
+
+ if ( aDescr.ParentIndex == (-1) )
+ aDescr.Parent = NULL;
+ else if ( ( aDescr.ParentIndex >= 0 ) && ( aDescr.ParentIndex < (short)n ) )
+ aDescr.Parent = aSeq.getConstArray()[aDescr.ParentIndex];
+ aSeq.getArray()[n] = createWindow( aDescr );
+ }
+ return aSeq;
+}
+
+// ::com::sun::star::awt::XSystemChildFactory
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createSystemChild( const ::com::sun::star::uno::Any& Parent, const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 nSystemType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Window* pChildWindow = NULL;
+ if ( nSystemType == SYSTEM_DEPENDENT_TYPE )
+ {
+ // use sal_Int64 here to accomodate all int types
+ // uno::Any shift operator whill upcast if necessary
+ sal_Int64 nWindowHandle = 0;
+ sal_Bool bXEmbed = sal_False;
+
+ bool bUseParentData = true;
+ if( ! (Parent >>= nWindowHandle) )
+ {
+ css::uno::Sequence< css::beans::NamedValue > aProps;
+ if( Parent >>= aProps )
+ {
+ const int nProps = aProps.getLength();
+ const css::beans::NamedValue* pProps = aProps.getConstArray();
+ for( int i = 0; i < nProps; i++ )
+ {
+ if( pProps[i].Name.equalsAscii( "WINDOW" ) )
+ pProps[i].Value >>= nWindowHandle;
+ else if( pProps[i].Name.equalsAscii( "XEMBED" ) )
+ pProps[i].Value >>= bXEmbed;
+ }
+ }
+ else
+ bUseParentData = false;
+ }
+
+ if( bUseParentData )
+ {
+ SystemParentData aParentData;
+ aParentData.nSize = sizeof( aParentData );
+ #if defined QUARTZ
+ aParentData.pView = reinterpret_cast<NSView*>(nWindowHandle);
+ #elif defined UNX
+ aParentData.aWindow = nWindowHandle;
+ aParentData.bXEmbedSupport = bXEmbed;
+ #elif defined WNT
+ aParentData.hWnd = reinterpret_cast<HWND>(nWindowHandle);
+ #elif defined OS2
+ aParentData.hWnd = (HWND)nWindowHandle;
+ #endif
+ osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() );
+ try
+ {
+ pChildWindow = new WorkWindow( &aParentData );
+ }
+ catch ( ::com::sun::star::uno::RuntimeException & rEx )
+ {
+ // system child window could not be created
+ OSL_TRACE(
+ "VCLXToolkit::createSystemChild: caught %s\n",
+ ::rtl::OUStringToOString(
+ rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
+ pChildWindow = NULL;
+ }
+ }
+ }
+ else if (nSystemType == com::sun::star::lang::SystemDependent::SYSTEM_JAVA)
+ {
+ osl::Guard< vos::IMutex > aGuard(Application::GetSolarMutex());
+ pChildWindow = new WorkWindow(0, Parent);
+ }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer;
+ if ( pChildWindow )
+ {
+ VCLXTopWindow* pPeer = new VCLXTopWindow(true);
+ osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() );
+ pPeer->SetWindow( pChildWindow );
+ xPeer = pPeer;
+ }
+
+ return xPeer;
+}
+
+// ::com::sun::star::awt::XMessageBoxFactory
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > SAL_CALL VCLXToolkit::createMessageBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& aParent,
+ const ::com::sun::star::awt::Rectangle& aPosSize,
+ const ::rtl::OUString& aType,
+ ::sal_Int32 aButtons,
+ const ::rtl::OUString& aTitle,
+ const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::WindowDescriptor aDescriptor;
+
+ sal_Int32 nWindowAttributes = css::awt::WindowAttribute::BORDER|css::awt::WindowAttribute::MOVEABLE|css::awt::WindowAttribute::CLOSEABLE;
+
+ // Map button definitions to window attributes
+ if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_OK )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::OK;
+ else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_OK_CANCEL )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::OK_CANCEL;
+ else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_YES_NO )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::YES_NO;
+ else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_YES_NO_CANCEL )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::YES_NO_CANCEL;
+ else if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_RETRY_CANCEL )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::RETRY_CANCEL;
+
+ // Map default button definitions to window attributes
+ if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_OK )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_OK;
+ else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_CANCEL )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_CANCEL;
+ else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_YES )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_YES;
+ else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_NO )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_NO;
+ else if (sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_RETRY )
+ nWindowAttributes |= css::awt::VclWindowPeerAttribute::DEF_RETRY;
+
+ // No more bits for VclWindowPeerAttribute possible. Mapping must be
+ // done explicitly using VCL methods
+ WinBits nAddWinBits( 0 );
+ if (( aButtons & 0x0000ffffL ) == css::awt::MessageBoxButtons::BUTTONS_ABORT_IGNORE_RETRY )
+ nAddWinBits |= WB_ABORT_RETRY_IGNORE;
+ if ( sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_IGNORE )
+ nAddWinBits |= WB_DEF_IGNORE;
+
+ aDescriptor.Type = css::awt::WindowClass_MODALTOP;
+ aDescriptor.WindowServiceName = aType;
+ aDescriptor.ParentIndex = -1;
+ aDescriptor.Parent = aParent;
+ aDescriptor.Bounds = aPosSize;
+ aDescriptor.WindowAttributes = nWindowAttributes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > xMsgBox(
+ ImplCreateWindow( aDescriptor, nAddWinBits ), css::uno::UNO_QUERY );
+ css::uno::Reference< css::awt::XWindow > xWindow( xMsgBox, css::uno::UNO_QUERY );
+ if ( xMsgBox.is() && xWindow.is() )
+ {
+ Window * pWindow = VCLUnoHelper::GetWindow( xWindow );
+ if ( pWindow )
+ {
+ osl::Guard< vos::IMutex > aGuard(Application::GetSolarMutex());
+ xMsgBox->setCaptionText( aTitle );
+ xMsgBox->setMessageText( aMessage );
+ }
+ }
+
+ return xMsgBox;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer > SAL_CALL VCLXToolkit::getDragGestureRecognizer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Window * pWindow = VCLUnoHelper::GetWindow( window );
+
+ if( pWindow )
+ return pWindow->GetDragGestureRecognizer();
+
+ return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer >();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource > SAL_CALL VCLXToolkit::getDragSource( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Window * pWindow = VCLUnoHelper::GetWindow( window );
+
+ if( pWindow )
+ return pWindow->GetDragSource();
+
+ return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget > SAL_CALL VCLXToolkit::getDropTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& window ) throw(::com::sun::star::uno::RuntimeException)
+{
+ Window * pWindow = VCLUnoHelper::GetWindow( window );
+
+ if( pWindow )
+ return pWindow->GetDropTarget();
+
+ return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTarget >();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL VCLXToolkit::getClipboard( const ::rtl::OUString& clipboardName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( clipboardName.getLength() == 0 )
+ {
+ if( !mxClipboard.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ if ( xFactory.is() )
+ {
+ // remember clipboard here
+ mxClipboard = ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > (
+ xFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.datatransfer.clipboard.SystemClipboard" ) ), ::com::sun::star::uno::UNO_QUERY );
+ }
+ }
+
+ return mxClipboard;
+ }
+
+ else if( clipboardName.equals( ::rtl::OUString::createFromAscii("Selection") ) )
+ {
+ return mxSelection;
+ }
+
+ return ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >();
+}
+
+// XServiceInfo
+::rtl::OUString VCLXToolkit::getImplementationName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return rtl::OUString::createFromAscii( "stardiv.Toolkit.VCLXToolkit" );
+}
+
+sal_Bool VCLXToolkit::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString* pArray = aSNL.getConstArray();
+ const ::rtl::OUString* pArrayEnd = aSNL.getConstArray();
+ for (; pArray != pArrayEnd; ++pArray )
+ if( *pArray == rServiceName )
+ break;
+
+ return pArray != pArrayEnd;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > VCLXToolkit::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
+ return ::com::sun::star::uno::Sequence< ::rtl::OUString >( &aServiceName, 1);
+}
+
+// css::awt::XExtendedToolkit:
+
+// virtual
+::sal_Int32 SAL_CALL VCLXToolkit::getTopWindowCount()
+ throw (::css::uno::RuntimeException)
+{
+ return static_cast< ::sal_Int32 >(::Application::GetTopWindowCount());
+ // XXX numeric overflow
+}
+
+// virtual
+::css::uno::Reference< ::css::awt::XTopWindow > SAL_CALL
+VCLXToolkit::getTopWindow(::sal_Int32 nIndex)
+ throw (::css::uno::RuntimeException)
+{
+ ::Window * p = ::Application::GetTopWindow(static_cast< long >(nIndex));
+ // XXX numeric overflow
+ return ::css::uno::Reference< ::css::awt::XTopWindow >(
+ p == 0 ? 0 : static_cast< ::css::awt::XWindow * >(p->GetWindowPeer()),
+ ::css::uno::UNO_QUERY);
+}
+
+// virtual
+::css::uno::Reference< ::css::awt::XTopWindow > SAL_CALL
+VCLXToolkit::getActiveTopWindow() throw (::css::uno::RuntimeException)
+{
+ ::Window * p = ::Application::GetActiveTopWindow();
+ return ::css::uno::Reference< ::css::awt::XTopWindow >(
+ p == 0 ? 0 : static_cast< ::css::awt::XWindow * >(p->GetWindowPeer()),
+ ::css::uno::UNO_QUERY);
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::addTopWindowListener(
+ ::css::uno::Reference< ::css::awt::XTopWindowListener > const & rListener)
+ throw (::css::uno::RuntimeException)
+{
+ OSL_ENSURE(rListener.is(), "Null rListener");
+ ::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_aTopWindowListeners.addInterface(rListener) == 1
+ && !m_bEventListener)
+ {
+ m_bEventListener = true;
+ ::Application::AddEventListener(m_aEventListenerLink);
+ }
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::removeTopWindowListener(
+ ::css::uno::Reference< ::css::awt::XTopWindowListener > const & rListener)
+ throw (::css::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard(rBHelper.rMutex);
+ if (!(rBHelper.bDisposed || rBHelper.bInDispose)
+ && m_aTopWindowListeners.removeInterface(rListener) == 0
+ && m_aFocusListeners.getLength() == 0 && m_bEventListener)
+ {
+ ::Application::RemoveEventListener(m_aEventListenerLink);
+ m_bEventListener = false;
+ }
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::addKeyHandler(
+ ::css::uno::Reference< ::css::awt::XKeyHandler > const & rHandler)
+ throw (::css::uno::RuntimeException)
+{
+ OSL_ENSURE(rHandler.is(), "Null rHandler");
+ ::osl::ClearableMutexGuard aGuard(rBHelper.rMutex);
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ {
+ aGuard.clear();
+ rHandler->disposing(
+ ::css::lang::EventObject(
+ static_cast< ::cppu::OWeakObject * >(this)));
+ }
+ else if (m_aKeyHandlers.addInterface(rHandler) == 1 && !m_bKeyListener)
+ {
+ m_bKeyListener = true;
+ ::Application::AddKeyListener(m_aKeyListenerLink);
+ }
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::removeKeyHandler(
+ ::css::uno::Reference< ::css::awt::XKeyHandler > const & rHandler)
+ throw (::css::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard(rBHelper.rMutex);
+ if (!(rBHelper.bDisposed || rBHelper.bInDispose)
+ && m_aKeyHandlers.removeInterface(rHandler) == 0 && m_bKeyListener)
+ {
+ ::Application::RemoveKeyListener(m_aKeyListenerLink);
+ m_bKeyListener = false;
+ }
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::addFocusListener(
+ ::css::uno::Reference< ::css::awt::XFocusListener > const & rListener)
+ throw (::css::uno::RuntimeException)
+{
+ OSL_ENSURE(rListener.is(), "Null rListener");
+ ::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_aFocusListeners.addInterface(rListener) == 1
+ && !m_bEventListener)
+ {
+ m_bEventListener = true;
+ ::Application::AddEventListener(m_aEventListenerLink);
+ }
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::removeFocusListener(
+ ::css::uno::Reference< ::css::awt::XFocusListener > const & rListener)
+ throw (::css::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard(rBHelper.rMutex);
+ if (!(rBHelper.bDisposed || rBHelper.bInDispose)
+ && m_aFocusListeners.removeInterface(rListener) == 0
+ && m_aTopWindowListeners.getLength() == 0 && m_bEventListener)
+ {
+ ::Application::RemoveEventListener(m_aEventListenerLink);
+ m_bEventListener = false;
+ }
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::fireFocusGained(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > const &)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+// virtual
+void SAL_CALL VCLXToolkit::fireFocusLost(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > const &)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+
+IMPL_LINK(VCLXToolkit, eventListenerHandler, ::VclSimpleEvent const *, pEvent)
+{
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_SHOW:
+ callTopWindowListeners(
+ pEvent, &::css::awt::XTopWindowListener::windowOpened);
+ break;
+ case VCLEVENT_WINDOW_HIDE:
+ callTopWindowListeners(
+ pEvent, &::css::awt::XTopWindowListener::windowClosed);
+ break;
+ case VCLEVENT_WINDOW_ACTIVATE:
+ callTopWindowListeners(
+ pEvent, &::css::awt::XTopWindowListener::windowActivated);
+ break;
+ case VCLEVENT_WINDOW_DEACTIVATE:
+ callTopWindowListeners(
+ pEvent, &::css::awt::XTopWindowListener::windowDeactivated);
+ break;
+ case VCLEVENT_WINDOW_CLOSE:
+ callTopWindowListeners(
+ pEvent, &::css::awt::XTopWindowListener::windowClosing);
+ break;
+ case VCLEVENT_WINDOW_GETFOCUS:
+ callFocusListeners(pEvent, true);
+ break;
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ callFocusListeners(pEvent, false);
+ break;
+ case VCLEVENT_WINDOW_MINIMIZE:
+ callTopWindowListeners(
+ pEvent, &::css::awt::XTopWindowListener::windowMinimized);
+ break;
+ case VCLEVENT_WINDOW_NORMALIZE:
+ callTopWindowListeners(
+ pEvent, &::css::awt::XTopWindowListener::windowNormalized);
+ break;
+ }
+ return 0;
+}
+
+IMPL_LINK(VCLXToolkit, keyListenerHandler, ::VclSimpleEvent const *, pEvent)
+{
+ switch (pEvent->GetId())
+ {
+ case VCLEVENT_WINDOW_KEYINPUT:
+ return callKeyHandlers(pEvent, true);
+ case VCLEVENT_WINDOW_KEYUP:
+ return callKeyHandlers(pEvent, false);
+ }
+ return 0;
+}
+
+void VCLXToolkit::callTopWindowListeners(
+ ::VclSimpleEvent const * pEvent,
+ void (SAL_CALL ::css::awt::XTopWindowListener::* pFn)(
+ ::css::lang::EventObject const &))
+{
+ ::Window * pWindow
+ = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
+ if (pWindow->IsTopWindow())
+ {
+ ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >
+ aListeners(m_aTopWindowListeners.getElements());
+ if (aListeners.hasElements())
+ {
+ ::css::lang::EventObject aAwtEvent(
+ static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()));
+ for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i)
+ {
+ ::css::uno::Reference< ::css::awt::XTopWindowListener >
+ xListener(aListeners[i], ::css::uno::UNO_QUERY);
+ try
+ {
+ (xListener.get()->*pFn)(aAwtEvent);
+ }
+ catch (::css::uno::RuntimeException & rEx)
+ {
+ OSL_TRACE(
+ "VCLXToolkit::callTopWindowListeners: caught %s\n",
+ ::rtl::OUStringToOString(
+ rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+ }
+ }
+}
+
+long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
+ bool bPressed)
+{
+ ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >
+ aHandlers(m_aKeyHandlers.getElements());
+
+ if (aHandlers.hasElements())
+ {
+ ::Window * pWindow = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
+
+ // See implementation in vclxwindow.cxx for mapping between VCL and UNO AWT event
+ ::KeyEvent * pKeyEvent = static_cast< ::KeyEvent * >(
+ static_cast< ::VclWindowEvent const * >(pEvent)->GetData());
+ ::css::awt::KeyEvent aAwtEvent(
+ static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()),
+ (pKeyEvent->GetKeyCode().IsShift()
+ ? ::css::awt::KeyModifier::SHIFT : 0)
+ | (pKeyEvent->GetKeyCode().IsMod1()
+ ? ::css::awt::KeyModifier::MOD1 : 0)
+ | (pKeyEvent->GetKeyCode().IsMod2()
+ ? ::css::awt::KeyModifier::MOD2 : 0)
+ | (pKeyEvent->GetKeyCode().IsMod3()
+ ? ::css::awt::KeyModifier::MOD3 : 0),
+ pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(),
+ sal::static_int_cast< sal_Int16 >(
+ pKeyEvent->GetKeyCode().GetFunction()));
+ for (::sal_Int32 i = 0; i < aHandlers.getLength(); ++i)
+ {
+ ::css::uno::Reference< ::css::awt::XKeyHandler > xHandler(
+ aHandlers[i], ::css::uno::UNO_QUERY);
+ try
+ {
+ if ((bPressed ? xHandler->keyPressed(aAwtEvent)
+ : xHandler->keyReleased(aAwtEvent)))
+ return 1;
+ }
+ catch (::css::uno::RuntimeException & rEx)
+ {
+ OSL_TRACE(
+ "VCLXToolkit::callKeyHandlers: caught %s\n",
+ ::rtl::OUStringToOString(
+ rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+ }
+ return 0;
+}
+
+void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
+ bool bGained)
+{
+ ::Window * pWindow
+ = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow();
+ if (pWindow->IsTopWindow())
+ {
+ ::css::uno::Sequence< ::css::uno::Reference< ::css::uno::XInterface > >
+ aListeners(m_aFocusListeners.getElements());
+ if (aListeners.hasElements())
+ {
+ // Ignore the interior of compound controls when determining the
+ // window that gets the focus next (see implementation in
+ // vclxwindow.cxx for mapping between VCL and UNO AWT event):
+ ::css::uno::Reference< css::uno::XInterface > xNext;
+ ::Window * pFocus = ::Application::GetFocusWindow();
+ for (::Window * p = pFocus; p != 0; p = p->GetParent())
+ if (!p->IsCompoundControl())
+ {
+ pFocus = p;
+ break;
+ }
+ if (pFocus != 0)
+ xNext = pFocus->GetComponentInterface(true);
+ ::css::awt::FocusEvent aAwtEvent(
+ static_cast< ::css::awt::XWindow * >(pWindow->GetWindowPeer()),
+ pWindow->GetGetFocusFlags(), xNext, false);
+ for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i)
+ {
+ ::css::uno::Reference< ::css::awt::XFocusListener > xListener(
+ aListeners[i], ::css::uno::UNO_QUERY);
+ try
+ {
+ bGained ? xListener->focusGained(aAwtEvent)
+ : xListener->focusLost(aAwtEvent);
+ }
+ catch (::css::uno::RuntimeException & rEx)
+ {
+ OSL_TRACE(
+ "VCLXToolkit::callFocusListeners: caught %s\n",
+ ::rtl::OUStringToOString(
+ rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+ }
+ }
+}
+
+// css::awt::XReschedule:
+
+void SAL_CALL VCLXToolkit::reschedule()
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ Application::Reschedule(true);
+}
+
diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx
new file mode 100644
index 000000000000..10220a87de63
--- /dev/null
+++ b/toolkit/source/awt/vclxtopwindow.cxx
@@ -0,0 +1,345 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/lang/SystemDependent.hpp>
+#include <com/sun/star/awt/SystemDependentXWindow.hpp>
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include <windows.h>
+#include <tools/postwin.h>
+#elif defined ( QUARTZ )
+#include "premac.h"
+#include <Cocoa/Cocoa.h>
+#include "postmac.h"
+#endif
+
+#include <vcl/syschild.hxx>
+#include <vcl/sysdata.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <toolkit/awt/vclxtopwindow.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/helper/macros.hxx>
+
+#include <vcl/wrkwin.hxx>
+#include <vcl/syswin.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/svapp.hxx>
+
+#include <tools/debug.hxx>
+
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+
+VCLXTopWindow_Base::VCLXTopWindow_Base( const bool _bSupportSystemWindowPeer )
+ :m_bWHWND( _bSupportSystemWindowPeer )
+{
+}
+
+VCLXTopWindow_Base::~VCLXTopWindow_Base()
+{
+}
+
+Any VCLXTopWindow_Base::queryInterface( const Type & rType ) throw(RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet( VCLXTopWindow_XBase::queryInterface( rType ) );
+
+ // do not expose XSystemDependentWindowPeer if we do not have a system window handle
+ if ( !aRet.hasValue() && m_bWHWND )
+ aRet = VCLXTopWindow_SBase::queryInterface( rType );
+
+ return aRet;
+}
+
+Sequence< Type > VCLXTopWindow_Base::getTypes() throw(RuntimeException)
+{
+ Sequence< Type > aTypes( VCLXTopWindow_XBase::getTypes() );
+ if ( m_bWHWND )
+ aTypes = ::comphelper::concatSequences( aTypes, VCLXTopWindow_SBase::getTypes() );
+ return aTypes;
+}
+
+::com::sun::star::uno::Any VCLXTopWindow_Base::getWindowHandle( const ::com::sun::star::uno::Sequence< sal_Int8 >& /*ProcessId*/, sal_Int16 SystemType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ // TODO, check the process id
+ ::com::sun::star::uno::Any aRet;
+ Window* pWindow = GetWindowImpl();
+ if ( pWindow )
+ {
+ const SystemEnvData* pSysData = ((SystemWindow *)pWindow)->GetSystemData();
+ if( pSysData )
+ {
+#if (defined WNT)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_WIN32 )
+ {
+ aRet <<= (sal_Int32)pSysData->hWnd;
+ }
+#elif (defined OS2)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_OS2 )
+ {
+ aRet <<= (sal_Int32)pSysData->hWnd;
+ }
+#elif (defined QUARTZ)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_MAC )
+ {
+ aRet <<= (sal_IntPtr)pSysData->pView;
+ }
+#elif (defined UNX)
+ if( SystemType == ::com::sun::star::lang::SystemDependent::SYSTEM_XWINDOW )
+ {
+ ::com::sun::star::awt::SystemDependentXWindow aSD;
+ aSD.DisplayPointer = sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(pSysData->pDisplay));
+ aSD.WindowHandle = pSysData->aWindow;
+ aRet <<= aSD;
+ }
+#endif
+ }
+ }
+ return aRet;
+}
+
+void VCLXTopWindow_Base::addTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ GetTopWindowListenersImpl().addInterface( rxListener );
+}
+
+void VCLXTopWindow_Base::removeTopWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ GetTopWindowListenersImpl().removeInterface( rxListener );
+}
+
+void VCLXTopWindow_Base::toFront( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ Window* pWindow = GetWindowImpl();
+ if ( pWindow )
+ ((WorkWindow*)pWindow)->ToTop( TOTOP_RESTOREWHENMIN );
+}
+
+void VCLXTopWindow_Base::toBack( ) throw(::com::sun::star::uno::RuntimeException)
+{
+#if 0 // Not possible in VCL...
+
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ Window* pWindow = GetWindowImpl();
+ if ( pWindow )
+ {
+ ((WorkWindow*)pWindow)->ToBack();
+ }
+#endif
+}
+
+void VCLXTopWindow_Base::setMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar >& rxMenu ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ SystemWindow* pWindow = (SystemWindow*) GetWindowImpl();
+ if ( pWindow )
+ {
+ pWindow->SetMenuBar( NULL );
+ if ( rxMenu.is() )
+ {
+ VCLXMenu* pMenu = VCLXMenu::GetImplementation( rxMenu );
+ if ( pMenu && !pMenu->IsPopupMenu() )
+ pWindow->SetMenuBar( (MenuBar*) pMenu->GetMenu() );
+ }
+ }
+ mxMenuBar = rxMenu;
+}
+
+//--------------------------------------------------------------------
+::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMaximized() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return sal_False;
+
+ return pWindow->IsMaximized();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setIsMaximized( ::sal_Bool _ismaximized ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ pWindow->Maximize( _ismaximized );
+}
+
+//--------------------------------------------------------------------
+::sal_Bool SAL_CALL VCLXTopWindow_Base::getIsMinimized() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return sal_False;
+
+ return pWindow->IsMinimized();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setIsMinimized( ::sal_Bool _isMinimized ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ WorkWindow* pWindow = dynamic_cast< WorkWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ _isMinimized ? pWindow->Minimize() : pWindow->Restore();
+}
+
+//--------------------------------------------------------------------
+::sal_Int32 SAL_CALL VCLXTopWindow_Base::getDisplay() throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return 0;
+
+ return pWindow->GetScreenNumber();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXTopWindow_Base::setDisplay( ::sal_Int32 _display ) throw (RuntimeException, IndexOutOfBoundsException)
+{
+ ::vos::OGuard aGuard( GetMutexImpl() );
+
+ if ( ( _display < 0 ) || ( _display >= (sal_Int32)Application::GetScreenCount() ) )
+ throw IndexOutOfBoundsException();
+
+ SystemWindow* pWindow = dynamic_cast< SystemWindow* >( GetWindowImpl() );
+ if ( !pWindow )
+ return;
+
+ pWindow->SetScreenNumber( _display );
+}
+
+// ----------------------------------------------------
+// class VCLXTopWindow
+// ----------------------------------------------------
+
+void VCLXTopWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXContainer::ImplGetPropertyIds( rIds );
+}
+
+VCLXTopWindow::VCLXTopWindow(bool bWHWND)
+ : VCLXTopWindow_Base( bWHWND )
+{
+}
+
+VCLXTopWindow::~VCLXTopWindow()
+{
+}
+
+vos::IMutex& VCLXTopWindow::GetMutexImpl()
+{
+ return VCLXContainer::GetMutex();
+}
+
+Window* VCLXTopWindow::GetWindowImpl()
+{
+ return VCLXContainer::GetWindow();
+}
+
+::cppu::OInterfaceContainerHelper& VCLXTopWindow::GetTopWindowListenersImpl()
+{
+ return GetTopWindowListeners();
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXTopWindow::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet( VCLXTopWindow_Base::queryInterface( rType ) );
+
+ if ( !aRet.hasValue() )
+ aRet = VCLXContainer::queryInterface( rType );
+
+ return aRet;
+}
+
+::com::sun::star::uno::Sequence< sal_Int8 > VCLXTopWindow::getImplementationId() throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::cppu::OImplementationId* pId = NULL;
+ static ::cppu::OImplementationId* pIdWithHandle = NULL;
+ if ( isSystemDependentWindowPeer() )
+ {
+ if( !pIdWithHandle )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pIdWithHandle )
+ {
+ static ::cppu::OImplementationId idWithHandle( sal_False );
+ pIdWithHandle = &idWithHandle;
+ }
+ }
+
+ return (*pIdWithHandle).getImplementationId();
+ }
+ else
+ {
+ if( !pId )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pId )
+ {
+ static ::cppu::OImplementationId id( sal_False );
+ pId = &id;
+ }
+ }
+
+ return (*pId).getImplementationId();
+ }
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > VCLXTopWindow::getTypes() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::comphelper::concatSequences( VCLXTopWindow_Base::getTypes(), VCLXContainer::getTypes() );
+}
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
new file mode 100644
index 000000000000..248571819067
--- /dev/null
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -0,0 +1,2776 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/WindowEvent.hpp>
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/MouseEvent.hpp>
+#include <com/sun/star/awt/MouseButton.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/Style.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/awt/DockingEvent.hpp>
+#include <com/sun/star/awt/EndDockingEvent.hpp>
+#include <com/sun/star/awt/EndPopupModeEvent.hpp>
+#include <com/sun/star/awt/XWindowListener2.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/accessibilityclient.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <rtl/ustrbuf.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <tools/color.hxx>
+#include <vcl/dockwin.hxx>
+#include <vcl/pdfextoutdevdata.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/button.hxx>
+#include <comphelper/asyncnotification.hxx>
+#include <toolkit/helper/solarrelease.hxx>
+
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::awt::XWindowListener2;
+using ::com::sun::star::awt::XDockableWindowListener;
+using ::com::sun::star::awt::XDevice;
+using ::com::sun::star::style::VerticalAlignment;
+using ::com::sun::star::style::VerticalAlignment_TOP;
+using ::com::sun::star::style::VerticalAlignment_MIDDLE;
+using ::com::sun::star::style::VerticalAlignment_BOTTOM;
+using ::com::sun::star::style::VerticalAlignment_MAKE_FIXED_SIZE;
+
+namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
+namespace MouseWheelBehavior = ::com::sun::star::awt::MouseWheelBehavior;
+
+
+//====================================================================
+//= misc helpers
+//====================================================================
+namespace
+{
+ //................................................................
+ //. FlagGuard
+ //................................................................
+ class FlagGuard
+ {
+ private:
+ bool& m_rFlag;
+
+ public:
+ FlagGuard( bool& _rFlag )
+ :m_rFlag( _rFlag )
+ {
+ m_rFlag = true;
+ }
+ ~FlagGuard()
+ {
+ m_rFlag = false;
+ }
+ };
+
+ //................................................................
+ //. MouseEventType
+ //................................................................
+ enum MouseEventType
+ {
+ META_FIRST_MOUSE_EVENT = 0,
+
+ EVENT_MOUSE_PRESSED = 0,
+ EVENT_MOUSE_RELEASED = 1,
+ EVENT_MOUSE_ENTERED = 2,
+ EVENT_MOUSE_EXITED = 3,
+
+ META_LAST_MOUSE_EVENT = 3
+ };
+
+ //................................................................
+ //. PlainEventType
+ //................................................................
+ enum PlainEventType
+ {
+ META_FIRST_PLAIN_EVENT = 4,
+
+ EVENT_WINDOW_ENABLED = 4,
+ EVENT_WINDOW_DISABLED = 5,
+
+ META_LAST_PLAIN_EVENT = 5
+ };
+
+#if OSL_DEBUG_LEVEL > 0
+ static void checkEventDefinitions()
+ {
+ OSL_ENSURE( (int)META_LAST_MOUSE_EVENT < (int)META_FIRST_PLAIN_EVENT, "checkEventDefinitions: invalid event definitions!" );
+ }
+ #define DBG_CHECK_EVENTS() checkEventDefinitions()
+#else
+ #define DBG_CHECK_EVENTS()
+#endif
+
+ //................................................................
+ //. AnyWindowEvent
+ //................................................................
+ struct AnyWindowEvent : public ::comphelper::AnyEvent
+ {
+ private:
+ awt::MouseEvent m_aMouseEvent;
+ lang::EventObject m_aPlainEvent;
+
+ sal_Int32 m_nEventType;
+
+ public:
+ AnyWindowEvent( const awt::MouseEvent& _rEvent, MouseEventType _nType )
+ :comphelper::AnyEvent()
+ ,m_aMouseEvent( _rEvent )
+ ,m_nEventType( static_cast< sal_Int32 >( _nType ) )
+ {
+ DBG_CHECK_EVENTS();
+ }
+
+ AnyWindowEvent( const lang::EventObject& _rEvent, PlainEventType _nType )
+ :comphelper::AnyEvent()
+ ,m_aPlainEvent( _rEvent )
+ ,m_nEventType( static_cast< sal_Int32 >( _nType ) )
+ {
+ DBG_CHECK_EVENTS();
+ }
+
+ bool isMouseEvent() const
+ {
+ return ( META_FIRST_MOUSE_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_MOUSE_EVENT );
+ }
+
+ bool isPlainEvent() const
+ {
+ return ( META_FIRST_PLAIN_EVENT <= m_nEventType ) && ( m_nEventType <= META_LAST_PLAIN_EVENT );
+ }
+
+ const awt::MouseEvent& getMouseEvent() const
+ {
+ OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEvent: no mouse event!" );
+ return m_aMouseEvent;
+ }
+
+ MouseEventType getMouseEventType() const
+ {
+ OSL_ENSURE( isMouseEvent(), "AnyWindowEvent::getMouseEventType: no mouse event!" );
+ return static_cast< MouseEventType >( m_nEventType );
+ }
+
+ const lang::EventObject& getPlainEvent() const
+ {
+ OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEvent: no plain event!" );
+ return m_aPlainEvent;
+ }
+
+ PlainEventType getPlainEventType() const
+ {
+ OSL_ENSURE( isPlainEvent(), "AnyWindowEvent::getPlainEventType: no mouse event!" );
+ return static_cast< PlainEventType >( m_nEventType );
+ }
+ };
+}
+
+//====================================================================
+//= VCLXWindowImpl
+//====================================================================
+class SAL_DLLPRIVATE VCLXWindowImpl : public ::comphelper::IEventProcessor
+{
+private:
+ typedef ::std::vector< ::rtl::Reference< ::comphelper::AnyEvent > >
+ EventArray;
+
+private:
+ VCLXWindow& mrAntiImpl;
+ ::vos::IMutex& mrMutex;
+ ::toolkit::AccessibilityClient maAccFactory;
+ bool mbDisposed;
+ bool mbDrawingOntoParent; // no bit mask, is passed around by reference
+ sal_Bool mbEnableVisible;
+ sal_Bool mbDirectVisible;
+
+ ::osl::Mutex maListenerContainerMutex;
+ ::cppu::OInterfaceContainerHelper maWindow2Listeners;
+ ::cppu::OInterfaceContainerHelper maDockableWindowListeners;
+ EventListenerMultiplexer maEventListeners;
+ FocusListenerMultiplexer maFocusListeners;
+ WindowListenerMultiplexer maWindowListeners;
+ KeyListenerMultiplexer maKeyListeners;
+ MouseListenerMultiplexer maMouseListeners;
+ MouseMotionListenerMultiplexer maMouseMotionListeners;
+ PaintListenerMultiplexer maPaintListeners;
+ VclContainerListenerMultiplexer maContainerListeners;
+ TopWindowListenerMultiplexer maTopWindowListeners;
+
+ EventArray maEvents;
+ ULONG mnEventId;
+
+public:
+ bool mbDisposing : 1;
+ bool mbDesignMode : 1;
+ bool mbSynthesizingVCLEvent : 1;
+ bool mbWithDefaultProps : 1;
+
+ ULONG mnListenerLockLevel;
+ sal_Int16 mnWritingMode;
+ sal_Int16 mnContextWritingMode;
+
+ UnoPropertyArrayHelper* mpPropHelper;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >
+ mxPointer;
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ mxAccessibleContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >
+ mxViewGraphics;
+
+public:
+ bool& getDrawingOntoParent_ref() { return mbDrawingOntoParent; }
+
+public:
+ /** ctor
+ @param _pAntiImpl
+ the <type>VCLXWindow</type> instance which the object belongs to. Must
+ live longer then the object just being constructed.
+ */
+ VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, bool _bWithDefaultProps );
+
+ /** synchronously mbEnableVisible
+ */
+ void setEnableVisible( sal_Bool bEnableVisible ) { mbEnableVisible = bEnableVisible; }
+ sal_Bool isEnableVisible() { return mbEnableVisible; }
+ /** synchronously mbDirectVisible;
+ */
+ void setDirectVisible( sal_Bool bDirectVisible ) { mbDirectVisible = bDirectVisible; }
+ sal_Bool isDirectVisible() { return mbDirectVisible; }
+
+ /** asynchronously notifies a mouse event to the VCLXWindow's XMouseListeners
+ */
+ void notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType );
+
+ /** asynchronously notifies an event described by an EventObject to the respective listeners
+ */
+ void notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType );
+
+ /** notifies the object that its VCLXWindow is being disposed
+ */
+ void disposing();
+
+ inline ::toolkit::AccessibilityClient& getAccessibleFactory()
+ {
+ return maAccFactory;
+ }
+
+ /** returns the container of registered XWindowListener2 listeners
+ */
+ inline ::cppu::OInterfaceContainerHelper& getWindow2Listeners() { return maWindow2Listeners; }
+ inline ::cppu::OInterfaceContainerHelper& getDockableWindowListeners(){ return maDockableWindowListeners; }
+ inline EventListenerMultiplexer& getEventListeners() { return maEventListeners; }
+ inline FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; }
+ inline WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; }
+ inline KeyListenerMultiplexer& getKeyListeners() { return maKeyListeners; }
+ inline MouseListenerMultiplexer& getMouseListeners() { return maMouseListeners; }
+ inline MouseMotionListenerMultiplexer& getMouseMotionListeners() { return maMouseMotionListeners; }
+ inline PaintListenerMultiplexer& getPaintListeners() { return maPaintListeners; }
+ inline VclContainerListenerMultiplexer& getContainerListeners() { return maContainerListeners; }
+ inline TopWindowListenerMultiplexer& getTopWindowListeners() { return maTopWindowListeners; }
+
+ virtual ~VCLXWindowImpl();
+
+protected:
+ virtual void SAL_CALL acquire();
+ virtual void SAL_CALL release();
+
+ // IEventProcessor
+ virtual void processEvent( const ::comphelper::AnyEvent& _rEvent );
+
+private:
+ DECL_LINK( OnProcessEvent, void* );
+
+private:
+ /** notifies an arbitrary event
+ @param _rEvent
+ the event to notify
+ */
+ void impl_notifyAnyEvent(
+ const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent
+ );
+
+private:
+ /** determines whether the instance is already disposed
+ @precond
+ m_aMutex must be acquired
+ */
+ inline bool impl_isDisposed()
+ {
+ return mbDisposed;
+ }
+
+private:
+ VCLXWindowImpl(); // never implemented
+ VCLXWindowImpl( const VCLXWindowImpl& ); // never implemented
+ VCLXWindowImpl& operator=( const VCLXWindowImpl& ); // never implemented
+};
+
+//--------------------------------------------------------------------
+VCLXWindowImpl::VCLXWindowImpl( VCLXWindow& _rAntiImpl, ::vos::IMutex& _rMutex, bool _bWithDefaultProps )
+ :mrAntiImpl( _rAntiImpl )
+ ,mrMutex( _rMutex )
+ ,mbDisposed( false )
+ ,mbDrawingOntoParent( false )
+ ,mbEnableVisible(sal_True)
+ ,mbDirectVisible(sal_True)
+ ,maListenerContainerMutex( )
+ ,maWindow2Listeners( maListenerContainerMutex )
+ ,maDockableWindowListeners( maListenerContainerMutex )
+ ,maEventListeners( _rAntiImpl )
+ ,maFocusListeners( _rAntiImpl )
+ ,maWindowListeners( _rAntiImpl )
+ ,maKeyListeners( _rAntiImpl )
+ ,maMouseListeners( _rAntiImpl )
+ ,maMouseMotionListeners( _rAntiImpl )
+ ,maPaintListeners( _rAntiImpl )
+ ,maContainerListeners( _rAntiImpl )
+ ,maTopWindowListeners( _rAntiImpl )
+ ,mnEventId( 0 )
+ ,mbDisposing( false )
+ ,mbDesignMode( false )
+ ,mbSynthesizingVCLEvent( false )
+ ,mbWithDefaultProps( _bWithDefaultProps )
+ ,mnListenerLockLevel( 0 )
+ ,mnWritingMode( WritingMode2::CONTEXT )
+ ,mnContextWritingMode( WritingMode2::CONTEXT )
+ ,mpPropHelper( NULL )
+{
+}
+
+VCLXWindowImpl::~VCLXWindowImpl()
+{
+ delete mpPropHelper;
+}
+
+//--------------------------------------------------------------------
+void VCLXWindowImpl::disposing()
+{
+ ::vos::OGuard aGuard( mrMutex );
+ if ( mnEventId )
+ Application::RemoveUserEvent( mnEventId );
+ mnEventId = 0;
+ mbDisposed= true;
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = mrAntiImpl;
+
+ maEventListeners.disposeAndClear( aEvent );
+ maFocusListeners.disposeAndClear( aEvent );
+ maWindowListeners.disposeAndClear( aEvent );
+ maKeyListeners.disposeAndClear( aEvent );
+ maMouseListeners.disposeAndClear( aEvent );
+ maMouseMotionListeners.disposeAndClear( aEvent );
+ maPaintListeners.disposeAndClear( aEvent );
+ maContainerListeners.disposeAndClear( aEvent );
+ maTopWindowListeners.disposeAndClear( aEvent );
+
+}
+
+//--------------------------------------------------------------------
+void VCLXWindowImpl::impl_notifyAnyEvent( const ::rtl::Reference< ::comphelper::AnyEvent >& _rEvent )
+{
+ maEvents.push_back( _rEvent );
+ if ( !mnEventId )
+ mnEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessEvent ) );
+}
+
+//--------------------------------------------------------------------
+void VCLXWindowImpl::notifyMouseEvent( const awt::MouseEvent& _rMouseEvent, MouseEventType _nType )
+{
+ ::vos::OClearableGuard aGuard( mrMutex );
+ if ( maMouseListeners.getLength() )
+ impl_notifyAnyEvent( new AnyWindowEvent( _rMouseEvent, _nType ) );
+}
+
+//--------------------------------------------------------------------
+void VCLXWindowImpl::notifyPlainEvent( const lang::EventObject& _rPlainEvent, PlainEventType _nType )
+{
+ ::vos::OClearableGuard aGuard( mrMutex );
+ if ( maWindow2Listeners.getLength() )
+ impl_notifyAnyEvent( new AnyWindowEvent( _rPlainEvent, _nType ) );
+}
+
+//--------------------------------------------------------------------
+IMPL_LINK( VCLXWindowImpl, OnProcessEvent, void*, EMPTYARG )
+{
+ // work on a copy of the events array
+ EventArray aEventsCopy;
+ {
+ ::vos::OGuard aGuard( mrMutex );
+ aEventsCopy = maEvents;
+ maEvents.clear();
+
+ if ( !mnEventId )
+ // we were disposed while waiting for the mutex to lock
+ return 1L;
+
+ mnEventId = 0;
+ }
+
+ {
+ ::toolkit::ReleaseSolarMutex aReleaseSolar;
+ for ( EventArray::const_iterator loop = aEventsCopy.begin();
+ loop != aEventsCopy.end();
+ ++loop
+ )
+ {
+ processEvent( *(*loop) );
+ }
+ }
+
+ return 0L;
+}
+
+//--------------------------------------------------------------------
+void VCLXWindowImpl::processEvent( const ::comphelper::AnyEvent& _rEvent )
+{
+ ::vos::OGuard aGuard( mrMutex );
+ if ( impl_isDisposed() )
+ // while we were waiting for our mutex, another thread disposed us
+ return;
+
+ const AnyWindowEvent& rEventDescriptor( static_cast< const AnyWindowEvent& >( _rEvent ) );
+ if ( rEventDescriptor.isMouseEvent() )
+ {
+ const awt::MouseEvent& rEvent( rEventDescriptor.getMouseEvent() );
+ switch ( rEventDescriptor.getMouseEventType() )
+ {
+ case EVENT_MOUSE_PRESSED:
+ maMouseListeners.mousePressed( rEvent );
+ break;
+ case EVENT_MOUSE_RELEASED:
+ maMouseListeners.mouseReleased( rEvent );
+ break;
+ case EVENT_MOUSE_ENTERED:
+ maMouseListeners.mouseEntered( rEvent );
+ break;
+ case EVENT_MOUSE_EXITED:
+ maMouseListeners.mouseExited( rEvent );
+ break;
+ default:
+ DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (1)?" );
+ break;
+ }
+ }
+ else if ( rEventDescriptor.isPlainEvent() )
+ {
+ const lang::EventObject& rEvent( rEventDescriptor.getPlainEvent() );
+ switch ( rEventDescriptor.getPlainEventType() )
+ {
+ case EVENT_WINDOW_ENABLED:
+ maWindow2Listeners.notifyEach( &XWindowListener2::windowEnabled, rEvent );
+ break;
+ case EVENT_WINDOW_DISABLED:
+ maWindow2Listeners.notifyEach( &XWindowListener2::windowDisabled, rEvent );
+ break;
+ default:
+ DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (2)?" );
+ break;
+ }
+ }
+ else
+ {
+ DBG_ERROR( "VCLXWindowImpl::processEvent: what kind of event *is* this (3)?" );
+ }
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXWindowImpl::acquire()
+{
+ mrAntiImpl.acquire();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXWindowImpl::release()
+{
+ mrAntiImpl.release();
+}
+
+//====================================================================
+//====================================================================
+
+// Mit Out-Parameter besser als Rueckgabewert, wegen Ref-Objekt...
+
+void ImplInitWindowEvent( ::com::sun::star::awt::WindowEvent& rEvent, Window* pWindow )
+{
+ Point aPos = pWindow->GetPosPixel();
+ Size aSz = pWindow->GetSizePixel();
+
+ rEvent.X = aPos.X();
+ rEvent.Y = aPos.Y();
+
+ rEvent.Width = aSz.Width();
+ rEvent.Height = aSz.Height();
+
+ pWindow->GetBorder( rEvent.LeftInset, rEvent.TopInset, rEvent.RightInset, rEvent.BottomInset );
+}
+
+// ----------------------------------------------------
+// class VCLXWindow
+// ----------------------------------------------------
+
+DBG_NAME(VCLXWindow);
+
+VCLXWindow::VCLXWindow( bool _bWithDefaultProps )
+ :mpImpl( NULL )
+{
+ DBG_CTOR( VCLXWindow, 0 );
+
+ mpImpl = new VCLXWindowImpl( *this, GetMutex(), _bWithDefaultProps );
+}
+
+VCLXWindow::~VCLXWindow()
+{
+ DBG_DTOR( VCLXWindow, 0 );
+
+ delete mpImpl;
+
+ if ( GetWindow() )
+ {
+ GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
+ GetWindow()->SetWindowPeer( NULL, NULL );
+ GetWindow()->SetAccessible( NULL );
+ }
+}
+
+::toolkit::IAccessibleFactory& VCLXWindow::getAccessibleFactory()
+{
+ return mpImpl->getAccessibleFactory().getFactory();
+}
+
+void VCLXWindow::SetWindow( Window* pWindow )
+{
+ if ( GetWindow() )
+ {
+ GetWindow()->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
+// GetWindow()->DbgAssertNoEventListeners();
+ }
+
+ SetOutputDevice( pWindow );
+
+ if ( GetWindow() )
+ {
+ GetWindow()->AddEventListener( LINK( this, VCLXWindow, WindowEventListener ) );
+ sal_Bool bDirectVisible = pWindow ? pWindow->IsVisible() : false;
+ mpImpl->setDirectVisible( bDirectVisible );
+ }
+
+}
+
+void VCLXWindow::suspendVclEventListening( )
+{
+ ++mpImpl->mnListenerLockLevel;
+}
+
+void VCLXWindow::resumeVclEventListening( )
+{
+ DBG_ASSERT( mpImpl->mnListenerLockLevel, "VCLXWindow::resumeVclEventListening: not suspended!" );
+ --mpImpl->mnListenerLockLevel;
+}
+
+void VCLXWindow::notifyWindowRemoved( Window& _rWindow )
+{
+ if ( mpImpl->getContainerListeners().getLength() )
+ {
+ awt::VclContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Child = static_cast< XWindow* >( _rWindow.GetWindowPeer() );
+ mpImpl->getContainerListeners().windowRemoved( aEvent );
+ }
+}
+
+IMPL_LINK( VCLXWindow, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+ if ( mpImpl->mnListenerLockLevel )
+ return 0L;
+
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow() && GetWindow(), "Window???" );
+ ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+ }
+ return 0;
+}
+
+void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xThis( (::cppu::OWeakObject*)this );
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_ENABLED:
+ case VCLEVENT_WINDOW_DISABLED:
+ {
+ bool bEnabled = ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() );
+ EventObject aEvent( *this );
+ mpImpl->notifyPlainEvent( aEvent,
+ bEnabled ? EVENT_WINDOW_ENABLED : EVENT_WINDOW_DISABLED );
+ }
+ break;
+
+ case VCLEVENT_WINDOW_PAINT:
+ {
+ if ( mpImpl->getPaintListeners().getLength() )
+ {
+ ::com::sun::star::awt::PaintEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.UpdateRect = AWTRectangle( *(Rectangle*)rVclWindowEvent.GetData() );
+ aEvent.Count = 0;
+ mpImpl->getPaintListeners().windowPaint( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MOVE:
+ {
+ if ( mpImpl->getWindowListeners().getLength() )
+ {
+ ::com::sun::star::awt::WindowEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
+ mpImpl->getWindowListeners().windowMoved( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_RESIZE:
+ {
+ if ( mpImpl->getWindowListeners().getLength() )
+ {
+ ::com::sun::star::awt::WindowEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
+ mpImpl->getWindowListeners().windowResized( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_SHOW:
+ {
+ if ( mpImpl->getWindowListeners().getLength() )
+ {
+ ::com::sun::star::awt::WindowEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
+ mpImpl->getWindowListeners().windowShown( aEvent );
+ }
+
+ // For TopWindows this means opened...
+ if ( mpImpl->getTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getTopWindowListeners().windowOpened( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_HIDE:
+ {
+ if ( mpImpl->getWindowListeners().getLength() )
+ {
+ ::com::sun::star::awt::WindowEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ ImplInitWindowEvent( aEvent, rVclWindowEvent.GetWindow() );
+ mpImpl->getWindowListeners().windowHidden( aEvent );
+ }
+
+ // For TopWindows this means closed...
+ if ( mpImpl->getTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getTopWindowListeners().windowClosed( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_ACTIVATE:
+ {
+ if ( mpImpl->getTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getTopWindowListeners().windowActivated( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_DEACTIVATE:
+ {
+ if ( mpImpl->getTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getTopWindowListeners().windowDeactivated( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_CLOSE:
+ {
+ if ( mpImpl->getDockableWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::closed, aEvent );
+ }
+ if ( mpImpl->getTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getTopWindowListeners().windowClosing( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_CONTROL_GETFOCUS:
+ case VCLEVENT_WINDOW_GETFOCUS:
+ {
+ if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
+ && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_GETFOCUS
+ )
+ || ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
+ && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_GETFOCUS
+ )
+ )
+ {
+ if ( mpImpl->getFocusListeners().getLength() )
+ {
+ ::com::sun::star::awt::FocusEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
+ aEvent.Temporary = sal_False;
+ mpImpl->getFocusListeners().focusGained( aEvent );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_CONTROL_LOSEFOCUS:
+ case VCLEVENT_WINDOW_LOSEFOCUS:
+ {
+ if ( ( rVclWindowEvent.GetWindow()->IsCompoundControl()
+ && rVclWindowEvent.GetId() == VCLEVENT_CONTROL_LOSEFOCUS
+ )
+ || ( !rVclWindowEvent.GetWindow()->IsCompoundControl()
+ && rVclWindowEvent.GetId() == VCLEVENT_WINDOW_LOSEFOCUS
+ )
+ )
+ {
+ if ( mpImpl->getFocusListeners().getLength() )
+ {
+ ::com::sun::star::awt::FocusEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags();
+ aEvent.Temporary = sal_False;
+
+ Window* pNext = Application::GetFocusWindow();
+ if ( pNext )
+ {
+ // Bei zusammengesetzten Controls interessiert sich keiner fuer das Innenleben:
+ Window* pNextC = pNext;
+ while ( pNextC && !pNextC->IsCompoundControl() )
+ pNextC = pNextC->GetParent();
+ if ( pNextC )
+ pNext = pNextC;
+
+ pNext->GetComponentInterface( sal_True );
+ aEvent.NextFocus = (::cppu::OWeakObject*)pNext->GetWindowPeer();
+ }
+ mpImpl->getFocusListeners().focusLost( aEvent );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MINIMIZE:
+ {
+ if ( mpImpl->getTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getTopWindowListeners().windowMinimized( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_NORMALIZE:
+ {
+ if ( mpImpl->getTopWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getTopWindowListeners().windowNormalized( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_KEYINPUT:
+ {
+ if ( mpImpl->getKeyListeners().getLength() )
+ {
+ ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
+ *(KeyEvent*)rVclWindowEvent.GetData(), *this
+ ) );
+ mpImpl->getKeyListeners().keyPressed( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_KEYUP:
+ {
+ if ( mpImpl->getKeyListeners().getLength() )
+ {
+ ::com::sun::star::awt::KeyEvent aEvent( VCLUnoHelper::createKeyEvent(
+ *(KeyEvent*)rVclWindowEvent.GetData(), *this
+ ) );
+ mpImpl->getKeyListeners().keyReleased( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_COMMAND:
+ {
+ CommandEvent* pCmdEvt = (CommandEvent*)rVclWindowEvent.GetData();
+ if ( mpImpl->getMouseListeners().getLength() && ( pCmdEvt->GetCommand() == COMMAND_CONTEXTMENU ) )
+ {
+ // COMMAND_CONTEXTMENU als mousePressed mit PopupTrigger = sal_True versenden...
+ Point aWhere = static_cast< CommandEvent* >( rVclWindowEvent.GetData() )->GetMousePosPixel();
+ if ( !pCmdEvt->IsMouseEvent() )
+ { // for keyboard events, we set the coordinates to -1,-1. This is a slight HACK, but the current API
+ // handles a context menu command as special case of a mouse event, which is simply wrong.
+ // Without extending the API, we would not have another chance to notify listeners of a
+ // keyboard-triggered context menu request
+ // 102205 - 16.08.2002 - fs@openoffice.org
+ aWhere = Point( -1, -1 );
+ }
+
+ MouseEvent aMEvt( aWhere, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT, 0 );
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( aMEvt, *this ) );
+ aEvent.PopupTrigger = sal_True;
+ mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MOUSEMOVE:
+ {
+ MouseEvent* pMouseEvt = (MouseEvent*)rVclWindowEvent.GetData();
+ if ( mpImpl->getMouseListeners().getLength() && ( pMouseEvt->IsEnterWindow() || pMouseEvt->IsLeaveWindow() ) )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
+ mpImpl->notifyMouseEvent(
+ aEvent,
+ pMouseEvt->IsEnterWindow() ? EVENT_MOUSE_ENTERED : EVENT_MOUSE_EXITED
+ );
+ }
+
+ if ( mpImpl->getMouseMotionListeners().getLength() && !pMouseEvt->IsEnterWindow() && !pMouseEvt->IsLeaveWindow() )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *pMouseEvt, *this ) );
+ aEvent.ClickCount = 0; // #92138#
+ if ( pMouseEvt->GetMode() & MOUSE_SIMPLEMOVE )
+ mpImpl->getMouseMotionListeners().mouseMoved( aEvent );
+ else
+ mpImpl->getMouseMotionListeners().mouseDragged( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MOUSEBUTTONDOWN:
+ {
+ if ( mpImpl->getMouseListeners().getLength() )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
+ mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_PRESSED );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ if ( mpImpl->getMouseListeners().getLength() )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
+ mpImpl->notifyMouseEvent( aEvent, EVENT_MOUSE_RELEASED );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_STARTDOCKING:
+ {
+ if ( mpImpl->getDockableWindowListeners().getLength() )
+ {
+ DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
+
+ if( pData )
+ {
+ ::com::sun::star::awt::DockingEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
+ aEvent.MousePos.X = pData->maMousePos.X();
+ aEvent.MousePos.Y = pData->maMousePos.Y();
+ aEvent.bLiveMode = pData->mbLivemode;
+ aEvent.bInteractive = pData->mbInteractive;
+
+ mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::startDocking, aEvent );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_DOCKING:
+ {
+ if ( mpImpl->getDockableWindowListeners().getLength() )
+ {
+ DockingData *pData = (DockingData*)rVclWindowEvent.GetData();
+
+ if( pData )
+ {
+ ::com::sun::star::awt::DockingEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.TrackingRectangle = AWTRectangle( pData->maTrackRect );
+ aEvent.MousePos.X = pData->maMousePos.X();
+ aEvent.MousePos.Y = pData->maMousePos.Y();
+ aEvent.bLiveMode = pData->mbLivemode;
+ aEvent.bInteractive = pData->mbInteractive;
+
+ Reference< XDockableWindowListener > xFirstListener;
+ ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() );
+ while ( aIter.hasMoreElements() && !xFirstListener.is() )
+ {
+ xFirstListener.set( aIter.next(), UNO_QUERY );
+ }
+
+ ::com::sun::star::awt::DockingData aDockingData =
+ xFirstListener->docking( aEvent );
+ pData->maTrackRect = VCLRectangle( aDockingData.TrackingRectangle );
+ pData->mbFloating = aDockingData.bFloating;
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_ENDDOCKING:
+ {
+ if ( mpImpl->getDockableWindowListeners().getLength() )
+ {
+ EndDockingData *pData = (EndDockingData*)rVclWindowEvent.GetData();
+
+ if( pData )
+ {
+ ::com::sun::star::awt::EndDockingEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.WindowRectangle = AWTRectangle( pData->maWindowRect );
+ aEvent.bFloating = pData->mbFloating;
+ aEvent.bCancelled = pData->mbCancelled;
+ mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endDocking, aEvent );
+ }
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_PREPARETOGGLEFLOATING:
+ {
+ if ( mpImpl->getDockableWindowListeners().getLength() )
+ {
+ BOOL *p_bFloating = (BOOL*)rVclWindowEvent.GetData();
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+
+ Reference< XDockableWindowListener > xFirstListener;
+ ::cppu::OInterfaceIteratorHelper aIter( mpImpl->getDockableWindowListeners() );
+ while ( aIter.hasMoreElements() && !xFirstListener.is() )
+ {
+ xFirstListener.set( aIter.next(), UNO_QUERY );
+ }
+
+ *p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_TOGGLEFLOATING:
+ {
+ if ( mpImpl->getDockableWindowListeners().getLength() )
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::toggleFloatingMode, aEvent );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_ENDPOPUPMODE:
+ {
+ if ( mpImpl->getDockableWindowListeners().getLength() )
+ {
+ EndPopupModeData *pData = (EndPopupModeData*)rVclWindowEvent.GetData();
+
+ if( pData )
+ {
+ ::com::sun::star::awt::EndPopupModeEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.FloatingPosition.X = pData->maFloatingPos.X();
+ aEvent.FloatingPosition.Y = pData->maFloatingPos.Y();
+ aEvent.bTearoff = pData->mbTearoff;
+ mpImpl->getDockableWindowListeners().notifyEach( &XDockableWindowListener::endPopupMode, aEvent );
+ }
+ }
+ }
+ break;
+
+ }
+}
+
+uno::Reference< accessibility::XAccessibleContext > VCLXWindow::CreateAccessibleContext()
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXWindow::SetSynthesizingVCLEvent( sal_Bool _b )
+{
+ mpImpl->mbSynthesizingVCLEvent = _b;
+}
+
+BOOL VCLXWindow::IsSynthesizingVCLEvent() const
+{
+ return mpImpl->mbSynthesizingVCLEvent;
+}
+
+Size VCLXWindow::ImplCalcWindowSize( const Size& rOutSz ) const
+{
+ Size aSz = rOutSz;
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ sal_Int32 nLeft, nTop, nRight, nBottom;
+ pWindow->GetBorder( nLeft, nTop, nRight, nBottom );
+ aSz.Width() += nLeft+nRight;
+ aSz.Height() += nTop+nBottom;
+ }
+ return aSz;
+}
+
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL2( VCLXWindow, VCLXDevice )
+
+// ::com::sun::star::lang::Component
+void VCLXWindow::dispose( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mpImpl->mxViewGraphics = NULL;
+
+ if ( !mpImpl->mbDisposing )
+ {
+ mpImpl->mbDisposing = true;
+
+ mpImpl->disposing();
+
+ if ( GetWindow() )
+ {
+ OutputDevice* pOutDev = GetOutputDevice();
+ SetWindow( NULL ); // Damit ggf. Handler abgemeldet werden (virtuell).
+ SetOutputDevice( pOutDev );
+ DestroyOutputDevice();
+ }
+
+ // #i14103# dispose the accessible context after the window has been destroyed,
+ // otherwise the old value in the child event fired in VCLXAccessibleComponent::ProcessWindowEvent()
+ // for VCLEVENT_WINDOW_CHILDDESTROYED contains a reference to an already disposed accessible object
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComponent( mpImpl->mxAccessibleContext, ::com::sun::star::uno::UNO_QUERY );
+ if ( xComponent.is() )
+ xComponent->dispose();
+ }
+ catch ( const ::com::sun::star::uno::Exception& )
+ {
+ DBG_ERROR( "VCLXWindow::dispose: could not dispose the accessible context!" );
+ }
+ mpImpl->mxAccessibleContext.clear();
+
+ mpImpl->mbDisposing = false;
+ }
+}
+
+void VCLXWindow::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mpImpl->getEventListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mpImpl->getEventListeners().removeInterface( rxListener );
+}
+
+
+// ::com::sun::star::awt::XWindow
+void VCLXWindow::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
+ Window::GetDockingManager()->SetPosSizePixel( GetWindow() , X, Y, Width, Height, Flags );
+ else
+ GetWindow()->SetPosSizePixel( X, Y, Width, Height, Flags );
+ }
+}
+
+::com::sun::star::awt::Rectangle VCLXWindow::getPosSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Rectangle aBounds;
+ if ( GetWindow() )
+ {
+ if( Window::GetDockingManager()->IsDockable( GetWindow() ) )
+ aBounds = AWTRectangle( Window::GetDockingManager()->GetPosSizePixel( GetWindow() ) );
+ else
+ aBounds = AWTRectangle( Rectangle( GetWindow()->GetPosPixel(), GetWindow()->GetSizePixel() ) );
+ }
+
+ return aBounds;
+}
+
+void VCLXWindow::setVisible( sal_Bool bVisible ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+/*
+ if ( bVisible )
+ {
+ // #57167# TopWindows mit unsichtbaren Parent anzeigen...
+ ::com::sun::star::uno::Any aTest = queryInterface( ::getCppuType( (const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >*) 0 ) );
+ if ( aTest.hasValue() )
+ {
+ Window* pParent = pWindow->GetWindow( WINDOW_PARENTOVERLAP );
+ if ( pParent && !pParent->IsReallyVisible() )
+ pWindow->SetParent( pWindow->GetWindow( WINDOW_FRAME ) );
+ }
+ }
+*/
+ mpImpl->setDirectVisible( bVisible );
+ pWindow->Show( bVisible && mpImpl->isEnableVisible() );
+ }
+}
+
+void VCLXWindow::setEnable( sal_Bool bEnable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ pWindow->Enable( bEnable, FALSE ); // #95824# without children!
+ pWindow->EnableInput( bEnable );
+ }
+}
+
+void VCLXWindow::setFocus( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->GrabFocus();
+}
+
+void VCLXWindow::addWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mpImpl->getWindowListeners().addInterface( rxListener );
+
+ Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
+ if ( xListener2.is() )
+ mpImpl->getWindow2Listeners().addInterface( xListener2 );
+
+ // #100119# Get all resize events, even if height or width 0, or invisible
+ if ( GetWindow() )
+ GetWindow()->EnableAllResize( TRUE );
+}
+
+void VCLXWindow::removeWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Reference< XWindowListener2 > xListener2( rxListener, UNO_QUERY );
+ if ( xListener2.is() )
+ mpImpl->getWindow2Listeners().removeInterface( xListener2 );
+
+ mpImpl->getWindowListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getFocusListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeFocusListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getFocusListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getKeyListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeKeyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XKeyListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getKeyListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getMouseListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeMouseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getMouseListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getMouseMotionListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getMouseMotionListeners().removeInterface( rxListener );
+}
+
+void VCLXWindow::addPaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getPaintListeners().addInterface( rxListener );
+}
+
+void VCLXWindow::removePaintListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPaintListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ mpImpl->getPaintListeners().removeInterface( rxListener );
+}
+
+// ::com::sun::star::awt::XWindowPeer
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > VCLXWindow::getToolkit( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ // no guard. nothing to guard here.
+ // 82463 - 12/21/00 - fs
+ return Application::GetVCLToolkit();
+}
+
+void VCLXWindow::setPointer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer >& rxPointer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ VCLXPointer* pPointer = VCLXPointer::GetImplementation( rxPointer );
+ if ( pPointer )
+ {
+ mpImpl->mxPointer = rxPointer;
+ if ( GetWindow() )
+ GetWindow()->SetPointer( pPointer->GetPointer() );
+ }
+}
+
+void VCLXWindow::setBackground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ Color aColor( (sal_uInt32)nColor );
+ GetWindow()->SetBackground( aColor );
+ GetWindow()->SetControlBackground( aColor );
+
+ WindowType eWinType = GetWindow()->GetType();
+ if ( ( eWinType == WINDOW_WINDOW ) ||
+ ( eWinType == WINDOW_WORKWINDOW ) ||
+ ( eWinType == WINDOW_FLOATINGWINDOW ) )
+ {
+ GetWindow()->Invalidate();
+ }
+ }
+}
+
+void VCLXWindow::invalidate( sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->Invalidate( (sal_uInt16) nInvalidateFlags );
+}
+
+void VCLXWindow::invalidateRect( const ::com::sun::star::awt::Rectangle& rRect, sal_Int16 nInvalidateFlags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->Invalidate( VCLRectangle(rRect), (sal_uInt16) nInvalidateFlags );
+}
+
+
+// ::com::sun::star::awt::XVclWindowPeer
+sal_Bool VCLXWindow::isChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rxPeer ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Bool bIsChild = sal_False;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ Window* pPeerWindow = VCLUnoHelper::GetWindow( rxPeer );
+ bIsChild = pPeerWindow && pWindow->IsChild( pPeerWindow );
+ }
+
+ return bIsChild;
+}
+
+void VCLXWindow::setDesignMode( sal_Bool bOn ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mpImpl->mbDesignMode = bOn;
+}
+
+sal_Bool VCLXWindow::isDesignMode( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ return mpImpl->mbDesignMode;
+}
+
+void VCLXWindow::enableClipSiblings( sal_Bool bClip ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->EnableClipSiblings( bClip );
+}
+
+void VCLXWindow::setForeground( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ Color aColor( (sal_uInt32)nColor );
+ GetWindow()->SetControlForeground( aColor );
+ }
+}
+
+void VCLXWindow::setControlFont( const ::com::sun::star::awt::FontDescriptor& rFont ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ GetWindow()->SetControlFont( VCLUnoHelper::CreateFont( rFont, GetWindow()->GetControlFont() ) );
+}
+
+void VCLXWindow::getStyles( sal_Int16 nType, ::com::sun::star::awt::FontDescriptor& Font, sal_Int32& ForegroundColor, sal_Int32& BackgroundColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ const StyleSettings& rStyleSettings = GetWindow()->GetSettings().GetStyleSettings();
+
+ switch ( nType )
+ {
+ case ::com::sun::star::awt::Style::FRAME:
+ {
+ Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
+ ForegroundColor = rStyleSettings.GetWindowTextColor().GetColor();
+ BackgroundColor = rStyleSettings.GetWindowColor().GetColor();
+ }
+ break;
+ case ::com::sun::star::awt::Style::DIALOG:
+ {
+ Font = VCLUnoHelper::CreateFontDescriptor( rStyleSettings.GetAppFont() );
+ ForegroundColor = rStyleSettings.GetDialogTextColor().GetColor();
+ BackgroundColor = rStyleSettings.GetDialogColor().GetColor();
+ }
+ break;
+ default: DBG_ERROR( "VCLWindow::getStyles() - unknown Type" );
+ }
+
+ }
+}
+
+namespace toolkit
+{
+ static void setColorSettings( Window* _pWindow, const ::com::sun::star::uno::Any& _rValue,
+ void (StyleSettings::*pSetter)( const Color& ), const Color& (StyleSettings::*pGetter)( ) const )
+ {
+ sal_Int32 nColor = 0;
+ if ( !( _rValue >>= nColor ) )
+ nColor = (Application::GetSettings().GetStyleSettings().*pGetter)().GetColor();
+
+ AllSettings aSettings = _pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+
+ (aStyleSettings.*pSetter)( Color( nColor ) );
+
+ aSettings.SetStyleSettings( aStyleSettings );
+ _pWindow->SetSettings( aSettings, TRUE );
+ }
+}
+
+// Terminated by BASEPROPERTY_NOTFOUND (or 0)
+void VCLXWindow::PushPropertyIds( std::list< sal_uInt16 > &rIds,
+ int nFirstId, ...)
+{
+ va_list pVarArgs;
+ va_start( pVarArgs, nFirstId );
+
+ for ( int nId = nFirstId; nId != BASEPROPERTY_NOTFOUND;
+ nId = va_arg( pVarArgs, int ) )
+ rIds.push_back( (sal_uInt16) nId );
+
+ va_end( pVarArgs );
+}
+
+void VCLXWindow::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds, bool bWithDefaults )
+{
+ // These are common across ~all VCLXWindow derived classes
+ if( bWithDefaults )
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_TEXT,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_ENABLEVISIBLE, // for visibility
+ BASEPROPERTY_TABSTOP,
+ 0);
+
+ // lovely hack from:
+ // void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
+ std::list< sal_uInt16 >::const_iterator iter;
+ for( iter = rIds.begin(); iter != rIds.end(); iter++) {
+ if( *iter == BASEPROPERTY_FONTDESCRIPTOR )
+ {
+ // some properties are not included in the FontDescriptor, but everytime
+ // when we have a FontDescriptor we want to have these properties too.
+ // => Easier to register the here, istead everywhere where I register the FontDescriptor...
+
+ rIds.push_back( BASEPROPERTY_TEXTCOLOR );
+ rIds.push_back( BASEPROPERTY_TEXTLINECOLOR );
+ rIds.push_back( BASEPROPERTY_FONTRELIEF );
+ rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK );
+ break;
+ }
+ }
+}
+
+void VCLXWindow::GetPropertyIds( std::list< sal_uInt16 >& _out_rIds )
+{
+ return ImplGetPropertyIds( _out_rIds, mpImpl->mbWithDefaultProps );
+}
+
+::cppu::OInterfaceContainerHelper& VCLXWindow::GetContainerListeners()
+{
+ return mpImpl->getContainerListeners();
+}
+
+::cppu::OInterfaceContainerHelper& VCLXWindow::GetTopWindowListeners()
+{
+ return mpImpl->getTopWindowListeners();
+}
+
+namespace
+{
+ void lcl_updateWritingMode( Window& _rWindow, const sal_Int16 _nWritingMode, const sal_Int16 _nContextWritingMode )
+ {
+ BOOL bEnableRTL = FALSE;
+ switch ( _nWritingMode )
+ {
+ case WritingMode2::LR_TB: bEnableRTL = FALSE; break;
+ case WritingMode2::RL_TB: bEnableRTL = TRUE; break;
+ case WritingMode2::CONTEXT:
+ {
+ // consult our ContextWritingMode. If it has an explicit RTL/LTR value, then use
+ // it. If it doesn't (but is CONTEXT itself), then just ask the parent window of our
+ // own window for its RTL mode
+ switch ( _nContextWritingMode )
+ {
+ case WritingMode2::LR_TB: bEnableRTL = FALSE; break;
+ case WritingMode2::RL_TB: bEnableRTL = TRUE; break;
+ case WritingMode2::CONTEXT:
+ {
+ const Window* pParent = _rWindow.GetParent();
+ OSL_ENSURE( pParent, "lcl_updateWritingMode: cannot determine context's writing mode!" );
+ if ( pParent )
+ bEnableRTL = pParent->IsRTLEnabled();
+ }
+ break;
+ }
+ }
+ break;
+ default:
+ OSL_ENSURE( false, "lcl_updateWritingMode: unsupported WritingMode!" );
+ } // switch ( nWritingMode )
+
+ _rWindow.EnableRTL( bEnableRTL );
+ }
+}
+
+void VCLXWindow::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( !pWindow )
+ return;
+
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ WindowType eWinType = pWindow->GetType();
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_REFERENCE_DEVICE:
+ {
+ Control* pControl = dynamic_cast< Control* >( pWindow );
+ OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
+ if ( !pControl )
+ break;
+ Reference< XDevice > xDevice( Value, UNO_QUERY );
+ OutputDevice* pDevice = VCLUnoHelper::GetOutputDevice( xDevice );
+ pControl->SetReferenceDevice( pDevice );
+ }
+ break;
+
+ case BASEPROPERTY_CONTEXT_WRITING_MODE:
+ {
+ OSL_VERIFY( Value >>= mpImpl->mnContextWritingMode );
+ if ( mpImpl->mnWritingMode == WritingMode2::CONTEXT )
+ lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
+ }
+ break;
+
+ case BASEPROPERTY_WRITING_MODE:
+ {
+ sal_Bool bProperType = ( Value >>= mpImpl->mnWritingMode );
+ OSL_ENSURE( bProperType, "VCLXWindow::setProperty( 'WritingMode' ): illegal value type!" );
+ if ( bProperType )
+ lcl_updateWritingMode( *pWindow, mpImpl->mnWritingMode, mpImpl->mnContextWritingMode );
+ }
+ break;
+
+ case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:
+ {
+ sal_uInt16 nWheelBehavior( MouseWheelBehavior::SCROLL_FOCUS_ONLY );
+ OSL_VERIFY( Value >>= nWheelBehavior );
+
+ AllSettings aSettings = pWindow->GetSettings();
+ MouseSettings aMouseSettings = aSettings.GetMouseSettings();
+
+ USHORT nVclBehavior( MOUSE_WHEEL_FOCUS_ONLY );
+ switch ( nWheelBehavior )
+ {
+ case MouseWheelBehavior::SCROLL_DISABLED: nVclBehavior = MOUSE_WHEEL_DISABLE; break;
+ case MouseWheelBehavior::SCROLL_FOCUS_ONLY: nVclBehavior = MOUSE_WHEEL_FOCUS_ONLY; break;
+ case MouseWheelBehavior::SCROLL_ALWAYS: nVclBehavior = MOUSE_WHEEL_ALWAYS; break;
+ default:
+ OSL_ENSURE( false, "VCLXWindow::setProperty( 'MouseWheelBehavior' ): illegal property value!" );
+ }
+
+ aMouseSettings.SetWheelBehavior( nWheelBehavior );
+ aSettings.SetMouseSettings( aMouseSettings );
+ pWindow->SetSettings( aSettings, TRUE );
+ }
+ break;
+
+ case BASEPROPERTY_NATIVE_WIDGET_LOOK:
+ {
+ sal_Bool bEnable( sal_True );
+ OSL_VERIFY( Value >>= bEnable );
+ pWindow->EnableNativeWidget( bEnable );
+ }
+ break;
+
+ case BASEPROPERTY_PLUGINPARENT:
+ {
+ // set parent handle
+ SetSystemParent_Impl( Value );
+ }
+ break;
+
+ case BASEPROPERTY_ENABLED:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ setEnable( b );
+ }
+ break;
+ case BASEPROPERTY_ENABLEVISIBLE:
+ {
+ sal_Bool b = sal_False;
+ if ( Value >>= b )
+ {
+ if( b != mpImpl->isEnableVisible() )
+ {
+ mpImpl->setEnableVisible( b );
+ pWindow->Show( b && mpImpl->isDirectVisible() );
+ }
+ }
+ }
+ break;
+ case BASEPROPERTY_TEXT:
+ case BASEPROPERTY_LABEL:
+ case BASEPROPERTY_TITLE:
+ {
+ ::rtl::OUString aText;
+ if ( Value >>= aText )
+ {
+ switch (eWinType)
+ {
+ case WINDOW_OKBUTTON:
+ case WINDOW_CANCELBUTTON:
+ case WINDOW_HELPBUTTON:
+ // Standard Button: overwrite only if not empty.
+ if (aText.getLength())
+ pWindow->SetText( aText );
+ break;
+
+ default:
+ pWindow->SetText( aText );
+ break;
+ }
+ }
+ }
+ break;
+ case BASEPROPERTY_ACCESSIBLENAME:
+ {
+ ::rtl::OUString aText;
+ if ( Value >>= aText )
+ pWindow->SetAccessibleName( aText );
+ }
+ break;
+ case BASEPROPERTY_HELPURL:
+ {
+ ::rtl::OUString aURL;
+ if ( Value >>= aURL )
+ {
+ String aHelpURL( aURL );
+ String aPattern( RTL_CONSTASCII_USTRINGPARAM( "HID:" ) );
+ if ( aHelpURL.CompareIgnoreCaseToAscii( aPattern, aPattern.Len() ) == COMPARE_EQUAL )
+ {
+ String aID = aHelpURL.Copy( aPattern.Len() );
+ pWindow->SetHelpId( aID.ToInt32() );
+ }
+ else
+ {
+ pWindow->SetSmartHelpId( SmartId( aHelpURL ) );
+ }
+ }
+ }
+ break;
+ case BASEPROPERTY_HELPTEXT:
+ {
+ ::rtl::OUString aHelpText;
+ if ( Value >>= aHelpText )
+ {
+ pWindow->SetQuickHelpText( aHelpText );
+ }
+ }
+ break;
+ case BASEPROPERTY_FONTDESCRIPTOR:
+ {
+ if ( bVoid )
+ pWindow->SetControlFont( Font() );
+ else
+ {
+ ::com::sun::star::awt::FontDescriptor aFont;
+ if ( Value >>= aFont )
+ pWindow->SetControlFont( VCLUnoHelper::CreateFont( aFont, pWindow->GetControlFont() ) );
+ }
+ }
+ break;
+ case BASEPROPERTY_FONTRELIEF:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ {
+ Font aFont = pWindow->GetControlFont();
+ aFont.SetRelief( (FontRelief)n );
+ pWindow->SetControlFont( aFont );
+ }
+ }
+ break;
+ case BASEPROPERTY_FONTEMPHASISMARK:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ {
+ Font aFont = pWindow->GetControlFont();
+ aFont.SetEmphasisMark( n );
+ pWindow->SetControlFont( aFont );
+ }
+ }
+ break;
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ if ( bVoid )
+ {
+ switch ( eWinType )
+ {
+ // set dialog color for default
+ case WINDOW_DIALOG:
+ case WINDOW_MESSBOX:
+ case WINDOW_INFOBOX:
+ case WINDOW_WARNINGBOX:
+ case WINDOW_ERRORBOX:
+ case WINDOW_QUERYBOX:
+ case WINDOW_TABPAGE:
+ {
+ Color aColor = pWindow->GetSettings().GetStyleSettings().GetDialogColor();
+ pWindow->SetBackground( aColor );
+ pWindow->SetControlBackground( aColor );
+ break;
+ }
+
+ case WINDOW_FIXEDTEXT:
+ case WINDOW_CHECKBOX:
+ case WINDOW_RADIOBUTTON:
+ case WINDOW_GROUPBOX:
+ case WINDOW_FIXEDLINE:
+ {
+ // support transparency only for special controls
+ pWindow->SetBackground();
+ pWindow->SetControlBackground();
+ pWindow->SetPaintTransparent( TRUE );
+ break;
+ }
+
+ default:
+ {
+ // default code which enables transparency for
+ // compound controls. It's not real transparency
+ // as most of these controls repaint their client
+ // area completely new.
+ if ( pWindow->IsCompoundControl() )
+ pWindow->SetBackground();
+ pWindow->SetControlBackground();
+ break;
+ }
+ }
+ }
+ else
+ {
+ sal_Int32 nColor = 0;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetControlBackground( aColor );
+ pWindow->SetBackground( aColor );
+ switch ( eWinType )
+ {
+ // reset paint transparent mode
+ case WINDOW_FIXEDTEXT:
+ case WINDOW_CHECKBOX:
+ case WINDOW_RADIOBUTTON:
+ case WINDOW_GROUPBOX:
+ case WINDOW_FIXEDLINE:
+ pWindow->SetPaintTransparent( FALSE );
+ default: ;
+ }
+ pWindow->Invalidate(); // Falls das Control nicht drauf reagiert
+ }
+ }
+ break;
+ case BASEPROPERTY_TEXTCOLOR:
+ if ( bVoid )
+ {
+ pWindow->SetControlForeground();
+ }
+ else
+ {
+ sal_Int32 nColor = 0;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetTextColor( aColor );
+ pWindow->SetControlForeground( aColor );
+ }
+ }
+ break;
+ case BASEPROPERTY_TEXTLINECOLOR:
+ if ( bVoid )
+ {
+ pWindow->SetTextLineColor();
+ }
+ else
+ {
+ sal_Int32 nColor = 0;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetTextLineColor( aColor );
+ }
+ }
+ break;
+ case BASEPROPERTY_FILLCOLOR:
+ if ( bVoid )
+ pWindow->SetFillColor();
+ else
+ {
+ sal_Int32 nColor = 0;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetFillColor( aColor );
+ }
+ }
+ break;
+ case BASEPROPERTY_LINECOLOR:
+ if ( bVoid )
+ pWindow->SetLineColor();
+ else
+ {
+ sal_Int32 nColor = 0;
+ if ( Value >>= nColor )
+ {
+ Color aColor( nColor );
+ pWindow->SetLineColor( aColor );
+ }
+ }
+ break;
+ case BASEPROPERTY_BORDER:
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ sal_uInt16 nBorder = 0;
+ Value >>= nBorder;
+ if ( !nBorder )
+ {
+ pWindow->SetStyle( nStyle & ~WB_BORDER );
+ }
+ else
+ {
+ pWindow->SetStyle( nStyle | WB_BORDER );
+ pWindow->SetBorderStyle( nBorder );
+ }
+ }
+ break;
+ case BASEPROPERTY_TABSTOP:
+ {
+ WinBits nStyle = pWindow->GetStyle() & ~WB_TABSTOP;
+ if ( !bVoid )
+ {
+ sal_Bool bTab = false;
+ Value >>= bTab;
+ if ( bTab )
+ nStyle |= WB_TABSTOP;
+ else
+ nStyle |= WB_NOTABSTOP;
+ }
+ pWindow->SetStyle( nStyle );
+ }
+ break;
+ case BASEPROPERTY_VERTICALALIGN:
+ {
+ VerticalAlignment eAlign = VerticalAlignment_MAKE_FIXED_SIZE;
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_TOP|WB_VCENTER|WB_BOTTOM);
+ if ( !bVoid )
+ Value >>= eAlign;
+ switch ( eAlign )
+ {
+ case VerticalAlignment_TOP:
+ nStyle |= WB_TOP;
+ break;
+ case VerticalAlignment_MIDDLE:
+ nStyle |= WB_VCENTER;
+ break;
+ case VerticalAlignment_BOTTOM:
+ nStyle |= WB_BOTTOM;
+ break;
+ default: ; // for warning free code, MAKE_FIXED_SIZE
+ }
+ pWindow->SetStyle( nStyle );
+ }
+ break;
+ case BASEPROPERTY_ALIGN:
+ {
+ sal_Int16 nAlign = PROPERTY_ALIGN_LEFT;
+ switch ( eWinType )
+ {
+ case WINDOW_COMBOBOX:
+ case WINDOW_BUTTON:
+ case WINDOW_PUSHBUTTON:
+ case WINDOW_OKBUTTON:
+ case WINDOW_CANCELBUTTON:
+ case WINDOW_HELPBUTTON:
+ nAlign = PROPERTY_ALIGN_CENTER;
+ // no break here!
+ case WINDOW_FIXEDTEXT:
+ case WINDOW_EDIT:
+ case WINDOW_MULTILINEEDIT:
+ case WINDOW_CHECKBOX:
+ case WINDOW_RADIOBUTTON:
+ case WINDOW_LISTBOX:
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
+ if ( !bVoid )
+ Value >>= nAlign;
+ if ( nAlign == PROPERTY_ALIGN_LEFT )
+ nStyle |= WB_LEFT;
+ else if ( nAlign == PROPERTY_ALIGN_CENTER )
+ nStyle |= WB_CENTER;
+ else
+ nStyle |= WB_RIGHT;
+ pWindow->SetStyle( nStyle );
+ }
+ break;
+ }
+ }
+ break;
+ case BASEPROPERTY_MULTILINE:
+ {
+ if ( ( eWinType == WINDOW_FIXEDTEXT )
+ || ( eWinType == WINDOW_CHECKBOX )
+ || ( eWinType == WINDOW_RADIOBUTTON )
+ || ( eWinType == WINDOW_BUTTON )
+ || ( eWinType == WINDOW_PUSHBUTTON )
+ || ( eWinType == WINDOW_OKBUTTON )
+ || ( eWinType == WINDOW_CANCELBUTTON )
+ || ( eWinType == WINDOW_HELPBUTTON )
+ )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ sal_Bool bMulti = false;
+ Value >>= bMulti;
+ if ( bMulti )
+ nStyle |= WB_WORDBREAK;
+ else
+ nStyle &= ~WB_WORDBREAK;
+ pWindow->SetStyle( nStyle );
+ }
+ }
+ break;
+ case BASEPROPERTY_ORIENTATION:
+ {
+ switch ( eWinType )
+ {
+ case WINDOW_FIXEDLINE:
+ {
+ sal_Int32 nOrientation = 0;
+ if ( Value >>= nOrientation )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_HORZ|WB_VERT);
+ if ( nOrientation == 0 )
+ nStyle |= WB_HORZ;
+ else
+ nStyle |= WB_VERT;
+
+ pWindow->SetStyle( nStyle );
+ }
+ }
+ break;
+ }
+ }
+ break;
+ case BASEPROPERTY_AUTOMNEMONICS:
+ {
+ sal_Bool bAutoMnemonics = false;
+ Value >>= bAutoMnemonics;
+ AllSettings aSettings = pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+ if ( aStyleSettings.GetAutoMnemonic() != bAutoMnemonics )
+ {
+ aStyleSettings.SetAutoMnemonic( bAutoMnemonics );
+ aSettings.SetStyleSettings( aStyleSettings );
+ pWindow->SetSettings( aSettings );
+ }
+ }
+ break;
+ case BASEPROPERTY_MOUSETRANSPARENT:
+ {
+ sal_Bool bMouseTransparent = false;
+ Value >>= bMouseTransparent;
+ pWindow->SetMouseTransparent( bMouseTransparent );
+ }
+ break;
+ case BASEPROPERTY_PAINTTRANSPARENT:
+ {
+ sal_Bool bPaintTransparent = false;
+ Value >>= bPaintTransparent;
+ pWindow->SetPaintTransparent( bPaintTransparent );
+// pWindow->SetBackground();
+ }
+ break;
+
+ case BASEPROPERTY_REPEAT:
+ {
+ sal_Bool bRepeat( FALSE );
+ Value >>= bRepeat;
+
+ WinBits nStyle = pWindow->GetStyle();
+ if ( bRepeat )
+ nStyle |= WB_REPEAT;
+ else
+ nStyle &= ~WB_REPEAT;
+ pWindow->SetStyle( nStyle );
+ }
+ break;
+
+ case BASEPROPERTY_REPEAT_DELAY:
+ {
+ sal_Int32 nRepeatDelay = 0;
+ if ( Value >>= nRepeatDelay )
+ {
+ AllSettings aSettings = pWindow->GetSettings();
+ MouseSettings aMouseSettings = aSettings.GetMouseSettings();
+
+ aMouseSettings.SetButtonRepeat( nRepeatDelay );
+ aSettings.SetMouseSettings( aMouseSettings );
+
+ pWindow->SetSettings( aSettings, TRUE );
+ }
+ }
+ break;
+
+ case BASEPROPERTY_SYMBOL_COLOR:
+ ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetButtonTextColor, &StyleSettings::GetButtonTextColor );
+ break;
+
+ case BASEPROPERTY_BORDERCOLOR:
+ ::toolkit::setColorSettings( pWindow, Value, &StyleSettings::SetMonoColor, &StyleSettings::GetMonoColor);
+ break;
+ case BASEPROPERTY_DEFAULTCONTROL:
+ {
+ rtl::OUString aName;
+ Value >>= aName;
+ break;
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXWindow::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ if ( GetWindow() )
+ {
+ WindowType eWinType = GetWindow()->GetType();
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_REFERENCE_DEVICE:
+ {
+ Control* pControl = dynamic_cast< Control* >( GetWindow() );
+ OSL_ENSURE( pControl, "VCLXWindow::setProperty( RefDevice ): need a Control for this!" );
+ if ( !pControl )
+ break;
+
+ VCLXDevice* pDevice = new VCLXDevice;
+ pDevice->SetOutputDevice( pControl->GetReferenceDevice() );
+ aProp <<= Reference< XDevice >( pDevice );
+ }
+ break;
+
+ case BASEPROPERTY_CONTEXT_WRITING_MODE:
+ aProp <<= mpImpl->mnContextWritingMode;
+ break;
+
+ case BASEPROPERTY_WRITING_MODE:
+ aProp <<= mpImpl->mnWritingMode;
+ break;
+
+ case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:
+ {
+ USHORT nVclBehavior = GetWindow()->GetSettings().GetMouseSettings().GetWheelBehavior();
+ sal_Int16 nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY;
+ switch ( nVclBehavior )
+ {
+ case MOUSE_WHEEL_DISABLE: nBehavior = MouseWheelBehavior::SCROLL_DISABLED; break;
+ case MOUSE_WHEEL_FOCUS_ONLY: nBehavior = MouseWheelBehavior::SCROLL_FOCUS_ONLY; break;
+ case MOUSE_WHEEL_ALWAYS: nBehavior = MouseWheelBehavior::SCROLL_ALWAYS; break;
+ default:
+ OSL_ENSURE( false, "VCLXWindow::getProperty( 'MouseWheelBehavior' ): illegal VCL value!" );
+ }
+ aProp <<= nBehavior;
+ }
+ break;
+
+ case BASEPROPERTY_NATIVE_WIDGET_LOOK:
+ aProp <<= (sal_Bool) GetWindow()->IsNativeWidgetEnabled();
+ break;
+
+ case BASEPROPERTY_ENABLED:
+ aProp <<= (sal_Bool) GetWindow()->IsEnabled();
+ break;
+
+ case BASEPROPERTY_ENABLEVISIBLE:
+ aProp <<= (sal_Bool) mpImpl->isEnableVisible();
+ break;
+
+ case BASEPROPERTY_HIGHCONTRASTMODE:
+ aProp <<= (sal_Bool) GetWindow()->GetSettings().GetStyleSettings().GetHighContrastMode();
+ break;
+
+ case BASEPROPERTY_TEXT:
+ case BASEPROPERTY_LABEL:
+ case BASEPROPERTY_TITLE:
+ {
+ ::rtl::OUString aText = GetWindow()->GetText();
+ aProp <<= aText;
+ }
+ break;
+ case BASEPROPERTY_ACCESSIBLENAME:
+ {
+ ::rtl::OUString aText = GetWindow()->GetAccessibleName();
+ aProp <<= aText;
+ }
+ break;
+ case BASEPROPERTY_HELPTEXT:
+ {
+ ::rtl::OUString aText = GetWindow()->GetQuickHelpText();
+ aProp <<= aText;
+ }
+ break;
+ case BASEPROPERTY_HELPURL:
+ {
+ SmartId aSmartId = GetWindow()->GetSmartHelpId();
+ if( aSmartId.HasString() )
+ {
+ String aStrHelpId = aSmartId.GetStr();
+ aProp <<= ::rtl::OUString( aStrHelpId );
+ }
+ else
+ {
+ ::rtl::OUStringBuffer aURL;
+ aURL.appendAscii( "HID:" );
+ aURL.append( (sal_Int32) GetWindow()->GetHelpId() );
+ aProp <<= aURL.makeStringAndClear();
+ }
+ }
+ break;
+ case BASEPROPERTY_FONTDESCRIPTOR:
+ {
+ Font aFont = GetWindow()->GetControlFont();
+ ::com::sun::star::awt::FontDescriptor aFD = VCLUnoHelper::CreateFontDescriptor( aFont );
+ aProp <<= aFD;
+ }
+ break;
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetControlBackground().GetColor();
+ break;
+ case BASEPROPERTY_DISPLAYBACKGROUNDCOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetDisplayBackground().GetColor().GetColor();
+ break;
+ case BASEPROPERTY_FONTRELIEF:
+ aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetRelief();
+ break;
+ case BASEPROPERTY_FONTEMPHASISMARK:
+ aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetEmphasisMark();
+ break;
+ case BASEPROPERTY_TEXTCOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetControlForeground().GetColor();
+ break;
+ case BASEPROPERTY_TEXTLINECOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetTextLineColor().GetColor();
+ break;
+ case BASEPROPERTY_FILLCOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetFillColor().GetColor();
+ break;
+ case BASEPROPERTY_LINECOLOR:
+ aProp <<= (sal_Int32) GetWindow()->GetLineColor().GetColor();
+ break;
+ case BASEPROPERTY_BORDER:
+ {
+ sal_Int16 nBorder = 0;
+ if ( GetWindow()->GetStyle() & WB_BORDER )
+ nBorder = GetWindow()->GetBorderStyle();
+ aProp <<= nBorder;
+ }
+ break;
+ case BASEPROPERTY_TABSTOP:
+ aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_TABSTOP ) ? sal_True : sal_False;
+ break;
+ case BASEPROPERTY_VERTICALALIGN:
+ {
+ WinBits nStyle = GetWindow()->GetStyle();
+ if ( nStyle & WB_TOP )
+ aProp <<= VerticalAlignment_TOP;
+ else if ( nStyle & WB_VCENTER )
+ aProp <<= VerticalAlignment_MIDDLE;
+ else if ( nStyle & WB_BOTTOM )
+ aProp <<= VerticalAlignment_BOTTOM;
+ }
+ break;
+ case BASEPROPERTY_ALIGN:
+ {
+ switch ( eWinType )
+ {
+ case WINDOW_FIXEDTEXT:
+ case WINDOW_EDIT:
+ case WINDOW_MULTILINEEDIT:
+ case WINDOW_CHECKBOX:
+ case WINDOW_RADIOBUTTON:
+ case WINDOW_LISTBOX:
+ case WINDOW_COMBOBOX:
+ case WINDOW_BUTTON:
+ case WINDOW_PUSHBUTTON:
+ case WINDOW_OKBUTTON:
+ case WINDOW_CANCELBUTTON:
+ case WINDOW_HELPBUTTON:
+ {
+ WinBits nStyle = GetWindow()->GetStyle();
+ if ( nStyle & WB_LEFT )
+ aProp <<= (sal_Int16) PROPERTY_ALIGN_LEFT;
+ else if ( nStyle & WB_CENTER )
+ aProp <<= (sal_Int16) PROPERTY_ALIGN_CENTER;
+ else if ( nStyle & WB_RIGHT )
+ aProp <<= (sal_Int16) PROPERTY_ALIGN_RIGHT;
+ }
+ break;
+ }
+ }
+ case BASEPROPERTY_MULTILINE:
+ {
+ if ( ( eWinType == WINDOW_FIXEDTEXT )
+ || ( eWinType == WINDOW_CHECKBOX )
+ || ( eWinType == WINDOW_RADIOBUTTON )
+ || ( eWinType == WINDOW_BUTTON )
+ || ( eWinType == WINDOW_PUSHBUTTON )
+ || ( eWinType == WINDOW_OKBUTTON )
+ || ( eWinType == WINDOW_CANCELBUTTON )
+ || ( eWinType == WINDOW_HELPBUTTON )
+ )
+ aProp <<= (sal_Bool) ( GetWindow()->GetStyle() & WB_WORDBREAK ) ? sal_True : sal_False;
+ }
+ break;
+ case BASEPROPERTY_AUTOMNEMONICS:
+ {
+ sal_Bool bAutoMnemonics = GetWindow()->GetSettings().GetStyleSettings().GetAutoMnemonic();
+ aProp <<= bAutoMnemonics;
+ }
+ break;
+ case BASEPROPERTY_MOUSETRANSPARENT:
+ {
+ sal_Bool bMouseTransparent = GetWindow()->IsMouseTransparent();
+ aProp <<= bMouseTransparent;
+ }
+ break;
+ case BASEPROPERTY_PAINTTRANSPARENT:
+ {
+ sal_Bool bPaintTransparent = GetWindow()->IsPaintTransparent();
+ aProp <<= bPaintTransparent;
+ }
+ break;
+
+ case BASEPROPERTY_REPEAT:
+ aProp <<= (sal_Bool)( 0 != ( GetWindow()->GetStyle() & WB_REPEAT ) );
+ break;
+
+ case BASEPROPERTY_REPEAT_DELAY:
+ {
+ sal_Int32 nButtonRepeat = GetWindow()->GetSettings().GetMouseSettings().GetButtonRepeat();
+ aProp <<= (sal_Int32)nButtonRepeat;
+ }
+ break;
+
+ case BASEPROPERTY_SYMBOL_COLOR:
+ aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
+ break;
+
+ case BASEPROPERTY_BORDERCOLOR:
+ aProp <<= (sal_Int32)GetWindow()->GetSettings().GetStyleSettings().GetMonoColor().GetColor();
+ break;
+ }
+ }
+ return aProp;
+}
+
+
+// ::com::sun::star::awt::XLayoutConstrains
+::com::sun::star::awt::Size VCLXWindow::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // Diese Methode sollte nur fuer Componenten gerufen werden, die zwar
+ // ueber das ::com::sun::star::awt::Toolkit erzeugt werden koennen, aber fuer die es
+ // kein Interface gibt.
+
+ Size aSz;
+ if ( GetWindow() )
+ {
+ WindowType nWinType = GetWindow()->GetType();
+ switch ( nWinType )
+ {
+ case WINDOW_CONTROL:
+ aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*12;
+ aSz.Height() = GetWindow()->GetTextHeight()+2*6;
+ break;
+
+ case WINDOW_PATTERNBOX:
+ case WINDOW_NUMERICBOX:
+ case WINDOW_METRICBOX:
+ case WINDOW_CURRENCYBOX:
+ case WINDOW_DATEBOX:
+ case WINDOW_TIMEBOX:
+ case WINDOW_LONGCURRENCYBOX:
+ aSz.Width() = GetWindow()->GetTextWidth( GetWindow()->GetText() )+2*2;
+ aSz.Height() = GetWindow()->GetTextHeight()+2*2;
+ break;
+ case WINDOW_SCROLLBARBOX:
+ return VCLXScrollBar::implGetMinimumSize( GetWindow() );
+ default:
+ aSz = GetWindow()->GetOptimalSize( WINDOWSIZE_MINIMUM );
+ }
+ }
+
+ return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
+}
+
+::com::sun::star::awt::Size VCLXWindow::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXWindow::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aNewSize( rNewSize );
+ ::com::sun::star::awt::Size aMinSize = getMinimumSize();
+
+ if ( aNewSize.Width < aMinSize.Width )
+ aNewSize.Width = aMinSize.Width;
+ if ( aNewSize.Height < aMinSize.Height )
+ aNewSize.Height = aMinSize.Height;
+
+ return aNewSize;
+}
+
+
+// ::com::sun::star::awt::XView
+sal_Bool VCLXWindow::setGraphics( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& rxDevice ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( VCLUnoHelper::GetOutputDevice( rxDevice ) )
+ mpImpl->mxViewGraphics = rxDevice;
+ else
+ mpImpl->mxViewGraphics = NULL;
+
+ return mpImpl->mxViewGraphics.is();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics > VCLXWindow::getGraphics( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ return mpImpl->mxViewGraphics;
+}
+
+::com::sun::star::awt::Size VCLXWindow::getSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ if ( GetWindow() )
+ aSz = GetWindow()->GetSizePixel();
+ return ::com::sun::star::awt::Size( aSz.Width(), aSz.Height() );
+}
+
+void VCLXWindow::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( !pWindow )
+ return;
+
+ if ( isDesignMode() || mpImpl->isEnableVisible() )
+ {
+ TabPage* pTabPage = dynamic_cast< TabPage* >( pWindow );
+ if ( pTabPage )
+ {
+ Point aPos( nX, nY );
+ Size aSize = pWindow->GetSizePixel();
+
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
+ aPos = pDev->PixelToLogic( aPos );
+ aSize = pDev->PixelToLogic( aSize );
+
+ pTabPage->Draw( pDev, aPos, aSize, 0 );
+ return;
+ }
+
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( mpImpl->mxViewGraphics );
+ Point aPos( nX, nY );
+
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ if ( pWindow->GetParent() && !pWindow->IsSystemWindow() && ( pWindow->GetParent() == pDev ) )
+ {
+ // #i40647# don't draw here if this is a recursive call
+ // sometimes this is called recursively, because the Update call on the parent
+ // (strangely) triggers another paint. Prevent a stack overflow here
+ // Yes, this is only fixing symptoms for the moment ....
+ // #i40647# / 2005-01-18 / frank.schoenheit@sun.com
+ if ( !mpImpl->getDrawingOntoParent_ref() )
+ {
+ FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
+
+ BOOL bWasVisible = pWindow->IsVisible();
+ Point aOldPos( pWindow->GetPosPixel() );
+
+ if ( bWasVisible && aOldPos == aPos )
+ {
+ pWindow->Update();
+ return;
+ }
+
+ pWindow->SetPosPixel( aPos );
+
+ // Erstmal ein Update auf den Parent, damit nicht beim Update
+ // auf dieses Fenster noch ein Paint vom Parent abgearbeitet wird,
+ // wo dann ggf. dieses Fenster sofort wieder gehidet wird.
+ if( pWindow->GetParent() )
+ pWindow->GetParent()->Update();
+
+ pWindow->Show();
+ pWindow->Update();
+ pWindow->SetParentUpdateMode( sal_False );
+ pWindow->Hide();
+ pWindow->SetParentUpdateMode( sal_True );
+
+ pWindow->SetPosPixel( aOldPos );
+ if ( bWasVisible )
+ pWindow->Show( TRUE );
+ }
+ }
+ else if ( pDev )
+ {
+ Size aSz = pWindow->GetSizePixel();
+ aSz = pDev->PixelToLogic( aSz );
+ Point aP = pDev->PixelToLogic( aPos );
+
+ vcl::PDFExtOutDevData* pPDFExport = dynamic_cast<vcl::PDFExtOutDevData*>(pDev->GetExtOutDevData());
+ bool bDrawSimple = ( pDev->GetOutDevType() == OUTDEV_PRINTER )
+ || ( pDev->GetOutDevViewType() == OUTDEV_VIEWTYPE_PRINTPREVIEW )
+ || ( pPDFExport != NULL );
+ if ( bDrawSimple )
+ {
+ pWindow->Draw( pDev, aP, aSz, WINDOW_DRAW_NOCONTROLS );
+ }
+ else
+ {
+ BOOL bOldNW =pWindow->IsNativeWidgetEnabled();
+ if( bOldNW )
+ pWindow->EnableNativeWidget(FALSE);
+ pWindow->PaintToDevice( pDev, aP, aSz );
+ if( bOldNW )
+ pWindow->EnableNativeWidget(TRUE);
+ }
+ }
+ }
+}
+
+void VCLXWindow::setZoom( float fZoomX, float /*fZoomY*/ ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ // Fraction::Fraction takes a double, but we have a float only.
+ // The implicit conversion from float to double can result in a precision loss, i.e. 1.2 is converted to
+ // 1.200000000047something. To prevent this, we convert explicitly to double, and round it.
+ double nZoom( fZoomX );
+ nZoom = ::rtl::math::round( nZoom, 4 );
+ GetWindow()->SetZoom( Fraction( nZoom ) );
+ }
+}
+
+// ::com::sun::star::lang::XEventListener
+void SAL_CALL VCLXWindow::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // check if it comes from our AccessibleContext
+ uno::Reference< uno::XInterface > aAC( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
+ uno::Reference< uno::XInterface > xSource( _rSource.Source, uno::UNO_QUERY );
+
+ if ( aAC.get() == xSource.get() )
+ { // yep, it does
+ mpImpl->mxAccessibleContext = uno::Reference< accessibility::XAccessibleContext >();
+ }
+}
+
+// ::com::sun::star::accessibility::XAccessible
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXWindow::getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ using namespace ::com::sun::star;
+
+ ::vos::OGuard aGuard( GetMutex() );
+
+ // already disposed
+ if( ! mpImpl )
+ return uno::Reference< accessibility::XAccessibleContext >();
+
+ if ( !mpImpl->mxAccessibleContext.is() && GetWindow() )
+ {
+ mpImpl->mxAccessibleContext = CreateAccessibleContext();
+
+ // add as event listener to this component
+ // in case somebody disposes it, we do not want to have a (though weak) reference to a dead
+ // object
+ uno::Reference< lang::XComponent > xComp( mpImpl->mxAccessibleContext, uno::UNO_QUERY );
+ if ( xComp.is() )
+ xComp->addEventListener( this );
+ }
+
+ return mpImpl->mxAccessibleContext;
+}
+
+// ::com::sun::star::awt::XDockable
+void SAL_CALL VCLXWindow::addDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( xListener.is() )
+ mpImpl->getDockableWindowListeners().addInterface( xListener );
+
+}
+
+void SAL_CALL VCLXWindow::removeDockableWindowListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindowListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mpImpl->getDockableWindowListeners().removeInterface( xListener );
+}
+
+void SAL_CALL VCLXWindow::enableDocking( sal_Bool bEnable ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->EnableDocking( bEnable );
+}
+
+sal_Bool SAL_CALL VCLXWindow::isFloating( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if( pWindow )
+ return Window::GetDockingManager()->IsFloating( pWindow );
+ else
+ return FALSE;
+}
+
+void SAL_CALL VCLXWindow::setFloatingMode( sal_Bool bFloating ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if( pWindow )
+ Window::GetDockingManager()->SetFloatingMode( pWindow, bFloating );
+}
+
+sal_Bool SAL_CALL VCLXWindow::isLocked( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if( pWindow )
+ return Window::GetDockingManager()->IsLocked( pWindow );
+ else
+ return FALSE;
+}
+
+void SAL_CALL VCLXWindow::lock( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
+ Window::GetDockingManager()->Lock( pWindow );
+}
+
+void SAL_CALL VCLXWindow::unlock( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if( pWindow && !Window::GetDockingManager()->IsFloating( pWindow ) )
+ Window::GetDockingManager()->Unlock( pWindow );
+}
+void SAL_CALL VCLXWindow::startPopupMode( const ::com::sun::star::awt::Rectangle& ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // TODO: remove interface in the next incompatible build
+ ::vos::OGuard aGuard( GetMutex() );
+
+}
+
+sal_Bool SAL_CALL VCLXWindow::isInPopupMode( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ // TODO: remove interface in the next incompatible build
+ ::vos::OGuard aGuard( GetMutex() );
+ return FALSE;
+}
+
+
+// ::com::sun::star::awt::XWindow2
+
+void SAL_CALL VCLXWindow::setOutputSize( const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ Window *pWindow;
+ if( (pWindow = GetWindow()) != NULL )
+ {
+ DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
+ if( pDockingWindow )
+ pDockingWindow->SetOutputSizePixel( VCLSize( aSize ) );
+ else
+ pWindow->SetOutputSizePixel( VCLSize( aSize ) );
+ }
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXWindow::getOutputSize( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ Window *pWindow;
+ if( (pWindow = GetWindow()) != NULL )
+ {
+ DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >(pWindow);
+ if( pDockingWindow )
+ return AWTSize( pDockingWindow->GetOutputSizePixel() );
+ else
+ return AWTSize( pWindow->GetOutputSizePixel() );
+ }
+ else
+ return ::com::sun::star::awt::Size();
+}
+
+sal_Bool SAL_CALL VCLXWindow::isVisible( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if( GetWindow() )
+ return GetWindow()->IsVisible();
+ else
+ return FALSE;
+}
+
+sal_Bool SAL_CALL VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if( GetWindow() )
+ return GetWindow()->IsActive();
+ else
+ return FALSE;
+
+}
+
+sal_Bool SAL_CALL VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if( GetWindow() )
+ return GetWindow()->IsEnabled();
+ else
+ return FALSE;
+}
+
+sal_Bool SAL_CALL VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if( GetWindow() )
+ return GetWindow()->HasFocus();
+ else
+ return FALSE;
+}
+
+// ::com::sun::star::beans::XPropertySetInfo
+
+UnoPropertyArrayHelper *
+VCLXWindow::GetPropHelper()
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if ( mpImpl->mpPropHelper == NULL )
+ {
+ std::list< sal_uInt16 > aIDs;
+ GetPropertyIds( aIDs );
+ mpImpl->mpPropHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return mpImpl->mpPropHelper;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL
+VCLXWindow::getProperties() throw (::com::sun::star::uno::RuntimeException)
+{
+ return GetPropHelper()->getProperties();
+}
+::com::sun::star::beans::Property SAL_CALL
+VCLXWindow::getPropertyByName( const ::rtl::OUString& rName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ return GetPropHelper()->getPropertyByName( rName );
+}
+
+::sal_Bool SAL_CALL
+VCLXWindow::hasPropertyByName( const ::rtl::OUString& rName ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return GetPropHelper()->hasPropertyByName( rName );
+}
diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx
new file mode 100644
index 000000000000..daea557d241a
--- /dev/null
+++ b/toolkit/source/awt/vclxwindow1.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_toolkit.hxx"
+
+#include <tools/svwin.h>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#ifndef _SV_WORKWIN
+#include <vcl/wrkwin.hxx>
+#endif
+#include <vcl/window.hxx>
+
+#ifdef WNT
+#include <tools/prewin.h>
+#include <windows.h>
+#include <tools/postwin.h>
+#elif defined ( QUARTZ )
+#include "premac.h"
+#include <Cocoa/Cocoa.h>
+#include "postmac.h"
+#endif
+#include <vcl/sysdata.hxx>
+
+/// helper method to set a window handle into a SystemParentData struct
+void VCLXWindow::SetSystemParent_Impl( const com::sun::star::uno::Any& rHandle )
+{
+ // does only work for WorkWindows
+ Window *pWindow = GetWindow();
+ if ( pWindow->GetType() != WINDOW_WORKWINDOW )
+ {
+ ::com::sun::star::uno::Exception *pException =
+ new ::com::sun::star::uno::RuntimeException;
+ pException->Message = ::rtl::OUString::createFromAscii( "not a work window" );
+ throw pException;
+ }
+
+ // use sal_Int64 here to accomodate all int types
+ // uno::Any shift operator whill upcast if necessary
+ sal_Int64 nHandle = 0;
+ sal_Bool bXEmbed = sal_False;
+ bool bThrow = false;
+ if( ! (rHandle >>= nHandle) )
+ {
+ com::sun::star::uno::Sequence< com::sun::star::beans::NamedValue > aProps;
+ if( rHandle >>= aProps )
+ {
+ const int nProps = aProps.getLength();
+ const com::sun::star::beans::NamedValue* pProps = aProps.getConstArray();
+ for( int i = 0; i < nProps; i++ )
+ {
+ if( pProps[i].Name.equalsAscii( "WINDOW" ) )
+ pProps[i].Value >>= nHandle;
+ else if( pProps[i].Name.equalsAscii( "XEMBED" ) )
+ pProps[i].Value >>= bXEmbed;
+ }
+ }
+ else
+ bThrow = true;
+ }
+ if( bThrow )
+ {
+ ::com::sun::star::uno::Exception *pException =
+ new ::com::sun::star::uno::RuntimeException;
+ pException->Message = ::rtl::OUString::createFromAscii( "incorrect window handle type" );
+ throw pException;
+ }
+ // create system parent data
+ SystemParentData aSysParentData;
+ aSysParentData.nSize = sizeof ( SystemParentData );
+#if defined( WIN ) || defined( WNT ) || defined ( OS2 )
+ aSysParentData.hWnd = (HWND) nHandle;
+#elif defined( QUARTZ )
+ aSysParentData.pView = reinterpret_cast<NSView*>(nHandle);
+#elif defined( UNX )
+ aSysParentData.aWindow = (long)nHandle;
+ aSysParentData.bXEmbedSupport = bXEmbed;
+#endif
+
+ // set system parent
+ ((WorkWindow*)pWindow)->SetPluginParent( &aSysParentData );
+}
+
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
new file mode 100644
index 000000000000..e2fc78421d5e
--- /dev/null
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -0,0 +1,6036 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <toolkit/awt/vclxwindows.hxx>
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/helper/imagealign.hxx>
+#include <toolkit/helper/accessibilityclient.hxx>
+#include <toolkit/helper/fixedhyperbase.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/system/XSystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <comphelper/processfactory.hxx>
+
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <vcl/field.hxx>
+#include <vcl/longcurr.hxx>
+#include <vcl/imgctrl.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/tabpage.hxx>
+#include <tools/debug.hxx>
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::graphic::XGraphic;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::awt::VisualEffect;
+namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+
+static double ImplCalcLongValue( double nValue, sal_uInt16 nDigits )
+{
+ double n = nValue;
+ for ( sal_uInt16 d = 0; d < nDigits; d++ )
+ n *= 10;
+ return n;
+}
+
+static double ImplCalcDoubleValue( double nValue, sal_uInt16 nDigits )
+{
+ double n = nValue;
+ for ( sal_uInt16 d = 0; d < nDigits; d++ )
+ n /= 10;
+ return n;
+}
+
+namespace toolkit
+{
+ /** sets the "face color" for button like controls (scroll bar, spin button)
+ */
+ void setButtonLikeFaceColor( Window* _pWindow, const ::com::sun::star::uno::Any& _rColorValue )
+ {
+ AllSettings aSettings = _pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+
+ if ( !_rColorValue.hasValue() )
+ {
+ const StyleSettings& aAppStyle = Application::GetSettings().GetStyleSettings();
+ aStyleSettings.SetFaceColor( aAppStyle.GetFaceColor( ) );
+ aStyleSettings.SetCheckedColor( aAppStyle.GetCheckedColor( ) );
+ aStyleSettings.SetLightBorderColor( aAppStyle.GetLightBorderColor() );
+ aStyleSettings.SetLightColor( aAppStyle.GetLightColor() );
+ aStyleSettings.SetShadowColor( aAppStyle.GetShadowColor() );
+ aStyleSettings.SetDarkShadowColor( aAppStyle.GetDarkShadowColor() );
+ }
+ else
+ {
+ sal_Int32 nBackgroundColor = 0;
+ _rColorValue >>= nBackgroundColor;
+ aStyleSettings.SetFaceColor( nBackgroundColor );
+
+ // for the real background (everything except the buttons and the thumb),
+ // use an average between the desired color and "white"
+ Color aWhite( COL_WHITE );
+ Color aBackground( nBackgroundColor );
+ aBackground.SetRed( ( aBackground.GetRed() + aWhite.GetRed() ) / 2 );
+ aBackground.SetGreen( ( aBackground.GetGreen() + aWhite.GetGreen() ) / 2 );
+ aBackground.SetBlue( ( aBackground.GetBlue() + aWhite.GetBlue() ) / 2 );
+ aStyleSettings.SetCheckedColor( aBackground );
+
+ sal_Int32 nBackgroundLuminance = Color( nBackgroundColor ).GetLuminance();
+ sal_Int32 nWhiteLuminance = Color( COL_WHITE ).GetLuminance();
+
+ Color aLightShadow( nBackgroundColor );
+ aLightShadow.IncreaseLuminance( (UINT8)( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) );
+ aStyleSettings.SetLightBorderColor( aLightShadow );
+
+ Color aLight( nBackgroundColor );
+ aLight.IncreaseLuminance( (UINT8)( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) );
+ aStyleSettings.SetLightColor( aLight );
+
+ Color aShadow( nBackgroundColor );
+ aShadow.DecreaseLuminance( (UINT8)( nBackgroundLuminance * 1 / 3 ) );
+ aStyleSettings.SetShadowColor( aShadow );
+
+ Color aDarkShadow( nBackgroundColor );
+ aDarkShadow.DecreaseLuminance( (UINT8)( nBackgroundLuminance * 2 / 3 ) );
+ aStyleSettings.SetDarkShadowColor( aDarkShadow );
+ }
+
+ aSettings.SetStyleSettings( aStyleSettings );
+ _pWindow->SetSettings( aSettings, TRUE );
+ }
+
+ Any getButtonLikeFaceColor( const Window* _pWindow )
+ {
+ sal_Int32 nBackgroundColor = _pWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
+ return makeAny( nBackgroundColor );
+ }
+
+ static void adjustBooleanWindowStyle( const Any& _rValue, Window* _pWindow, WinBits _nBits, sal_Bool _bInverseSemantics )
+ {
+ WinBits nStyle = _pWindow->GetStyle();
+ sal_Bool bValue( sal_False );
+ OSL_VERIFY( _rValue >>= bValue );
+ if ( bValue != _bInverseSemantics )
+ nStyle |= _nBits;
+ else
+ nStyle &= ~_nBits;
+ _pWindow->SetStyle( nStyle );
+ }
+
+ static void setVisualEffect( const Any& _rValue, Window* _pWindow, void (StyleSettings::*pSetter)( USHORT ), sal_Int16 _nFlatBits, sal_Int16 _n3DBits )
+ {
+ AllSettings aSettings = _pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+
+ sal_Int16 nStyle = LOOK3D;
+ OSL_VERIFY( _rValue >>= nStyle );
+ switch ( nStyle )
+ {
+ case FLAT:
+ (aStyleSettings.*pSetter)( _nFlatBits );
+ break;
+ case LOOK3D:
+ default:
+ (aStyleSettings.*pSetter)( _n3DBits );
+ }
+ aSettings.SetStyleSettings( aStyleSettings );
+ _pWindow->SetSettings( aSettings );
+ }
+
+ static Any getVisualEffect( Window* _pWindow, USHORT (StyleSettings::*pGetter)( ) const, sal_Int16 _nFlatBits )
+ {
+ Any aEffect;
+
+ StyleSettings aStyleSettings = _pWindow->GetSettings().GetStyleSettings();
+ if ( (aStyleSettings.*pGetter)() == _nFlatBits )
+ aEffect <<= (sal_Int16)FLAT;
+ else
+ aEffect <<= (sal_Int16)LOOK3D;
+ return aEffect;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXImageConsumer
+// ----------------------------------------------------
+
+void VCLXImageConsumer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+void VCLXImageConsumer::ImplSetNewImage()
+{
+ OSL_PRECOND( GetWindow(), "VCLXImageConsumer::ImplSetNewImage: window is required to be not-NULL!" );
+ Button* pButton = static_cast< Button* >( GetWindow() );
+ pButton->SetModeBitmap( GetBitmap() );
+}
+
+void VCLXImageConsumer::ImplUpdateImage( sal_Bool bGetNewImage )
+{
+ if ( !GetWindow() )
+ return;
+
+ if ( bGetNewImage && !maImageConsumer.GetData( maImage ) )
+ return;
+
+ ImplSetNewImage();
+}
+
+void VCLXImageConsumer::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, short Flags ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ Size aOldSize = GetWindow()->GetSizePixel();
+ VCLXWindow::setPosSize( X, Y, Width, Height, Flags );
+ if ( ( aOldSize.Width() != Width ) || ( aOldSize.Height() != Height ) )
+ ImplUpdateImage( sal_False );
+ }
+}
+
+void VCLXImageConsumer::init( sal_Int32 Width, sal_Int32 Height ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.Init( Width, Height );
+}
+
+void VCLXImageConsumer::setColorModel( sal_Int16 BitCount, const ::com::sun::star::uno::Sequence< sal_Int32 >& RGBAPal, sal_Int32 RedMask, sal_Int32 GreenMask, sal_Int32 BlueMask, sal_Int32 AlphaMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetColorModel( BitCount, RGBAPal.getLength(), (const sal_uInt32*) RGBAPal.getConstArray(), RedMask, GreenMask, BlueMask, AlphaMask );
+}
+
+void VCLXImageConsumer::setPixelsByBytes( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int8 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetPixelsByBytes( X, Y, Width, Height, (sal_uInt8*)ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void VCLXImageConsumer::setPixelsByLongs( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, const ::com::sun::star::uno::Sequence< sal_Int32 >& ProducerData, sal_Int32 Offset, sal_Int32 Scansize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.SetPixelsByLongs( X, Y, Width, Height, (const sal_uInt32*) ProducerData.getConstArray(), Offset, Scansize );
+ ImplUpdateImage( sal_True );
+}
+
+void VCLXImageConsumer::complete( sal_Int32 Status, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer > & ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageConsumer.Completed( Status );
+ ImplUpdateImage( sal_True );
+}
+
+void VCLXImageConsumer::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Button* pButton = static_cast< Button* >( GetWindow() );
+ if ( !pButton )
+ return;
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_GRAPHIC:
+ {
+ Reference< XGraphic > xGraphic;
+ OSL_VERIFY( Value >>= xGraphic );
+ maImage = Image( xGraphic );
+ ImplSetNewImage();
+ }
+ break;
+
+ case BASEPROPERTY_IMAGEALIGN:
+ {
+ WindowType eType = GetWindow()->GetType();
+ if ( ( eType == WINDOW_PUSHBUTTON )
+ || ( eType == WINDOW_RADIOBUTTON )
+ || ( eType == WINDOW_CHECKBOX )
+ )
+ {
+ sal_Int16 nAlignment = sal_Int16();
+ if ( Value >>= nAlignment )
+ pButton->SetImageAlign( static_cast< ImageAlign >( nAlignment ) );
+ }
+ }
+ break;
+ case BASEPROPERTY_IMAGEPOSITION:
+ {
+ WindowType eType = GetWindow()->GetType();
+ if ( ( eType == WINDOW_PUSHBUTTON )
+ || ( eType == WINDOW_RADIOBUTTON )
+ || ( eType == WINDOW_CHECKBOX )
+ )
+ {
+ sal_Int16 nImagePosition = 2;
+ OSL_VERIFY( Value >>= nImagePosition );
+ pButton->SetImageAlign( ::toolkit::translateImagePosition( nImagePosition ) );
+ }
+ }
+ break;
+ default:
+ VCLXWindow::setProperty( PropertyName, Value );
+ break;
+ }
+}
+
+::com::sun::star::uno::Any VCLXImageConsumer::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ if ( !GetWindow() )
+ return aProp;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_GRAPHIC:
+ aProp <<= maImage.GetXGraphic();
+ break;
+ case BASEPROPERTY_IMAGEALIGN:
+ {
+ WindowType eType = GetWindow()->GetType();
+ if ( ( eType == WINDOW_PUSHBUTTON )
+ || ( eType == WINDOW_RADIOBUTTON )
+ || ( eType == WINDOW_CHECKBOX )
+ )
+ {
+ aProp <<= ::toolkit::getCompatibleImageAlign( static_cast< Button* >( GetWindow() )->GetImageAlign() );
+ }
+ }
+ break;
+ case BASEPROPERTY_IMAGEPOSITION:
+ {
+ WindowType eType = GetWindow()->GetType();
+ if ( ( eType == WINDOW_PUSHBUTTON )
+ || ( eType == WINDOW_RADIOBUTTON )
+ || ( eType == WINDOW_CHECKBOX )
+ )
+ {
+ aProp <<= ::toolkit::translateImagePosition( static_cast< Button* >( GetWindow() )->GetImageAlign() );
+ }
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ break;
+ }
+ return aProp;
+}
+
+//--------------------------------------------------------------------
+// class VCLXButton
+// ----------------------------------------------------
+
+void VCLXButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_DEFAULTBUTTON,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_GRAPHIC,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_IMAGEALIGN,
+ BASEPROPERTY_IMAGEPOSITION,
+ BASEPROPERTY_IMAGEURL,
+ BASEPROPERTY_LABEL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_PUSHBUTTONTYPE,
+ BASEPROPERTY_REPEAT,
+ BASEPROPERTY_REPEAT_DELAY,
+ BASEPROPERTY_STATE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_TOGGLE,
+ BASEPROPERTY_FOCUSONCLICK,
+ BASEPROPERTY_MULTILINE,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_REFERENCE_DEVICE,
+ 0);
+ VCLXImageConsumer::ImplGetPropertyIds( rIds );
+}
+
+VCLXButton::VCLXButton()
+ :maActionListeners( *this )
+ ,maItemListeners( *this )
+{
+}
+
+VCLXButton::~VCLXButton()
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXButton::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXButton::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aObj );
+ maItemListeners.disposeAndClear( aObj );
+ VCLXImageConsumer::dispose();
+}
+
+void VCLXButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l )throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rLabel );
+}
+
+void VCLXButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maActionCommand = rCommand;
+}
+
+::com::sun::star::awt::Size VCLXButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ aSz = pButton->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::Size aSz = getMinimumSize();
+ aSz.Width += 16;
+ aSz.Height += 10;
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ PushButton* pButton = (PushButton*) GetWindow();
+ if ( pButton )
+ {
+ Size aMinSz = pButton->CalcMinimumSize();
+ // Kein Text, also Image
+ if ( !pButton->GetText().Len() )
+ {
+ if ( aSz.Width() < aMinSz.Width() )
+ aSz.Width() = aMinSz.Width();
+ if ( aSz.Height() < aMinSz.Height() )
+ aSz.Height() = aMinSz.Height();
+ }
+ else
+ {
+ if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
+ aSz.Height() = aMinSz.Height();
+ else
+ aSz = aMinSz;
+ }
+ }
+ return AWTSize(aSz);
+}
+
+void VCLXButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Button* pButton = (Button*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_FOCUSONCLICK:
+ ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_NOPOINTERFOCUS, sal_True );
+ break;
+
+ case BASEPROPERTY_TOGGLE:
+ ::toolkit::adjustBooleanWindowStyle( Value, pButton, WB_TOGGLE, sal_False );
+ break;
+
+ case BASEPROPERTY_DEFAULTBUTTON:
+ {
+ WinBits nStyle = pButton->GetStyle() | WB_DEFBUTTON;
+ sal_Bool b = sal_Bool();
+ if ( ( Value >>= b ) && !b )
+ nStyle &= ~WB_DEFBUTTON;
+ pButton->SetStyle( nStyle );
+ }
+ break;
+ case BASEPROPERTY_STATE:
+ {
+ if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ ((PushButton*)pButton)->SetState( (TriState)n );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXImageConsumer::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ Button* pButton = (Button*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_FOCUSONCLICK:
+ aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_NOPOINTERFOCUS ) == 0 );
+ break;
+
+ case BASEPROPERTY_TOGGLE:
+ aProp <<= (sal_Bool)( ( pButton->GetStyle() & WB_TOGGLE ) != 0 );
+ break;
+
+ case BASEPROPERTY_DEFAULTBUTTON:
+ {
+ aProp <<= (sal_Bool) ( ( pButton->GetStyle() & WB_DEFBUTTON ) ? sal_True : sal_False );
+ }
+ break;
+ case BASEPROPERTY_STATE:
+ {
+ if ( GetWindow()->GetType() == WINDOW_PUSHBUTTON )
+ {
+ aProp <<= (sal_Int16)((PushButton*)pButton)->GetState();
+ }
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXImageConsumer::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+void VCLXButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_BUTTON_CLICK:
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ if ( maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = maActionCommand;
+ maActionListeners.actionPerformed( aEvent );
+ }
+ }
+ break;
+
+ case VCLEVENT_PUSHBUTTON_TOGGLE:
+ {
+ PushButton& rButton = dynamic_cast< PushButton& >( *rVclWindowEvent.GetWindow() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ if ( maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Selected = ( rButton.GetState() == STATE_CHECK ) ? 1 : 0;
+ maItemListeners.itemStateChanged( aEvent );
+ }
+ }
+ break;
+
+ default:
+ VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXImageControl
+// ----------------------------------------------------
+
+void VCLXImageControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_GRAPHIC,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_IMAGEURL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_SCALEIMAGE,
+ BASEPROPERTY_IMAGE_SCALE_MODE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ 0);
+ VCLXImageConsumer::ImplGetPropertyIds( rIds );
+}
+
+VCLXImageControl::VCLXImageControl()
+{
+}
+
+VCLXImageControl::~VCLXImageControl()
+{
+}
+
+void VCLXImageControl::ImplSetNewImage()
+{
+ OSL_PRECOND( GetWindow(), "VCLXImageControl::ImplSetNewImage: window is required to be not-NULL!" );
+ ImageControl* pControl = static_cast< ImageControl* >( GetWindow() );
+ pControl->SetBitmap( GetBitmap() );
+}
+
+::com::sun::star::awt::Size VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = GetBitmap().GetSizePixel();
+ aSz = ImplCalcWindowSize( aSz );
+
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXImageControl::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXImageControl::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Width < aMinSz.Width )
+ aSz.Width = aMinSz.Width;
+ if ( aSz.Height < aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+ return aSz;
+}
+
+void VCLXImageControl::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ImageControl* pImageControl = (ImageControl*)GetWindow();
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ {
+ sal_Int16 nScaleMode( ImageScaleMode::Anisotropic );
+ if ( pImageControl && ( Value >>= nScaleMode ) )
+ {
+ pImageControl->SetScaleMode( nScaleMode );
+ }
+ }
+ break;
+
+ case BASEPROPERTY_SCALEIMAGE:
+ {
+ // this is for compatibility only, nowadays, the ImageScaleMode property should be used
+ sal_Bool bScaleImage = sal_False;
+ if ( pImageControl && ( Value >>= bScaleImage ) )
+ {
+ pImageControl->SetScaleMode( bScaleImage ? ImageScaleMode::Anisotropic : ImageScaleMode::None );
+ }
+ }
+ break;
+
+ default:
+ VCLXImageConsumer::setProperty( PropertyName, Value );
+ break;
+ }
+}
+
+::com::sun::star::uno::Any VCLXImageControl::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ ImageControl* pImageControl = (ImageControl*)GetWindow();
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ aProp <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic );
+ break;
+
+ case BASEPROPERTY_SCALEIMAGE:
+ aProp <<= ( pImageControl && pImageControl->GetScaleMode() != ImageScaleMode::None ) ? sal_True : sal_False;
+ break;
+
+ default:
+ aProp = VCLXImageConsumer::getProperty( PropertyName );
+ break;
+ }
+ return aProp;
+}
+
+// ----------------------------------------------------
+// class VCLXCheckBox
+// ----------------------------------------------------
+
+
+void VCLXCheckBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_GRAPHIC,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_IMAGEPOSITION,
+ BASEPROPERTY_IMAGEURL,
+ BASEPROPERTY_LABEL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_STATE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_TRISTATE,
+ BASEPROPERTY_VISUALEFFECT,
+ BASEPROPERTY_MULTILINE,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_REFERENCE_DEVICE,
+ 0);
+ VCLXImageConsumer::ImplGetPropertyIds( rIds );
+}
+
+VCLXCheckBox::VCLXCheckBox() : maActionListeners( *this ), maItemListeners( *this )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXCheckBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XCheckBox*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXImageConsumer::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXCheckBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCheckBox>* ) NULL ),
+ VCLXImageConsumer::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXCheckBox::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXCheckBox::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ VCLXImageConsumer::dispose();
+}
+
+void VCLXCheckBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXCheckBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXCheckBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXCheckBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXCheckBox::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionCommand = rCommand;
+}
+
+void VCLXCheckBox::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rLabel );
+}
+
+void VCLXCheckBox::setState( short n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox)
+ {
+ TriState eState;
+ switch ( n )
+ {
+ case 0: eState = STATE_NOCHECK; break;
+ case 1: eState = STATE_CHECK; break;
+ case 2: eState = STATE_DONTKNOW; break;
+ default: eState = STATE_NOCHECK;
+ }
+ pCheckBox->SetState( eState );
+
+ // #105198# call C++ click listeners (needed for accessibility)
+ // pCheckBox->GetClickHdl().Call( pCheckBox );
+
+ // #107218# Call same virtual methods and listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pCheckBox->Toggle();
+ pCheckBox->Click();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+short VCLXCheckBox::getState() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ short nState = -1;
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox )
+ {
+ switch ( pCheckBox->GetState() )
+ {
+ case STATE_NOCHECK: nState = 0; break;
+ case STATE_CHECK: nState = 1; break;
+ case STATE_DONTKNOW: nState = 2; break;
+ default: DBG_ERROR( "VCLXCheckBox::getState(): unknown TriState!" );
+ }
+ }
+
+ return nState;
+}
+
+void VCLXCheckBox::enableTriState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox)
+ pCheckBox->EnableTriState( b );
+}
+
+::com::sun::star::awt::Size VCLXCheckBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ CheckBox* pCheckBox = (CheckBox*) GetWindow();
+ if ( pCheckBox )
+ aSz = pCheckBox->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXCheckBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXCheckBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ CheckBox* pCheckBox = (CheckBox*) GetWindow();
+ if ( pCheckBox )
+ {
+ Size aMinSz = pCheckBox->CalcMinimumSize();
+ if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
+ aSz.Height() = aMinSz.Height();
+ else
+ aSz = aMinSz;
+ }
+ return AWTSize(aSz);
+}
+
+void VCLXCheckBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VISUALEFFECT:
+ ::toolkit::setVisualEffect( Value, pCheckBox, &StyleSettings::SetCheckBoxStyle, STYLE_CHECKBOX_MONO, STYLE_CHECKBOX_WIN );
+ break;
+
+ case BASEPROPERTY_TRISTATE:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ pCheckBox->EnableTriState( b );
+ }
+ break;
+ case BASEPROPERTY_STATE:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ setState( n );
+ }
+ break;
+ default:
+ {
+ VCLXImageConsumer::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXCheckBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VISUALEFFECT:
+ aProp = ::toolkit::getVisualEffect( pCheckBox, &StyleSettings::GetCheckBoxStyle, STYLE_CHECKBOX_MONO );
+ break;
+ case BASEPROPERTY_TRISTATE:
+ aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled();
+ break;
+ case BASEPROPERTY_STATE:
+ aProp <<= (sal_Int16)pCheckBox->GetState();
+ break;
+ default:
+ {
+ aProp <<= VCLXImageConsumer::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+void VCLXCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_CHECKBOX_TOGGLE:
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // in during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ CheckBox* pCheckBox = (CheckBox*)GetWindow();
+ if ( pCheckBox )
+ {
+ if ( maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+ aEvent.Selected = pCheckBox->GetState();
+ maItemListeners.itemStateChanged( aEvent );
+ }
+ if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = maActionCommand;
+ maActionListeners.actionPerformed( aEvent );
+ }
+ }
+ }
+ break;
+
+ default:
+ VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXRadioButton
+// ----------------------------------------------------
+void VCLXRadioButton::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_GRAPHIC,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_IMAGEPOSITION,
+ BASEPROPERTY_IMAGEURL,
+ BASEPROPERTY_LABEL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_STATE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_VISUALEFFECT,
+ BASEPROPERTY_MULTILINE,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_REFERENCE_DEVICE,
+ 0);
+ VCLXImageConsumer::ImplGetPropertyIds( rIds );
+}
+
+
+VCLXRadioButton::VCLXRadioButton() : maItemListeners( *this ), maActionListeners( *this )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXRadioButton::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XRadioButton*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XButton*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXImageConsumer::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXRadioButton )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRadioButton>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XButton>* ) NULL ),
+ VCLXImageConsumer::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXRadioButton::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXRadioButton::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ VCLXImageConsumer::dispose();
+}
+
+void VCLXRadioButton::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ RadioButton* pButton = (RadioButton*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VISUALEFFECT:
+ ::toolkit::setVisualEffect( Value, pButton, &StyleSettings::SetRadioButtonStyle, STYLE_RADIOBUTTON_MONO, STYLE_RADIOBUTTON_WIN );
+ break;
+
+ case BASEPROPERTY_STATE:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ {
+ BOOL b = n ? sal_True : sal_False;
+ if ( pButton->IsRadioCheckEnabled() )
+ pButton->Check( b );
+ else
+ pButton->SetState( b );
+ }
+ }
+ break;
+ case BASEPROPERTY_AUTOTOGGLE:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ pButton->EnableRadioCheck( b );
+ }
+ break;
+ default:
+ {
+ VCLXImageConsumer::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXRadioButton::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ RadioButton* pButton = (RadioButton*)GetWindow();
+ if ( pButton )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VISUALEFFECT:
+ aProp = ::toolkit::getVisualEffect( pButton, &StyleSettings::GetRadioButtonStyle, STYLE_RADIOBUTTON_MONO );
+ break;
+ case BASEPROPERTY_STATE:
+ aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 );
+ break;
+ case BASEPROPERTY_AUTOTOGGLE:
+ aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled();
+ break;
+ default:
+ {
+ aProp <<= VCLXImageConsumer::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+void VCLXRadioButton::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXRadioButton::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXRadioButton::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXRadioButton::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXRadioButton::setLabel( const ::rtl::OUString& rLabel ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rLabel );
+}
+
+void VCLXRadioButton::setActionCommand( const ::rtl::OUString& rCommand ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionCommand = rCommand;
+}
+
+void VCLXRadioButton::setState( sal_Bool b ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ RadioButton* pRadioButton = (RadioButton*)GetWindow();
+ if ( pRadioButton)
+ {
+ pRadioButton->Check( b );
+ // #102717# item listeners are called, but not C++ click listeners in StarOffice code => call click hdl
+ // But this is needed in old code because Accessibility API uses it.
+ // pRadioButton->GetClickHdl().Call( pRadioButton );
+
+ // #107218# Call same virtual methods and listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pRadioButton->Click();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+sal_Bool VCLXRadioButton::getState() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ RadioButton* pRadioButton = (RadioButton*)GetWindow();
+ return pRadioButton ? pRadioButton->IsChecked() : sal_False;
+}
+
+::com::sun::star::awt::Size VCLXRadioButton::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ RadioButton* pRadioButton = (RadioButton*) GetWindow();
+ if ( pRadioButton )
+ aSz = pRadioButton->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXRadioButton::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXRadioButton::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ RadioButton* pRadioButton = (RadioButton*) GetWindow();
+ if ( pRadioButton )
+ {
+ Size aMinSz = pRadioButton->CalcMinimumSize();
+ if ( ( aSz.Width() > aMinSz.Width() ) && ( aSz.Height() < aMinSz.Height() ) )
+ aSz.Height() = aMinSz.Height();
+ else
+ aSz = aMinSz;
+ }
+ return AWTSize(aSz);
+}
+
+void VCLXRadioButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // in during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_BUTTON_CLICK:
+ if ( !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = maActionCommand;
+ maActionListeners.actionPerformed( aEvent );
+ }
+ ImplClickedOrToggled( FALSE );
+ break;
+
+ case VCLEVENT_RADIOBUTTON_TOGGLE:
+ ImplClickedOrToggled( TRUE );
+ break;
+
+ default:
+ VCLXImageConsumer::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+void VCLXRadioButton::ImplClickedOrToggled( BOOL bToggled )
+{
+ // In the formulars, RadioChecked is not enabled, call itemStateChanged only for click
+ // In the dialog editor, RadioChecked is enabled, call itemStateChanged only for bToggled
+ RadioButton* pRadioButton = (RadioButton*)GetWindow();
+ if ( pRadioButton && ( pRadioButton->IsRadioCheckEnabled() == bToggled ) && ( bToggled || pRadioButton->IsStateChanged() ) && maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+ aEvent.Selected = pRadioButton->IsChecked();
+ maItemListeners.itemStateChanged( aEvent );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > VCLXRadioButton::getFirstActionListener ()
+{
+ if (!maItemListeners.getLength ())
+ return ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > ();
+ return maActionListeners.getElements()[0];
+}
+
+// ----------------------------------------------------
+// class VCLXSpinField
+// ----------------------------------------------------
+void VCLXSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0 );
+ VCLXEdit::ImplGetPropertyIds( rIds );
+}
+
+VCLXSpinField::VCLXSpinField() : maSpinListeners( *this )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXSpinField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XSpinField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXSpinField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinField>* ) NULL ),
+ VCLXEdit::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXSpinField::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maSpinListeners.addInterface( l );
+}
+
+void VCLXSpinField::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maSpinListeners.removeInterface( l );
+}
+
+void VCLXSpinField::up() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->Up();
+}
+
+void VCLXSpinField::down() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->Down();
+}
+
+void VCLXSpinField::first() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->First();
+}
+
+void VCLXSpinField::last() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ SpinField* pSpinField = (SpinField*) GetWindow();
+ if ( pSpinField )
+ pSpinField->Last();
+}
+
+void VCLXSpinField::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( bRepeat )
+ nStyle |= WB_REPEAT;
+ else
+ nStyle &= ~WB_REPEAT;
+ pWindow->SetStyle( nStyle );
+ }
+}
+
+void VCLXSpinField::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_SPINFIELD_UP:
+ case VCLEVENT_SPINFIELD_DOWN:
+ case VCLEVENT_SPINFIELD_FIRST:
+ case VCLEVENT_SPINFIELD_LAST:
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // in during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ if ( maSpinListeners.getLength() )
+ {
+ ::com::sun::star::awt::SpinEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_SPINFIELD_UP: maSpinListeners.up( aEvent );
+ break;
+ case VCLEVENT_SPINFIELD_DOWN: maSpinListeners.down( aEvent );
+ break;
+ case VCLEVENT_SPINFIELD_FIRST: maSpinListeners.first( aEvent );
+ break;
+ case VCLEVENT_SPINFIELD_LAST: maSpinListeners.last( aEvent );
+ break;
+ }
+
+ }
+ }
+ break;
+
+ default:
+ VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+
+// ----------------------------------------------------
+// class VCLXListBox
+// ----------------------------------------------------
+void VCLXListBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_DROPDOWN,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_LINECOUNT,
+ BASEPROPERTY_MULTISELECTION,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_SELECTEDITEMS,
+ BASEPROPERTY_STRINGITEMLIST,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_REFERENCE_DEVICE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+
+VCLXListBox::VCLXListBox()
+ : maActionListeners( *this ),
+ maItemListeners( *this )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXListBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XListBox*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXListBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XListBox>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXListBox::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ maActionListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXListBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXListBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXListBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXListBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXListBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->InsertEntry( aItem, nPos );
+}
+
+void VCLXListBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nP = nPos;
+ const ::rtl::OUString* pItems = aItems.getConstArray();
+ const ::rtl::OUString* pItemsEnd = aItems.getConstArray() + aItems.getLength();
+ while ( pItems != pItemsEnd )
+ {
+ if ( (sal_uInt16)nP == 0xFFFF )
+ {
+ OSL_ENSURE( false, "VCLXListBox::addItems: too many entries!" );
+ // skip remaining entries, list cannot hold them, anyway
+ break;
+ }
+
+ pBox->InsertEntry( *pItems++, nP++ );
+ }
+ }
+}
+
+void VCLXListBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ for ( sal_uInt16 n = nCount; n; )
+ pBox->RemoveEntry( nPos + (--n) );
+ }
+}
+
+sal_Int16 VCLXListBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ return pBox ? pBox->GetEntryCount() : 0;
+}
+
+::rtl::OUString VCLXListBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ String aItem;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ aItem = pBox->GetEntry( nPos );
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nEntries = pBox->GetEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
+ for ( sal_uInt16 n = nEntries; n; )
+ {
+ --n;
+ aSeq.getArray()[n] = ::rtl::OUString( pBox->GetEntry( n ) );
+ }
+ }
+ return aSeq;
+}
+
+sal_Int16 VCLXListBox::getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ return pBox ? pBox->GetSelectEntryPos() : 0;
+}
+
+::com::sun::star::uno::Sequence<sal_Int16> VCLXListBox::getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence<sal_Int16>( nSelEntries );
+ for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
+ aSeq.getArray()[n] = pBox->GetSelectEntryPos( n );
+ }
+ return aSeq;
+}
+
+::rtl::OUString VCLXListBox::getSelectedItem() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ String aItem;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ aItem = pBox->GetSelectEntry();
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXListBox::getSelectedItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nSelEntries = pBox->GetSelectEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nSelEntries );
+ for ( sal_uInt16 n = 0; n < nSelEntries; n++ )
+ aSeq.getArray()[n] = ::rtl::OUString( pBox->GetSelectEntry( n ) );
+ }
+ return aSeq;
+}
+
+void VCLXListBox::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox && ( pBox->IsEntryPosSelected( nPos ) != bSelect ) )
+ {
+ pBox->SelectEntryPos( nPos, bSelect );
+
+ // VCL doesn't call select handler after API call.
+ // ImplCallItemListeners();
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pBox->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+void VCLXListBox::selectItemsPos( const ::com::sun::star::uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ BOOL bChanged = FALSE;
+ for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; )
+ {
+ USHORT nPos = (USHORT) aPositions.getConstArray()[--n];
+ if ( pBox->IsEntryPosSelected( nPos ) != bSelect )
+ {
+ pBox->SelectEntryPos( nPos, bSelect );
+ bChanged = TRUE;
+ }
+ }
+
+ if ( bChanged )
+ {
+ // VCL doesn't call select handler after API call.
+ // ImplCallItemListeners();
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pBox->Select();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+ }
+}
+
+void VCLXListBox::selectItem( const ::rtl::OUString& rItemText, sal_Bool bSelect ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ {
+ String aItemText( rItemText );
+ selectItemPos( pBox->GetEntryPos( aItemText ), bSelect );
+ }
+}
+
+
+void VCLXListBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->SetDropDownLineCount( nLines );
+}
+
+sal_Int16 VCLXListBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int16 nLines = 0;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ nLines = pBox->GetDropDownLineCount();
+ return nLines;
+}
+
+sal_Bool VCLXListBox::isMutipleMode() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Bool bMulti = sal_False;
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ bMulti = pBox->IsMultiSelectionEnabled();
+ return bMulti;
+}
+
+void VCLXListBox::setMultipleMode( sal_Bool bMulti ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->EnableMultiSelection( bMulti );
+}
+
+void VCLXListBox::makeVisible( sal_Int16 nEntry ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pBox = (ListBox*) GetWindow();
+ if ( pBox )
+ pBox->SetTopEntry( nEntry );
+}
+
+void VCLXListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // in during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_LISTBOX_SELECT:
+ {
+ ListBox* pListBox = (ListBox*)GetWindow();
+
+ if( pListBox )
+ {
+ sal_Bool bDropDown = ( pListBox->GetStyle() & WB_DROPDOWN ) ? sal_True : sal_False;
+ if ( bDropDown && !IsSynthesizingVCLEvent() && maActionListeners.getLength() )
+ {
+ // Bei DropDown den ActionListener rufen...
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = pListBox->GetSelectEntry();
+ maActionListeners.actionPerformed( aEvent );
+ }
+
+ if ( maItemListeners.getLength() )
+ {
+ ImplCallItemListeners();
+ }
+ }
+ }
+ break;
+
+ case VCLEVENT_LISTBOX_DOUBLECLICK:
+ if ( GetWindow() && maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.ActionCommand = ((ListBox*)GetWindow())->GetSelectEntry();
+ maActionListeners.actionPerformed( aEvent );
+ }
+ break;
+
+ default:
+ VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXListBox::CreateAccessibleContext()
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXListBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = (ListBox*)GetWindow();
+ if ( pListBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ pListBox->SetReadOnly( b);
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ pListBox->EnableMultiSelection( b );
+ }
+ break;
+ case BASEPROPERTY_LINECOUNT:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pListBox->SetDropDownLineCount( n );
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
+ if ( Value >>= aItems )
+ {
+ pListBox->Clear();
+ addItems( aItems, 0 );
+ }
+ }
+ break;
+ case BASEPROPERTY_SELECTEDITEMS:
+ {
+ ::com::sun::star::uno::Sequence<sal_Int16> aItems;
+ if ( Value >>= aItems )
+ {
+ for ( sal_uInt16 n = pListBox->GetEntryCount(); n; )
+ pListBox->SelectEntryPos( --n, sal_False );
+
+ if ( aItems.getLength() )
+ selectItemsPos( aItems, sal_True );
+ else
+ pListBox->SetNoSelection();
+
+ if ( !pListBox->GetSelectEntryCount() )
+ pListBox->SetTopEntry( 0 );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXListBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ ListBox* pListBox = (ListBox*)GetWindow();
+ if ( pListBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_READONLY:
+ {
+ aProp <<= (sal_Bool) pListBox->IsReadOnly();
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION:
+ {
+ aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
+ }
+ break;
+ case BASEPROPERTY_LINECOUNT:
+ {
+ aProp <<= (sal_Int16) pListBox->GetDropDownLineCount();
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ sal_uInt16 nItems = pListBox->GetEntryCount();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
+ ::rtl::OUString* pStrings = aSeq.getArray();
+ for ( sal_uInt16 n = 0; n < nItems; n++ )
+ pStrings[n] = pListBox->GetEntry( n );
+ aProp <<= aSeq;
+
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+::com::sun::star::awt::Size VCLXListBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ aSz = pListBox->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXListBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ {
+ aSz = pListBox->CalcMinimumSize();
+ if ( pListBox->GetStyle() & WB_DROPDOWN )
+ aSz.Height() += 4;
+ }
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXListBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ aSz = pListBox->CalcAdjustedSize( aSz );
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXListBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ aSz = pListBox->CalcSize( nCols, nLines );
+ return AWTSize(aSz);
+}
+
+void VCLXListBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nCols = nLines = 0;
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox )
+ {
+ sal_uInt16 nC, nL;
+ pListBox->GetMaxVisColumnsAndLines( nC, nL );
+ nCols = nC;
+ nLines = nL;
+ }
+}
+
+void VCLXListBox::ImplCallItemListeners()
+{
+ ListBox* pListBox = (ListBox*) GetWindow();
+ if ( pListBox && maItemListeners.getLength() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+
+ // Bei Mehrfachselektion 0xFFFF, sonst die ID
+ aEvent.Selected = (pListBox->GetSelectEntryCount() == 1 ) ? pListBox->GetSelectEntryPos() : 0xFFFF;
+
+ maItemListeners.itemStateChanged( aEvent );
+ }
+}
+
+
+// ----------------------------------------------------
+// class VCLXMessageBox
+// ----------------------------------------------------
+
+void VCLXMessageBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXTopWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXMessageBox::VCLXMessageBox()
+{
+}
+
+VCLXMessageBox::~VCLXMessageBox()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXMessageBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMessageBox*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXMessageBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox>* ) NULL ),
+ VCLXTopWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXMessageBox::setCaptionText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( rText );
+}
+
+::rtl::OUString VCLXMessageBox::getCaptionText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ String aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+void VCLXMessageBox::setMessageText( const ::rtl::OUString& rText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MessBox* pBox = (MessBox*)GetWindow();
+ if ( pBox )
+ pBox->SetMessText( rText );
+}
+
+::rtl::OUString VCLXMessageBox::getMessageText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ MessBox* pBox = (MessBox*)GetWindow();
+ if ( pBox )
+ aText = pBox->GetMessText();
+ return aText;
+}
+
+sal_Int16 VCLXMessageBox::execute() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ MessBox* pBox = (MessBox*)GetWindow();
+ return pBox ? pBox->Execute() : 0;
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXMessageBox::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ return ::com::sun::star::awt::Size( 250, 100 );
+}
+
+// ----------------------------------------------------
+// class VCLXDialog
+// ----------------------------------------------------
+void VCLXDialog::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXTopWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXDialog::VCLXDialog()
+{
+}
+
+VCLXDialog::~VCLXDialog()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXDialog::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDialog*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXTopWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXDialog )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
+ VCLXTopWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXDialog::setTitle( const ::rtl::OUString& Title ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( Title );
+}
+
+::rtl::OUString VCLXDialog::getTitle() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aTitle;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aTitle = pWindow->GetText();
+ return aTitle;
+}
+
+sal_Int16 VCLXDialog::execute() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int16 nRet = 0;
+ if ( GetWindow() )
+ {
+ Dialog* pDlg = (Dialog*) GetWindow();
+ Window* pParent = pDlg->GetWindow( WINDOW_PARENTOVERLAP );
+ Window* pOldParent = NULL;
+ if ( pParent && !pParent->IsReallyVisible() )
+ {
+ pOldParent = pDlg->GetParent();
+ Window* pFrame = pDlg->GetWindow( WINDOW_FRAME );
+ if( pFrame != pDlg )
+ pDlg->SetParent( pFrame );
+ }
+ nRet = pDlg->Execute();
+ if ( pOldParent )
+ pDlg->SetParent( pOldParent );
+ }
+ return nRet;
+}
+
+void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Dialog* pDlg = (Dialog*) GetWindow();
+ if ( pDlg )
+ pDlg->EndDialog( 0 );
+}
+
+void SAL_CALL VCLXDialog::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ Window* pWindow = GetWindow();
+
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+}
+
+::com::sun::star::awt::DeviceInfo VCLXDialog::getInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
+
+ ::vos::OGuard aGuard( GetMutex() );
+ Dialog* pDlg = (Dialog*) GetWindow();
+ if ( pDlg )
+ pDlg->GetDrawWindowBorder( aInfo.LeftInset, aInfo.TopInset, aInfo.RightInset, aInfo.BottomInset );
+
+ return aInfo;
+}
+
+
+void SAL_CALL VCLXDialog::setProperty(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Any& Value )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Dialog* pDialog = (Dialog*)GetWindow();
+ if ( pDialog )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_GRAPHIC:
+ {
+ Reference< XGraphic > xGraphic;
+ if (( Value >>= xGraphic ) && xGraphic.is() )
+ {
+ Image aImage( xGraphic );
+
+ Wallpaper aWallpaper( aImage.GetBitmapEx());
+ aWallpaper.SetStyle( WALLPAPER_SCALE );
+ pDialog->SetBackground( aWallpaper );
+ }
+ else if ( bVoid || !xGraphic.is() )
+ {
+ Color aColor = pDialog->GetControlBackground().GetColor();
+ if ( aColor == COL_AUTO )
+ aColor = pDialog->GetSettings().GetStyleSettings().GetDialogColor();
+
+ Wallpaper aWallpaper( aColor );
+ pDialog->SetBackground( aWallpaper );
+ }
+ }
+ break;
+
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXTabPage
+// ----------------------------------------------------
+VCLXTabPage::VCLXTabPage()
+{
+}
+
+VCLXTabPage::~VCLXTabPage()
+{
+}
+
+::com::sun::star::uno::Any SAL_CALL VCLXTabPage::queryInterface(const ::com::sun::star::uno::Type & rType )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXContainer::queryInterface( rType );
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXTabPage )
+ VCLXContainer::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XView
+void SAL_CALL VCLXTabPage::draw( sal_Int32 nX, sal_Int32 nY )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ Window* pWindow = GetWindow();
+
+ if ( pWindow )
+ {
+ OutputDevice* pDev = VCLUnoHelper::GetOutputDevice( getGraphics() );
+ if ( !pDev )
+ pDev = pWindow->GetParent();
+
+ Size aSize = pDev->PixelToLogic( pWindow->GetSizePixel() );
+ Point aPos = pDev->PixelToLogic( Point( nX, nY ) );
+
+ pWindow->Draw( pDev, aPos, aSize, WINDOW_DRAW_NOCONTROLS );
+ }
+}
+
+// ::com::sun::star::awt::XDevice,
+::com::sun::star::awt::DeviceInfo SAL_CALL VCLXTabPage::getInfo()
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+void SAL_CALL VCLXTabPage::setProperty(
+ const ::rtl::OUString& PropertyName,
+ const ::com::sun::star::uno::Any& Value )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TabPage* pTabPage = (TabPage*)GetWindow();
+ if ( pTabPage )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_GRAPHIC:
+ {
+ Reference< XGraphic > xGraphic;
+ if (( Value >>= xGraphic ) && xGraphic.is() )
+ {
+ Image aImage( xGraphic );
+
+ Wallpaper aWallpaper( aImage.GetBitmapEx());
+ aWallpaper.SetStyle( WALLPAPER_SCALE );
+ pTabPage->SetBackground( aWallpaper );
+ }
+ else if ( bVoid || !xGraphic.is() )
+ {
+ Color aColor = pTabPage->GetControlBackground().GetColor();
+ if ( aColor == COL_AUTO )
+ aColor = pTabPage->GetSettings().GetStyleSettings().GetDialogColor();
+
+ Wallpaper aWallpaper( aColor );
+ pTabPage->SetBackground( aWallpaper );
+ }
+ }
+ break;
+
+ default:
+ {
+ VCLXContainer::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXFixedHyperlink
+// ----------------------------------------------------
+VCLXFixedHyperlink::VCLXFixedHyperlink() :
+
+ maActionListeners( *this )
+
+{
+}
+
+VCLXFixedHyperlink::~VCLXFixedHyperlink()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXFixedHyperlink::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XFixedHyperlink*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+void VCLXFixedHyperlink::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXFixedHyperlink )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedHyperlink>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXFixedHyperlink::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_BUTTON_CLICK:
+ {
+ if ( maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.actionPerformed( aEvent );
+ }
+ else
+ {
+ // open the URL
+ ::rtl::OUString sURL;
+ ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
+ if ( pBase )
+ sURL = pBase->GetURL();
+ Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ ::rtl::OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" )), uno::UNO_QUERY );
+ if ( sURL.getLength() > 0 && xSystemShellExecute.is() )
+ {
+ try
+ {
+ // start browser
+ xSystemShellExecute->execute(
+ sURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+ }
+
+ default:
+ VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedHyperlink::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXFixedHyperlink::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
+ if ( pBase )
+ pBase->SetDescription( Text );
+}
+
+::rtl::OUString VCLXFixedHyperlink::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+void VCLXFixedHyperlink::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
+ if ( pBase )
+ pBase->SetURL( URL );
+}
+
+::rtl::OUString VCLXFixedHyperlink::getURL( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
+ if ( pBase )
+ aText = pBase->GetURL();
+ return aText;
+}
+
+void VCLXFixedHyperlink::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nNewBits = 0;
+ if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
+ nNewBits = WB_LEFT;
+ else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
+ nNewBits = WB_CENTER;
+ else
+ nNewBits = WB_RIGHT;
+
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
+ pWindow->SetStyle( nStyle | nNewBits );
+ }
+}
+
+short VCLXFixedHyperlink::getAlignment() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ short nAlign = 0;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( nStyle & WB_LEFT )
+ nAlign = ::com::sun::star::awt::TextAlign::LEFT;
+ else if ( nStyle & WB_CENTER )
+ nAlign = ::com::sun::star::awt::TextAlign::CENTER;
+ else
+ nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
+ }
+ return nAlign;
+}
+
+void VCLXFixedHyperlink::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l )throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXFixedHyperlink::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+::com::sun::star::awt::Size VCLXFixedHyperlink::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ FixedText* pFixedText = (FixedText*)GetWindow();
+ if ( pFixedText )
+ aSz = pFixedText->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXFixedHyperlink::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXFixedHyperlink::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Height != aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+
+ return aSz;
+}
+
+void VCLXFixedHyperlink::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
+ if ( pBase )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LABEL:
+ {
+ ::rtl::OUString sNewLabel;
+ if ( Value >>= sNewLabel )
+ pBase->SetDescription( sNewLabel );
+ break;
+ }
+
+ case BASEPROPERTY_URL:
+ {
+ ::rtl::OUString sNewURL;
+ if ( Value >>= sNewURL )
+ pBase->SetURL( sNewURL );
+ break;
+ }
+
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXFixedHyperlink::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ ::toolkit::FixedHyperlinkBase* pBase = (::toolkit::FixedHyperlinkBase*)GetWindow();
+ if ( pBase )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_URL:
+ {
+ aProp = makeAny( ::rtl::OUString( pBase->GetURL() ) );
+ break;
+ }
+
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+void VCLXFixedHyperlink::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_LABEL,
+ BASEPROPERTY_MULTILINE,
+ BASEPROPERTY_NOLABEL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_URL,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+// ----------------------------------------------------
+// class VCLXFixedText
+// ----------------------------------------------------
+void VCLXFixedText::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_LABEL,
+ BASEPROPERTY_MULTILINE,
+ BASEPROPERTY_NOLABEL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_REFERENCE_DEVICE,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXFixedText::VCLXFixedText()
+{
+}
+
+VCLXFixedText::~VCLXFixedText()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXFixedText::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XFixedText*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXFixedText )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFixedText>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXFixedText::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXFixedText::setText( const ::rtl::OUString& Text ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetText( Text );
+}
+
+::rtl::OUString VCLXFixedText::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+void VCLXFixedText::setAlignment( short nAlign ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nNewBits = 0;
+ if ( nAlign == ::com::sun::star::awt::TextAlign::LEFT )
+ nNewBits = WB_LEFT;
+ else if ( nAlign == ::com::sun::star::awt::TextAlign::CENTER )
+ nNewBits = WB_CENTER;
+ else
+ nNewBits = WB_RIGHT;
+
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_LEFT|WB_CENTER|WB_RIGHT);
+ pWindow->SetStyle( nStyle | nNewBits );
+ }
+}
+
+short VCLXFixedText::getAlignment() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ short nAlign = 0;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( nStyle & WB_LEFT )
+ nAlign = ::com::sun::star::awt::TextAlign::LEFT;
+ else if ( nStyle & WB_CENTER )
+ nAlign = ::com::sun::star::awt::TextAlign::CENTER;
+ else
+ nAlign = ::com::sun::star::awt::TextAlign::RIGHT;
+ }
+ return nAlign;
+}
+
+::com::sun::star::awt::Size VCLXFixedText::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ FixedText* pFixedText = (FixedText*)GetWindow();
+ if ( pFixedText )
+ aSz = pFixedText->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXFixedText::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return getMinimumSize();
+}
+
+::com::sun::star::awt::Size VCLXFixedText::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Height != aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+
+ return aSz;
+}
+
+// ----------------------------------------------------
+// class VCLXScrollBar
+// ----------------------------------------------------
+void VCLXScrollBar::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BLOCKINCREMENT,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_LINEINCREMENT,
+ BASEPROPERTY_LIVE_SCROLL,
+ BASEPROPERTY_ORIENTATION,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_REPEAT_DELAY,
+ BASEPROPERTY_SCROLLVALUE,
+ BASEPROPERTY_SCROLLVALUE_MAX,
+ BASEPROPERTY_SCROLLVALUE_MIN,
+ BASEPROPERTY_SYMBOL_COLOR,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_VISIBLESIZE,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXScrollBar::VCLXScrollBar() : maAdjustmentListeners( *this )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXScrollBar::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XScrollBar*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXScrollBar )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XScrollBar>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXScrollBar::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+// ::com::sun::star::lang::XComponent
+void VCLXScrollBar::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maAdjustmentListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+// ::com::sun::star::awt::XScrollbar
+void VCLXScrollBar::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maAdjustmentListeners.addInterface( l );
+}
+
+void VCLXScrollBar::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maAdjustmentListeners.removeInterface( l );
+}
+
+void VCLXScrollBar::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->DoScroll( n );
+}
+
+void VCLXScrollBar::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ {
+ pScrollBar->SetVisibleSize( nVisible );
+ pScrollBar->SetRangeMax( nMax );
+ pScrollBar->DoScroll( nValue );
+ }
+}
+
+sal_Int32 VCLXScrollBar::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetThumbPos() : 0;
+}
+
+void VCLXScrollBar::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetRangeMax( n );
+}
+
+sal_Int32 VCLXScrollBar::getMaximum() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetRangeMax() : 0;
+}
+
+void VCLXScrollBar::setMinimum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ if ( pScrollBar )
+ pScrollBar->SetRangeMin( n );
+}
+
+sal_Int32 VCLXScrollBar::getMinimum() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = static_cast< ScrollBar* >( GetWindow() );
+ return pScrollBar ? pScrollBar->GetRangeMin() : 0;
+}
+
+void VCLXScrollBar::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetLineSize( n );
+}
+
+sal_Int32 VCLXScrollBar::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetLineSize() : 0;
+}
+
+void VCLXScrollBar::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetPageSize( n );
+}
+
+sal_Int32 VCLXScrollBar::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetPageSize() : 0;
+}
+
+void VCLXScrollBar::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ if ( pScrollBar )
+ pScrollBar->SetVisibleSize( n );
+}
+
+sal_Int32 VCLXScrollBar::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*) GetWindow();
+ return pScrollBar ? pScrollBar->GetVisibleSize() : 0;
+}
+
+void VCLXScrollBar::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ nStyle &= ~(WB_HORZ|WB_VERT);
+ if ( n == ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL )
+ nStyle |= WB_HORZ;
+ else
+ nStyle |= WB_VERT;
+
+ pWindow->SetStyle( nStyle );
+ pWindow->Resize();
+ }
+}
+
+sal_Int32 VCLXScrollBar::getOrientation() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 n = 0;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ {
+ WinBits nStyle = pWindow->GetStyle();
+ if ( nStyle & WB_HORZ )
+ n = ::com::sun::star::awt::ScrollBarOrientation::HORIZONTAL;
+ else
+ n = ::com::sun::star::awt::ScrollBarOrientation::VERTICAL;
+ }
+ return n;
+
+}
+
+// ::com::sun::star::awt::VclWindowPeer
+void VCLXScrollBar::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
+ if ( pScrollBar )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LIVE_SCROLL:
+ {
+ sal_Bool bDo = sal_False;
+ if ( !bVoid )
+ {
+ OSL_VERIFY( Value >>= bDo );
+ }
+ AllSettings aSettings( pScrollBar->GetSettings() );
+ StyleSettings aStyle( aSettings.GetStyleSettings() );
+ ULONG nDragOptions = aStyle.GetDragFullOptions();
+ if ( bDo )
+ nDragOptions |= DRAGFULL_OPTION_SCROLL;
+ else
+ nDragOptions &= ~DRAGFULL_OPTION_SCROLL;
+ aStyle.SetDragFullOptions( nDragOptions );
+ aSettings.SetStyleSettings( aStyle );
+ pScrollBar->SetSettings( aSettings );
+ }
+ break;
+
+ case BASEPROPERTY_SCROLLVALUE:
+ {
+ if ( !bVoid )
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setValue( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_SCROLLVALUE_MAX:
+ case BASEPROPERTY_SCROLLVALUE_MIN:
+ {
+ if ( !bVoid )
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ {
+ if ( nPropType == BASEPROPERTY_SCROLLVALUE_MAX )
+ setMaximum( n );
+ else
+ setMinimum( n );
+ }
+ }
+ }
+ break;
+ case BASEPROPERTY_LINEINCREMENT:
+ {
+ if ( !bVoid )
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setLineIncrement( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_BLOCKINCREMENT:
+ {
+ if ( !bVoid )
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setBlockIncrement( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_VISIBLESIZE:
+ {
+ if ( !bVoid )
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setVisibleSize( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_ORIENTATION:
+ {
+ if ( !bVoid )
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setOrientation( n );
+ }
+ }
+ break;
+
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ {
+ // the default implementation of the base class doesn't work here, since our
+ // interpretation for this property is slightly different
+ ::toolkit::setButtonLikeFaceColor( pScrollBar, Value);
+ }
+ break;
+
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXScrollBar::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
+ if ( pScrollBar )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LIVE_SCROLL:
+ {
+ aProp <<= (sal_Bool)( 0 != ( pScrollBar->GetSettings().GetStyleSettings().GetDragFullOptions() & DRAGFULL_OPTION_SCROLL ) );
+ }
+ break;
+ case BASEPROPERTY_SCROLLVALUE:
+ {
+ aProp <<= (sal_Int32) getValue();
+ }
+ break;
+ case BASEPROPERTY_SCROLLVALUE_MAX:
+ {
+ aProp <<= (sal_Int32) getMaximum();
+ }
+ break;
+ case BASEPROPERTY_SCROLLVALUE_MIN:
+ {
+ aProp <<= (sal_Int32) getMinimum();
+ }
+ break;
+ case BASEPROPERTY_LINEINCREMENT:
+ {
+ aProp <<= (sal_Int32) getLineIncrement();
+ }
+ break;
+ case BASEPROPERTY_BLOCKINCREMENT:
+ {
+ aProp <<= (sal_Int32) getBlockIncrement();
+ }
+ break;
+ case BASEPROPERTY_VISIBLESIZE:
+ {
+ aProp <<= (sal_Int32) getVisibleSize();
+ }
+ break;
+ case BASEPROPERTY_ORIENTATION:
+ {
+ aProp <<= (sal_Int32) getOrientation();
+ }
+ break;
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ {
+ // the default implementation of the base class doesn't work here, since our
+ // interpretation for this property is slightly different
+ aProp = ::toolkit::getButtonLikeFaceColor( pScrollBar );
+ }
+ break;
+
+ default:
+ {
+ aProp <<= VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+void VCLXScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_SCROLLBAR_SCROLL:
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // in during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ if ( maAdjustmentListeners.getLength() )
+ {
+ ScrollBar* pScrollBar = (ScrollBar*)GetWindow();
+
+ if( pScrollBar )
+ {
+ ::com::sun::star::awt::AdjustmentEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Value = pScrollBar->GetThumbPos();
+
+ // set adjustment type
+ ScrollType aType = pScrollBar->GetType();
+ if ( aType == SCROLL_LINEUP || aType == SCROLL_LINEDOWN )
+ {
+ aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_LINE;
+ }
+ else if ( aType == SCROLL_PAGEUP || aType == SCROLL_PAGEDOWN )
+ {
+ aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE;
+ }
+ else if ( aType == SCROLL_DRAG )
+ {
+ aEvent.Type = ::com::sun::star::awt::AdjustmentType_ADJUST_ABS;
+ }
+
+ maAdjustmentListeners.adjustmentValueChanged( aEvent );
+ }
+ }
+ }
+ break;
+
+ default:
+ VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::implGetMinimumSize( Window* p ) throw(::com::sun::star::uno::RuntimeException)
+{
+ long n = p->GetSettings().GetStyleSettings().GetScrollBarSize();
+ return ::com::sun::star::awt::Size( n, n );
+}
+
+::com::sun::star::awt::Size SAL_CALL VCLXScrollBar::getMinimumSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ return implGetMinimumSize( GetWindow() );
+}
+
+
+// ----------------------------------------------------
+// class VCLXEdit
+// ----------------------------------------------------
+
+void VCLXEdit::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ECHOCHAR,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HARDLINEBREAKS,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_HSCROLL,
+ BASEPROPERTY_LINE_END_FORMAT,
+ BASEPROPERTY_MAXTEXTLEN,
+ BASEPROPERTY_MULTILINE,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_TEXT,
+ BASEPROPERTY_VSCROLL,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_PAINTTRANSPARENT,
+ BASEPROPERTY_AUTOHSCROLL,
+ BASEPROPERTY_AUTOVSCROLL,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ 0);
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXEdit::VCLXEdit() : maTextListeners( *this )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXEdit::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextComponent*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextEditField*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTextLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXEdit )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextComponent>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextEditField>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains>* ) NULL ),
+ VCLXWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXEdit::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXEdit::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maTextListeners.disposeAndClear( aObj );
+ VCLXWindow::dispose();
+}
+
+void VCLXEdit::addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetTextListeners().addInterface( l );
+}
+
+void VCLXEdit::removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetTextListeners().removeInterface( l );
+}
+
+void VCLXEdit::setText( const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ pEdit->SetText( aText );
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+void VCLXEdit::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ pEdit->SetSelection( Selection( rSel.Min, rSel.Max ) );
+ pEdit->ReplaceSelected( aText );
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+::rtl::OUString VCLXEdit::getText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ aText = pWindow->GetText();
+ return aText;
+}
+
+::rtl::OUString VCLXEdit::getSelectedText() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aText;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit)
+ aText = pEdit->GetSelected();
+ return aText;
+
+}
+
+void VCLXEdit::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetSelection( Selection( aSelection.Min, aSelection.Max ) );
+}
+
+::com::sun::star::awt::Selection VCLXEdit::getSelection() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Selection aSel;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ aSel = pEdit->GetSelection();
+ return ::com::sun::star::awt::Selection( aSel.Min(), aSel.Max() );
+}
+
+sal_Bool VCLXEdit::isEditable() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ return ( pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled() ) ? sal_True : sal_False;
+}
+
+void VCLXEdit::setEditable( sal_Bool bEditable ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetReadOnly( !bEditable );
+}
+
+
+void VCLXEdit::setMaxTextLen( sal_Int16 nLen ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetMaxTextLen( nLen );
+}
+
+sal_Int16 VCLXEdit::getMaxTextLen() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ return pEdit ? pEdit->GetMaxTextLen() : 0;
+}
+
+void VCLXEdit::setEchoChar( sal_Unicode cEcho ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ pEdit->SetEchoChar( cEcho );
+}
+
+void VCLXEdit::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_HIDEINACTIVESELECTION:
+ ::toolkit::adjustBooleanWindowStyle( Value, pEdit, WB_NOHIDESELECTION, sal_True );
+ if ( pEdit->GetSubEdit() )
+ ::toolkit::adjustBooleanWindowStyle( Value, pEdit->GetSubEdit(), WB_NOHIDESELECTION, sal_True );
+ break;
+
+ case BASEPROPERTY_READONLY:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ pEdit->SetReadOnly( b );
+ }
+ break;
+ case BASEPROPERTY_ECHOCHAR:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pEdit->SetEchoChar( n );
+ }
+ break;
+ case BASEPROPERTY_MAXTEXTLEN:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pEdit->SetMaxTextLen( n );
+ }
+ break;
+ default:
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXEdit::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_HIDEINACTIVESELECTION:
+ aProp <<= (sal_Bool)( ( pEdit->GetStyle() & WB_NOHIDESELECTION ) == 0 );
+ break;
+ case BASEPROPERTY_READONLY:
+ aProp <<= (sal_Bool) pEdit->IsReadOnly();
+ break;
+ case BASEPROPERTY_ECHOCHAR:
+ aProp <<= (sal_Int16) pEdit->GetEchoChar();
+ break;
+ case BASEPROPERTY_MAXTEXTLEN:
+ aProp <<= (sal_Int16) pEdit->GetMaxTextLen();
+ break;
+ default:
+ {
+ aProp = VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+::com::sun::star::awt::Size VCLXEdit::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ aSz = pEdit->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXEdit::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ {
+ aSz = pEdit->CalcMinimumSize();
+ aSz.Height() += 4;
+ }
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXEdit::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::awt::Size aSz = rNewSize;
+ ::com::sun::star::awt::Size aMinSz = getMinimumSize();
+ if ( aSz.Height != aMinSz.Height )
+ aSz.Height = aMinSz.Height;
+
+ return aSz;
+}
+
+::com::sun::star::awt::Size VCLXEdit::getMinimumSize( sal_Int16 nCols, sal_Int16 ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ {
+ if ( nCols )
+ aSz = pEdit->CalcSize( nCols );
+ else
+ aSz = pEdit->CalcMinimumSize();
+ }
+ return AWTSize(aSz);
+}
+
+void VCLXEdit::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nLines = 1;
+ nCols = 0;
+ Edit* pEdit = (Edit*) GetWindow();
+ if ( pEdit )
+ nCols = pEdit->GetMaxVisChars();
+}
+
+void VCLXEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_EDIT_MODIFY:
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ if ( GetTextListeners().getLength() )
+ {
+ ::com::sun::star::awt::TextEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ GetTextListeners().textChanged( aEvent );
+ }
+ }
+ break;
+
+ default:
+ VCLXWindow::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXComboBox
+// ----------------------------------------------------
+
+void VCLXComboBox::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_AUTOCOMPLETE,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_DROPDOWN,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_LINECOUNT,
+ BASEPROPERTY_MAXTEXTLEN,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_STRINGITEMLIST,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_TEXT,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_REFERENCE_DEVICE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ // no, don't call VCLXEdit here - it has properties which we do *not* want to have at at combo box
+ // #i92690# / 2008-08-12 / frank.schoenheit@sun.com
+ // VCLXEdit::ImplGetPropertyIds( rIds );
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXComboBox::VCLXComboBox()
+ : maActionListeners( *this ), maItemListeners( *this )
+{
+}
+
+VCLXComboBox::~VCLXComboBox()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXComboBox::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XComboBox*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXEdit::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXComboBox )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XComboBox>* ) NULL ),
+ VCLXEdit::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXComboBox::CreateAccessibleContext()
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
+void VCLXComboBox::dispose() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aObj;
+ aObj.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aObj );
+ maActionListeners.disposeAndClear( aObj );
+ VCLXEdit::dispose();
+}
+
+
+void VCLXComboBox::addItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.addInterface( l );
+}
+
+void VCLXComboBox::removeItemListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maItemListeners.removeInterface( l );
+}
+
+void VCLXComboBox::addActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.addInterface( l );
+}
+
+void VCLXComboBox::removeActionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ maActionListeners.removeInterface( l );
+}
+
+void VCLXComboBox::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ pBox->InsertEntry( aItem, nPos );
+}
+
+void VCLXComboBox::addItems( const ::com::sun::star::uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nP = nPos;
+ for ( sal_uInt16 n = 0; n < aItems.getLength(); n++ )
+ {
+ pBox->InsertEntry( aItems.getConstArray()[n], nP );
+ if ( (sal_uInt16)nPos < 0xFFFF ) // Nicht wenn 0xFFFF, weil LIST_APPEND
+ nP++;
+ }
+ }
+}
+
+void VCLXComboBox::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ {
+ for ( sal_uInt16 n = nCount; n; )
+ pBox->RemoveEntry( nPos + (--n) );
+ }
+}
+
+sal_Int16 VCLXComboBox::getItemCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ return pBox ? pBox->GetEntryCount() : 0;
+}
+
+::rtl::OUString VCLXComboBox::getItem( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aItem;
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ aItem = pBox->GetEntry( nPos );
+ return aItem;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString> VCLXComboBox::getItems() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ {
+ sal_uInt16 nEntries = pBox->GetEntryCount();
+ aSeq = ::com::sun::star::uno::Sequence< ::rtl::OUString>( nEntries );
+ for ( sal_uInt16 n = nEntries; n; )
+ {
+ --n;
+ aSeq.getArray()[n] = pBox->GetEntry( n );
+ }
+ }
+ return aSeq;
+}
+
+void VCLXComboBox::setDropDownLineCount( sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ pBox->SetDropDownLineCount( nLines );
+}
+
+sal_Int16 VCLXComboBox::getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int16 nLines = 0;
+ ComboBox* pBox = (ComboBox*) GetWindow();
+ if ( pBox )
+ nLines = pBox->GetDropDownLineCount();
+ return nLines;
+}
+
+void VCLXComboBox::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = (ComboBox*)GetWindow();
+ if ( pComboBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LINECOUNT:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pComboBox->SetDropDownLineCount( n );
+ }
+ break;
+ case BASEPROPERTY_AUTOCOMPLETE:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ pComboBox->EnableAutocomplete( n != 0 );
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aItems;
+ if ( Value >>= aItems )
+ {
+ sal_Bool bUpdate = pComboBox->IsUpdateMode();
+ pComboBox->SetUpdateMode( sal_False );
+ pComboBox->Clear();
+ const ::rtl::OUString* pStrings = aItems.getConstArray();
+ sal_Int32 nItems = aItems.getLength();
+ for ( sal_Int32 n = 0; n < nItems; n++ )
+ pComboBox->InsertEntry( pStrings[n], LISTBOX_APPEND );
+ pComboBox->SetUpdateMode( bUpdate );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXEdit::setProperty( PropertyName, Value );
+
+ // #109385# SetBorderStyle is not virtual
+ if ( nPropType == BASEPROPERTY_BORDER )
+ {
+ sal_uInt16 nBorder = sal_uInt16();
+ if ( (Value >>= nBorder) && nBorder != 0 )
+ pComboBox->SetBorderStyle( nBorder );
+ }
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXComboBox::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ ComboBox* pComboBox = (ComboBox*)GetWindow();
+ if ( pComboBox )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_LINECOUNT:
+ {
+ aProp <<= (sal_Int16) pComboBox->GetDropDownLineCount();
+ }
+ break;
+ case BASEPROPERTY_AUTOCOMPLETE:
+ {
+ aProp <<= (sal_Bool) pComboBox->IsAutocompleteEnabled();
+ }
+ break;
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ sal_uInt16 nItems = pComboBox->GetEntryCount();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nItems );
+ ::rtl::OUString* pStrings = aSeq.getArray();
+ for ( sal_uInt16 n = 0; n < nItems; n++ )
+ pStrings[n] = pComboBox->GetEntry( n );
+ aProp <<= aSeq;
+
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXEdit::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+void VCLXComboBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xKeepAlive( this );
+ // since we call listeners below, there is a potential that we will be destroyed
+ // during the listener call. To prevent the resulting crashs, we keep us
+ // alive as long as we're here
+ // #20178# - 2003-10-01 - fs@openoffice.org
+
+ switch ( rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_COMBOBOX_SELECT:
+ if ( maItemListeners.getLength() )
+ {
+ ComboBox* pComboBox = (ComboBox*)GetWindow();
+ if( pComboBox )
+ {
+ if ( !pComboBox->IsTravelSelect() )
+ {
+ ::com::sun::star::awt::ItemEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+ aEvent.Highlighted = sal_False;
+
+ // Bei Mehrfachselektion 0xFFFF, sonst die ID
+ aEvent.Selected = pComboBox->GetEntryPos( pComboBox->GetText() );
+
+ maItemListeners.itemStateChanged( aEvent );
+ }
+ }
+ }
+ break;
+
+ case VCLEVENT_COMBOBOX_DOUBLECLICK:
+ if ( maActionListeners.getLength() )
+ {
+ ::com::sun::star::awt::ActionEvent aEvent;
+ aEvent.Source = (::cppu::OWeakObject*)this;
+// aEvent.ActionCommand = ...;
+ maActionListeners.actionPerformed( aEvent );
+ }
+ break;
+
+ default:
+ VCLXEdit::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ aSz = pComboBox->CalcMinimumSize();
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXComboBox::getPreferredSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ {
+ aSz = pComboBox->CalcMinimumSize();
+ if ( pComboBox->GetStyle() & WB_DROPDOWN )
+ aSz.Height() += 4;
+ }
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXComboBox::calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = VCLSize(rNewSize);
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ aSz = pComboBox->CalcAdjustedSize( aSz );
+ return AWTSize(aSz);
+}
+
+::com::sun::star::awt::Size VCLXComboBox::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ aSz = pComboBox->CalcSize( nCols, nLines );
+ return AWTSize(aSz);
+}
+
+void VCLXComboBox::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ nCols = nLines = 0;
+ ComboBox* pComboBox = (ComboBox*) GetWindow();
+ if ( pComboBox )
+ {
+ sal_uInt16 nC, nL;
+ pComboBox->GetMaxVisColumnsAndLines( nC, nL );
+ nCols = nC;
+ nLines = nL;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXFormattedSpinField
+// ----------------------------------------------------
+void VCLXFormattedSpinField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ // Interestingly in the UnoControl API this is
+ // - not derived from XEdit ultimately, (correct ?) - so cut this here ...
+// VCLXSpinField::ImplGetPropertyIds( rIds );
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXFormattedSpinField::VCLXFormattedSpinField()
+{
+}
+
+VCLXFormattedSpinField::~VCLXFormattedSpinField()
+{
+}
+
+void VCLXFormattedSpinField::setStrictFormat( sal_Bool bStrict )
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ pFormatter->SetStrictFormat( bStrict );
+}
+
+sal_Bool VCLXFormattedSpinField::isStrictFormat()
+{
+ FormatterBase* pFormatter = GetFormatter();
+ return pFormatter ? pFormatter->IsStrictFormat() : sal_False;
+}
+
+
+void VCLXFormattedSpinField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_SPIN:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ {
+ WinBits nStyle = GetWindow()->GetStyle() | WB_SPIN;
+ if ( !b )
+ nStyle &= ~WB_SPIN;
+ GetWindow()->SetStyle( nStyle );
+ }
+ }
+ break;
+ case BASEPROPERTY_STRICTFORMAT:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ {
+ pFormatter->SetStrictFormat( b );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXFormattedSpinField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TABSTOP:
+ {
+ aProp <<= (sal_Bool) ( ( GetWindow()->GetStyle() & WB_SPIN ) ? sal_True : sal_False );
+ }
+ break;
+ case BASEPROPERTY_STRICTFORMAT:
+ {
+ aProp <<= (sal_Bool) pFormatter->IsStrictFormat();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+// ----------------------------------------------------
+// class VCLXDateField
+// ----------------------------------------------------
+
+void VCLXDateField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DATE,
+ BASEPROPERTY_DATEMAX,
+ BASEPROPERTY_DATEMIN,
+ BASEPROPERTY_DATESHOWCENTURY,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_DROPDOWN,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_EXTDATEFORMAT,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_REPEAT,
+ BASEPROPERTY_REPEAT_DELAY,
+ BASEPROPERTY_SPIN,
+ BASEPROPERTY_STRICTFORMAT,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_ENFORCE_FORMAT,
+ BASEPROPERTY_TEXT,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
+}
+
+VCLXDateField::VCLXDateField()
+{
+}
+
+VCLXDateField::~VCLXDateField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXDateField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XDateField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXDateField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDateField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXDateField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DATE:
+ {
+ if ( bVoid )
+ {
+ ((DateField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((DateField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setDate( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_DATEMIN:
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setMin( n );
+ }
+ break;
+ case BASEPROPERTY_DATEMAX:
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setMax( n );
+ }
+ break;
+ case BASEPROPERTY_EXTDATEFORMAT:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ ((DateField*)GetWindow())->SetExtDateFormat( (ExtDateFieldFormat) n );
+ }
+ break;
+ case BASEPROPERTY_DATESHOWCENTURY:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ ((DateField*)GetWindow())->SetShowDateCentury( b );
+ }
+ break;
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ {
+ sal_Bool bEnforce( sal_True );
+ OSL_VERIFY( Value >>= bEnforce );
+ static_cast< DateField* >( GetWindow() )->EnforceValidValue( bEnforce );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXDateField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DATE:
+ {
+ aProp <<= (sal_Int32) getDate();
+ }
+ break;
+ case BASEPROPERTY_DATEMIN:
+ {
+ aProp <<= (sal_Int32) getMin();
+ }
+ break;
+ case BASEPROPERTY_DATEMAX:
+ {
+ aProp <<= (sal_Int32) getMax();
+ }
+ break;
+ case BASEPROPERTY_DATESHOWCENTURY:
+ {
+ aProp <<= ((DateField*)GetWindow())->IsShowDateCentury();
+ }
+ break;
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ {
+ aProp <<= (sal_Bool)static_cast< DateField* >( GetWindow() )->IsEnforceValidValue( );
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+void VCLXDateField::setDate( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ {
+ pDateField->SetDate( nDate );
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pDateField->SetModifyFlag();
+ pDateField->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+sal_Int32 VCLXDateField::getDate() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetDate().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setMin( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetMin( nDate );
+}
+
+sal_Int32 VCLXDateField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetMin().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setMax( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetMax( nDate );
+}
+
+sal_Int32 VCLXDateField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetMax().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setFirst( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetFirst( nDate );
+}
+
+sal_Int32 VCLXDateField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetFirst().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setLast( sal_Int32 nDate ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetLast( nDate );
+}
+
+sal_Int32 VCLXDateField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nDate = 0;
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ nDate = pDateField->GetLast().GetDate();
+
+ return nDate;
+}
+
+void VCLXDateField::setLongFormat( sal_Bool bLong ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ pDateField->SetLongFormat( bLong );
+}
+
+sal_Bool VCLXDateField::isLongFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ return pDateField ? pDateField->IsLongFormat() : sal_False;
+}
+
+void VCLXDateField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ if ( pDateField )
+ {
+ pDateField->SetEmptyDate();
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pDateField->SetModifyFlag();
+ pDateField->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+sal_Bool VCLXDateField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ DateField* pDateField = (DateField*) GetWindow();
+ return pDateField ? pDateField->IsEmptyDate() : sal_False;
+}
+
+void VCLXDateField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXDateField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+// ----------------------------------------------------
+// class VCLXTimeField
+// ----------------------------------------------------
+
+void VCLXTimeField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_EXTTIMEFORMAT,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_REPEAT,
+ BASEPROPERTY_REPEAT_DELAY,
+ BASEPROPERTY_SPIN,
+ BASEPROPERTY_STRICTFORMAT,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_TIME,
+ BASEPROPERTY_TIMEMAX,
+ BASEPROPERTY_TIMEMIN,
+ BASEPROPERTY_ENFORCE_FORMAT,
+ BASEPROPERTY_TEXT,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
+}
+
+VCLXTimeField::VCLXTimeField()
+{
+}
+
+VCLXTimeField::~VCLXTimeField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTimeField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXTimeField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTimeField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXTimeField::setTime( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ {
+ pTimeField->SetTime( nTime );
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ SetSynthesizingVCLEvent( sal_True );
+ pTimeField->SetModifyFlag();
+ pTimeField->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+sal_Int32 VCLXTimeField::getTime() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetTime().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setMin( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetMin( nTime );
+}
+
+sal_Int32 VCLXTimeField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetMin().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setMax( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetMax( nTime );
+}
+
+sal_Int32 VCLXTimeField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetMax().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setFirst( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetFirst( nTime );
+}
+
+sal_Int32 VCLXTimeField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetFirst().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setLast( sal_Int32 nTime ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetLast( nTime );
+}
+
+sal_Int32 VCLXTimeField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ sal_Int32 nTime = 0;
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ nTime = pTimeField->GetLast().GetTime();
+
+ return nTime;
+}
+
+void VCLXTimeField::setEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ if ( pTimeField )
+ pTimeField->SetEmptyTime();
+}
+
+sal_Bool VCLXTimeField::isEmpty() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TimeField* pTimeField = (TimeField*) GetWindow();
+ return pTimeField ? pTimeField->IsEmptyTime() : sal_False;
+}
+
+void VCLXTimeField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXTimeField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+void VCLXTimeField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TIME:
+ {
+ if ( bVoid )
+ {
+ ((TimeField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((TimeField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setTime( n );
+ }
+ }
+ break;
+ case BASEPROPERTY_TIMEMIN:
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setMin( n );
+ }
+ break;
+ case BASEPROPERTY_TIMEMAX:
+ {
+ sal_Int32 n = 0;
+ if ( Value >>= n )
+ setMax( n );
+ }
+ break;
+ case BASEPROPERTY_EXTTIMEFORMAT:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ ((TimeField*)GetWindow())->SetExtFormat( (ExtTimeFieldFormat) n );
+ }
+ break;
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ {
+ sal_Bool bEnforce( sal_True );
+ OSL_VERIFY( Value >>= bEnforce );
+ static_cast< TimeField* >( GetWindow() )->EnforceValidValue( bEnforce );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXTimeField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_TIME:
+ {
+ aProp <<= (sal_Int32) getTime();
+ }
+ break;
+ case BASEPROPERTY_TIMEMIN:
+ {
+ aProp <<= (sal_Int32) getMin();
+ }
+ break;
+ case BASEPROPERTY_TIMEMAX:
+ {
+ aProp <<= (sal_Int32) getMax();
+ }
+ break;
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ {
+ aProp <<= (sal_Bool)static_cast< TimeField* >( GetWindow() )->IsEnforceValidValue( );
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+// ----------------------------------------------------
+// class VCLXNumericField
+// ----------------------------------------------------
+
+void VCLXNumericField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DECIMALACCURACY,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_NUMSHOWTHOUSANDSEP,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_REPEAT,
+ BASEPROPERTY_REPEAT_DELAY,
+ BASEPROPERTY_SPIN,
+ BASEPROPERTY_STRICTFORMAT,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_VALUEMAX_DOUBLE,
+ BASEPROPERTY_VALUEMIN_DOUBLE,
+ BASEPROPERTY_VALUESTEP_DOUBLE,
+ BASEPROPERTY_VALUE_DOUBLE,
+ BASEPROPERTY_ENFORCE_FORMAT,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
+}
+
+VCLXNumericField::VCLXNumericField()
+{
+}
+
+VCLXNumericField::~VCLXNumericField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXNumericField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XNumericField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXNumericField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XNumericField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXNumericField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ {
+ // z.B. 105, 2 Digits => 1,05
+ // ein float 1,05 muss also eine 105 einstellen...
+ pNumericFormatter->SetValue(
+ (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ SetSynthesizingVCLEvent( sal_True );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+ }
+}
+
+double VCLXNumericField::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter
+ ? ImplCalcDoubleValue( (double)pNumericFormatter->GetValue(), pNumericFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ pNumericFormatter->SetMin(
+ (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter
+ ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMin(), pNumericFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ pNumericFormatter->SetMax(
+ (long)ImplCalcLongValue( Value, pNumericFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter
+ ? ImplCalcDoubleValue( (double)pNumericFormatter->GetMax(), pNumericFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ if ( pNumericField )
+ pNumericField->SetFirst(
+ (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ return pNumericField
+ ? ImplCalcDoubleValue( (double)pNumericField->GetFirst(), pNumericField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ if ( pNumericField )
+ pNumericField->SetLast(
+ (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ return pNumericField
+ ? ImplCalcDoubleValue( (double)pNumericField->GetLast(), pNumericField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXNumericField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+void VCLXNumericField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ if ( pNumericField )
+ pNumericField->SetSpinSize(
+ (long)ImplCalcLongValue( Value, pNumericField->GetDecimalDigits() ) );
+}
+
+double VCLXNumericField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericField* pNumericField = (NumericField*) GetWindow();
+ return pNumericField
+ ? ImplCalcDoubleValue( (double)pNumericField->GetSpinSize(), pNumericField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXNumericField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ if ( pNumericFormatter )
+ {
+ double n = getValue();
+ pNumericFormatter->SetDecimalDigits( Value );
+ setValue( n );
+ }
+}
+
+sal_Int16 VCLXNumericField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
+}
+
+void VCLXNumericField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ if ( bVoid )
+ {
+ ((NumericField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((NumericField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setValue( d );
+ }
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setMin( d );
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setMax( d );
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setSpinSize( d );
+ }
+ break;
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ setDecimalDigits( n );
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ ((NumericField*)GetWindow())->SetUseThousandSep( b );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXNumericField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ aProp <<= (double) getValue();
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ aProp <<= (double) getMin();
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ aProp <<= (double) getMax();
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ aProp <<= (double) getSpinSize();
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+
+// ----------------------------------------------------
+// class VCLXMetricField
+// ----------------------------------------------------
+
+void VCLXMetricField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DECIMALACCURACY,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_NUMSHOWTHOUSANDSEP,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_REPEAT,
+ BASEPROPERTY_REPEAT_DELAY,
+ BASEPROPERTY_SPIN,
+ BASEPROPERTY_STRICTFORMAT,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_ENFORCE_FORMAT,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_UNIT,
+ BASEPROPERTY_CUSTOMUNITTEXT,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
+}
+
+VCLXMetricField::VCLXMetricField()
+{
+}
+
+VCLXMetricField::~VCLXMetricField()
+{
+}
+
+MetricFormatter *VCLXMetricField::GetMetricFormatter() throw(::com::sun::star::uno::RuntimeException)
+{
+ MetricFormatter *pFormatter = (MetricFormatter *) GetFormatter();
+ if (!pFormatter)
+ throw ::com::sun::star::uno::RuntimeException();
+ return pFormatter;
+}
+
+MetricField *VCLXMetricField::GetMetricField() throw(::com::sun::star::uno::RuntimeException)
+{
+ MetricField *pField = (MetricField *) GetWindow();
+ if (!pField)
+ throw ::com::sun::star::uno::RuntimeException();
+ return pField;
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXMetricField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XMetricField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXMetricField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMetricField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// FIXME: later ...
+#define MetricUnitUnoToVcl(a) ((FieldUnit)(a))
+
+#define METRIC_MAP_PAIR(method,parent) \
+ sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::vos::OGuard aGuard( GetMutex() ); \
+ return GetMetric##parent()->Get##method( MetricUnitUnoToVcl( nUnit ) ); \
+ } \
+ void VCLXMetricField::set##method( sal_Int64 nValue, sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::vos::OGuard aGuard( GetMutex() ); \
+ GetMetric##parent()->Set##method( nValue, MetricUnitUnoToVcl( nUnit ) ); \
+ }
+
+METRIC_MAP_PAIR(Min, Formatter)
+METRIC_MAP_PAIR(Max, Formatter)
+METRIC_MAP_PAIR(First, Field)
+METRIC_MAP_PAIR(Last, Field)
+
+#undef METRIC_MAP_PAIR
+
+::sal_Int64 VCLXMetricField::getValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ return GetMetricFormatter()->GetValue( MetricUnitUnoToVcl( nUnit ) );
+}
+
+::sal_Int64 VCLXMetricField::getCorrectedValue( ::sal_Int16 nUnit ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ return GetMetricFormatter()->GetCorrectedValue( MetricUnitUnoToVcl( nUnit ) );
+}
+
+// FIXME: acute cut/paste evilness - move this to the parent Edit class ?
+void VCLXMetricField::CallListeners()
+{
+ // #107218# Call same listeners like VCL would do after user interaction
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ SetSynthesizingVCLEvent( sal_True );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+}
+
+void VCLXMetricField::setValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetMetricFormatter()->SetValue( Value, MetricUnitUnoToVcl( Unit ) );
+ CallListeners();
+}
+
+void VCLXMetricField::setUserValue( ::sal_Int64 Value, ::sal_Int16 Unit ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetMetricFormatter()->SetUserValue( Value, MetricUnitUnoToVcl( Unit ) );
+ CallListeners();
+}
+
+void VCLXMetricField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXMetricField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+void VCLXMetricField::setSpinSize( sal_Int64 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetMetricField()->SetSpinSize( Value );
+}
+
+sal_Int64 VCLXMetricField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ return GetMetricField()->GetSpinSize();
+}
+
+void VCLXMetricField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ GetMetricFormatter()->SetDecimalDigits( Value );
+}
+
+sal_Int16 VCLXMetricField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ NumericFormatter* pNumericFormatter = (NumericFormatter*) GetFormatter();
+ return pNumericFormatter ? pNumericFormatter->GetDecimalDigits() : 0;
+}
+
+void VCLXMetricField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int16 n = 0;
+ if ( Value >>= n )
+ setDecimalDigits( n );
+ break;
+ }
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ sal_Bool b = sal_False;
+ if ( Value >>= b )
+ ((NumericField*)GetWindow())->SetUseThousandSep( b );
+ }
+ break;
+ case BASEPROPERTY_UNIT:
+ {
+ sal_uInt16 nVal = 0;
+ if ( Value >>= nVal )
+ ((MetricField*)GetWindow())->SetUnit( (FieldUnit) nVal );
+ break;
+ }
+ case BASEPROPERTY_CUSTOMUNITTEXT:
+ {
+ rtl::OUString aStr;
+ if ( Value >>= aStr )
+ ((MetricField*)GetWindow())->SetCustomUnitText( aStr );
+ break;
+ }
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ break;
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXMetricField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ aProp <<= (sal_Bool) ((NumericField*)GetWindow())->IsUseThousandSep();
+ break;
+ case BASEPROPERTY_UNIT:
+ aProp <<= (sal_uInt16) ((MetricField*)GetWindow())->GetUnit();
+ break;
+ case BASEPROPERTY_CUSTOMUNITTEXT:
+ aProp <<= rtl::OUString (((MetricField*)GetWindow())->GetCustomUnitText());
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ break;
+ }
+ }
+ }
+ return aProp;
+}
+
+
+// ----------------------------------------------------
+// class VCLXCurrencyField
+// ----------------------------------------------------
+
+void VCLXCurrencyField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_CURRENCYSYMBOL,
+ BASEPROPERTY_CURSYM_POSITION,
+ BASEPROPERTY_DECIMALACCURACY,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_NUMSHOWTHOUSANDSEP,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_REPEAT,
+ BASEPROPERTY_REPEAT_DELAY,
+ BASEPROPERTY_SPIN,
+ BASEPROPERTY_STRICTFORMAT,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_VALUEMAX_DOUBLE,
+ BASEPROPERTY_VALUEMIN_DOUBLE,
+ BASEPROPERTY_VALUESTEP_DOUBLE,
+ BASEPROPERTY_VALUE_DOUBLE,
+ BASEPROPERTY_ENFORCE_FORMAT,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
+}
+
+VCLXCurrencyField::VCLXCurrencyField()
+{
+}
+
+VCLXCurrencyField::~VCLXCurrencyField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXCurrencyField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XCurrencyField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXCurrencyField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XCurrencyField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXCurrencyField::setValue( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ {
+ // z.B. 105, 2 Digits => 1,05
+ // ein float 1,05 muss also eine 105 einstellen...
+ pCurrencyFormatter->SetValue(
+ ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
+
+ // #107218# Call same listeners like VCL would do after user interaction
+ Edit* pEdit = (Edit*)GetWindow();
+ if ( pEdit )
+ {
+ SetSynthesizingVCLEvent( sal_True );
+ pEdit->SetModifyFlag();
+ pEdit->Modify();
+ SetSynthesizingVCLEvent( sal_False );
+ }
+ }
+}
+
+double VCLXCurrencyField::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter
+ ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetValue(), pCurrencyFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setMin( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ pCurrencyFormatter->SetMin(
+ ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getMin() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter
+ ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMin(), pCurrencyFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setMax( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ pCurrencyFormatter->SetMax(
+ ImplCalcLongValue( Value, pCurrencyFormatter->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getMax() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter
+ ? ImplCalcDoubleValue( (double)pCurrencyFormatter->GetMax(), pCurrencyFormatter->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setFirst( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ if ( pCurrencyField )
+ pCurrencyField->SetFirst(
+ ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getFirst() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ return pCurrencyField
+ ? ImplCalcDoubleValue( (double)pCurrencyField->GetFirst(), pCurrencyField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setLast( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ if ( pCurrencyField )
+ pCurrencyField->SetLast(
+ ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getLast() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ return pCurrencyField
+ ? ImplCalcDoubleValue( (double)pCurrencyField->GetLast(), pCurrencyField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setSpinSize( double Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ if ( pCurrencyField )
+ pCurrencyField->SetSpinSize(
+ ImplCalcLongValue( Value, pCurrencyField->GetDecimalDigits() ) );
+}
+
+double VCLXCurrencyField::getSpinSize() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyField* pCurrencyField = (LongCurrencyField*) GetWindow();
+ return pCurrencyField
+ ? ImplCalcDoubleValue( (double)pCurrencyField->GetSpinSize(), pCurrencyField->GetDecimalDigits() )
+ : 0;
+}
+
+void VCLXCurrencyField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXCurrencyField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+
+void VCLXCurrencyField::setDecimalDigits( sal_Int16 Value ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ if ( pCurrencyFormatter )
+ {
+ double n = getValue();
+ pCurrencyFormatter->SetDecimalDigits( Value );
+ setValue( n );
+ }
+}
+
+sal_Int16 VCLXCurrencyField::getDecimalDigits() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ LongCurrencyFormatter* pCurrencyFormatter = (LongCurrencyFormatter*) GetFormatter();
+ return pCurrencyFormatter ? pCurrencyFormatter->GetDecimalDigits() : 0;
+}
+
+void VCLXCurrencyField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_Bool bVoid = Value.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ if ( bVoid )
+ {
+ ((LongCurrencyField*)GetWindow())->EnableEmptyFieldValue( sal_True );
+ ((LongCurrencyField*)GetWindow())->SetEmptyFieldValue();
+ }
+ else
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setValue( d );
+ }
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setMin( d );
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setMax( d );
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ double d = 0;
+ if ( Value >>= d )
+ setSpinSize( d );
+ }
+ break;
+ case BASEPROPERTY_DECIMALACCURACY:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ setDecimalDigits( n );
+ }
+ break;
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ ::rtl::OUString aString;
+ if ( Value >>= aString )
+ ((LongCurrencyField*)GetWindow())->SetCurrencySymbol( aString );
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ sal_Bool b = sal_Bool();
+ if ( Value >>= b )
+ ((LongCurrencyField*)GetWindow())->SetUseThousandSep( b );
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXCurrencyField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ FormatterBase* pFormatter = GetFormatter();
+ if ( pFormatter )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_VALUE_DOUBLE:
+ {
+ aProp <<= (double) getValue();
+ }
+ break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE:
+ {
+ aProp <<= (double) getMin();
+ }
+ break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE:
+ {
+ aProp <<= (double) getMax();
+ }
+ break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE:
+ {
+ aProp <<= (double) getSpinSize();
+ }
+ break;
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ aProp <<= ::rtl::OUString( ((LongCurrencyField*)GetWindow())->GetCurrencySymbol() );
+ }
+ break;
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ {
+ aProp <<= (sal_Bool) ((LongCurrencyField*)GetWindow())->IsUseThousandSep();
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+// ----------------------------------------------------
+// class VCLXPatternField
+// ----------------------------------------------------
+
+void VCLXPatternField::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ PushPropertyIds( rIds,
+ BASEPROPERTY_ALIGN,
+ BASEPROPERTY_BACKGROUNDCOLOR,
+ BASEPROPERTY_BORDER,
+ BASEPROPERTY_BORDERCOLOR,
+ BASEPROPERTY_DEFAULTCONTROL,
+ BASEPROPERTY_EDITMASK,
+ BASEPROPERTY_ENABLED,
+ BASEPROPERTY_ENABLEVISIBLE,
+ BASEPROPERTY_FONTDESCRIPTOR,
+ BASEPROPERTY_HELPTEXT,
+ BASEPROPERTY_HELPURL,
+ BASEPROPERTY_LITERALMASK,
+ BASEPROPERTY_MAXTEXTLEN,
+ BASEPROPERTY_PRINTABLE,
+ BASEPROPERTY_READONLY,
+ BASEPROPERTY_STRICTFORMAT,
+ BASEPROPERTY_TABSTOP,
+ BASEPROPERTY_TEXT,
+ BASEPROPERTY_HIDEINACTIVESELECTION,
+ BASEPROPERTY_VERTICALALIGN,
+ BASEPROPERTY_WRITING_MODE,
+ BASEPROPERTY_CONTEXT_WRITING_MODE,
+ BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR,
+ 0);
+ VCLXFormattedSpinField::ImplGetPropertyIds( rIds );
+}
+
+VCLXPatternField::VCLXPatternField()
+{
+}
+
+VCLXPatternField::~VCLXPatternField()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any VCLXPatternField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XPatternField*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXFormattedSpinField::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( VCLXPatternField )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPatternField>* ) NULL ),
+ VCLXFormattedSpinField::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void VCLXPatternField::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ {
+ pPatternField->SetMask( ByteString( UniString( EditMask ), RTL_TEXTENCODING_ASCII_US ), LiteralMask );
+ }
+}
+
+void VCLXPatternField::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ {
+ EditMask = String( pPatternField->GetEditMask(), RTL_TEXTENCODING_ASCII_US );
+ LiteralMask = pPatternField->GetLiteralMask();
+ }
+}
+
+void VCLXPatternField::setString( const ::rtl::OUString& Str ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ {
+ pPatternField->SetString( Str );
+ }
+}
+
+::rtl::OUString VCLXPatternField::getString() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::rtl::OUString aString;
+ PatternField* pPatternField = (PatternField*) GetWindow();
+ if ( pPatternField )
+ aString = pPatternField->GetString();
+ return aString;
+}
+
+void VCLXPatternField::setStrictFormat( sal_Bool bStrict ) throw(::com::sun::star::uno::RuntimeException)
+{
+ VCLXFormattedSpinField::setStrictFormat( bStrict );
+}
+
+sal_Bool VCLXPatternField::isStrictFormat() throw(::com::sun::star::uno::RuntimeException)
+{
+ return VCLXFormattedSpinField::isStrictFormat();
+}
+
+void VCLXPatternField::setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_EDITMASK:
+ case BASEPROPERTY_LITERALMASK:
+ {
+ ::rtl::OUString aString;
+ if ( Value >>= aString )
+ {
+ ::rtl::OUString aEditMask, aLiteralMask;
+ getMasks( aEditMask, aLiteralMask );
+ if ( nPropType == BASEPROPERTY_EDITMASK )
+ aEditMask = aString;
+ else
+ aLiteralMask = aString;
+ setMasks( aEditMask, aLiteralMask );
+ }
+ }
+ break;
+ default:
+ {
+ VCLXFormattedSpinField::setProperty( PropertyName, Value );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any VCLXPatternField::getProperty( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Any aProp;
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropType = GetPropertyId( PropertyName );
+ switch ( nPropType )
+ {
+ case BASEPROPERTY_EDITMASK:
+ case BASEPROPERTY_LITERALMASK:
+ {
+ ::rtl::OUString aEditMask, aLiteralMask;
+ getMasks( aEditMask, aLiteralMask );
+ if ( nPropType == BASEPROPERTY_EDITMASK )
+ aProp <<= aEditMask;
+ else
+ aProp <<= aLiteralMask;
+ }
+ break;
+ default:
+ {
+ aProp <<= VCLXFormattedSpinField::getProperty( PropertyName );
+ }
+ }
+ }
+ return aProp;
+}
+
+// ----------------------------------------------------
+// class VCLXToolBox
+// ----------------------------------------------------
+VCLXToolBox::VCLXToolBox()
+{
+}
+
+VCLXToolBox::~VCLXToolBox()
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXToolBox::CreateAccessibleContext()
+{
+ return getAccessibleFactory().createAccessibleContext( this );
+}
+
diff --git a/toolkit/source/awt/xsimpleanimation.cxx b/toolkit/source/awt/xsimpleanimation.cxx
new file mode 100644
index 000000000000..c7ccbde118f4
--- /dev/null
+++ b/toolkit/source/awt/xsimpleanimation.cxx
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include "toolkit/awt/xsimpleanimation.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/throbberimpl.hxx"
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= XSimpleAnimation
+ //====================================================================
+ DBG_NAME( XSimpleAnimation )
+
+ //--------------------------------------------------------------------
+ XSimpleAnimation::XSimpleAnimation()
+ {
+ DBG_CTOR( XSimpleAnimation, NULL );
+ mbRepeat = sal_True;
+ mnStepTime = 100;
+ mpThrobber = new Throbber_Impl( this, mnStepTime, mbRepeat );
+ }
+
+ //--------------------------------------------------------------------
+ XSimpleAnimation::~XSimpleAnimation()
+ {
+ DBG_DTOR( XSimpleAnimation, NULL );
+ delete mpThrobber;
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2( XSimpleAnimation, VCLXWindow, XSimpleAnimation_Base )
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( XSimpleAnimation, VCLXWindow, XSimpleAnimation_Base )
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::start() throw ( uno::RuntimeException )
+ {
+ mpThrobber->start();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::stop() throw ( uno::RuntimeException )
+ {
+ mpThrobber->stop();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
+ throw ( uno::RuntimeException )
+ {
+ mpThrobber->setImageList( rImageList );
+ }
+
+ //--------------------------------------------------------------------
+ void XSimpleAnimation::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+ {
+ // TODO: XSimpleAnimation::ProcessWindowEvent
+ //::vos::OClearableGuard aGuard( GetMutex() );
+ //Reference< XSimpleAnimation > xKeepAlive( this );
+ //SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
+ //if ( !pSpinButton )
+ // return;
+
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::setProperty( const ::rtl::OUString& PropertyName, const uno::Any& Value )
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME: {
+ sal_Int32 nStepTime( 0 );
+ if ( Value >>= nStepTime )
+ {
+ mnStepTime = nStepTime;
+ mpThrobber->setStepTime( mnStepTime );
+ }
+
+ break;
+ }
+ case BASEPROPERTY_REPEAT: {
+ sal_Bool bRepeat( sal_True );
+ if ( Value >>= bRepeat )
+ {
+ mbRepeat = bRepeat;
+ mpThrobber->setRepeat( mbRepeat );
+ }
+ break;
+ }
+ default:
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any SAL_CALL XSimpleAnimation::getProperty( const ::rtl::OUString& PropertyName )
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ uno::Any aReturn;
+
+ if ( GetWindow() )
+ {
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME:
+ aReturn <<= mnStepTime;
+ break;
+ case BASEPROPERTY_REPEAT:
+ aReturn <<= mbRepeat;
+ break;
+ default:
+ aReturn = VCLXWindow::getProperty( PropertyName );
+ }
+ }
+ return aReturn;
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/awt/xthrobber.cxx b/toolkit/source/awt/xthrobber.cxx
new file mode 100644
index 000000000000..439fb49c1cbe
--- /dev/null
+++ b/toolkit/source/awt/xthrobber.cxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include "toolkit/awt/xthrobber.hxx"
+#include "toolkit/helper/property.hxx"
+#include <toolkit/helper/tkresmgr.hxx>
+#include <toolkit/helper/throbberimpl.hxx>
+
+#ifndef _TOOLKIT_AWT_XTHROBBER_HRC_
+#include "xthrobber.hrc"
+#endif
+#include <tools/debug.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/timer.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= XThrobber
+ //====================================================================
+ DBG_NAME( XThrobber )
+
+ //--------------------------------------------------------------------
+ XThrobber::XThrobber()
+ {
+ DBG_CTOR( XThrobber, NULL );
+
+ mpThrobber = new Throbber_Impl( this, 100, sal_True );
+
+ InitImageList();
+ }
+
+ //--------------------------------------------------------------------
+ XThrobber::~XThrobber()
+ {
+ DBG_DTOR( XThrobber, NULL );
+ delete mpThrobber;
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE2( XThrobber, VCLXWindow, XThrobber_Base )
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( XThrobber, VCLXWindow, XThrobber_Base )
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XThrobber::start() throw ( uno::RuntimeException )
+ {
+ mpThrobber->start();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XThrobber::stop() throw ( uno::RuntimeException )
+ {
+ mpThrobber->stop();
+ }
+
+ //--------------------------------------------------------------------
+ void XThrobber::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+ {
+ static bool bInit = false;
+ if ( !bInit )
+ {
+ // Images won't be shown if set too early
+ mpThrobber->initImage();
+ bInit = true;
+ }
+ // TODO: XSimpleAnimation::ProcessWindowEvent
+ //::vos::OClearableGuard aGuard( GetMutex() );
+ //Reference< XSimpleAnimation > xKeepAlive( this );
+ //SpinButton* pSpinButton = static_cast< SpinButton* >( GetWindow() );
+ //if ( !pSpinButton )
+ // return;
+
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XThrobber::setProperty( const ::rtl::OUString& PropertyName, const uno::Any& Value )
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( GetWindow() )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any SAL_CALL XThrobber::getProperty( const ::rtl::OUString& PropertyName )
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ uno::Any aReturn;
+
+ if ( GetWindow() )
+ {
+ aReturn = VCLXWindow::getProperty( PropertyName );
+ }
+ return aReturn;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XThrobber::InitImageList()
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ uno::Sequence< uno::Reference< graphic::XGraphic > > aImageList(12);
+ sal_uInt16 nIconIdStart = RID_TK_ICON_THROBBER_START;
+
+ if ( mpThrobber->isHCMode() )
+ nIconIdStart = RID_TK_HC_ICON_THROBBER_START;
+
+ for ( sal_uInt16 i=0; i<12; i++ )
+ {
+ Image aImage = TK_RES_IMAGE( nIconIdStart + i );
+ aImageList[i] = aImage.GetXGraphic();
+ }
+
+ mpThrobber->setImageList( aImageList );
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/awt/xthrobber.hrc b/toolkit/source/awt/xthrobber.hrc
new file mode 100644
index 000000000000..32c068ff8a85
--- /dev/null
+++ b/toolkit/source/awt/xthrobber.hrc
@@ -0,0 +1,39 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _TOOLKIT_AWT_XTHROBBER_HRC_
+#define _TOOLKIT_AWT_XTHROBBER_HRC_
+
+
+//------------------------------------------------------------------------------
+
+#define RID_TK_ICON_THROBBER_START 1000
+#define RID_TK_HC_ICON_THROBBER_START 1020
+
+// -----------------------------------------------------------------------------
+
+#endif // _TOOLKIT_AWT_XTHROBBER_HRC_
diff --git a/toolkit/source/awt/xthrobber.src b/toolkit/source/awt/xthrobber.src
new file mode 100644
index 000000000000..199b25015056
--- /dev/null
+++ b/toolkit/source/awt/xthrobber.src
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _TOOLKIT_AWT_XTHROBBER_HRC_
+#include <xthrobber.hrc>
+#endif
+
+#define STD_MASK_COLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; };
+
+Image RID_TK_ICON_THROBBER_START
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_01.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 1
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_02.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 2
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_03.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 3
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_04.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 4
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_05.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 5
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_06.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 6
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_07.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 7
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_08.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 8
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_09.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 9
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_10.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 10
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_11.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_ICON_THROBBER_START + 11
+{
+ ImageBitmap = Bitmap{ file = "spinner03-grey_12.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_01.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 1
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_02.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 2
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_03.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 3
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_04.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 4
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_05.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 5
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_06.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 6
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_07.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 7
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_08.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 8
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_09.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 9
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_10.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 10
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_11.png"; };
+ STD_MASK_COLOR
+};
+
+Image RID_TK_HC_ICON_THROBBER_START + 11
+{
+ ImageBitmap = Bitmap{ file = "spinner03-32-hc_12.png"; };
+ STD_MASK_COLOR
+};
+
diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx
new file mode 100644
index 000000000000..2611b2f37a91
--- /dev/null
+++ b/toolkit/source/controls/accessiblecontrolcontext.cxx
@@ -0,0 +1,380 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <toolkit/controls/accessiblecontrolcontext.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using ::comphelper::OContextEntryGuard;
+ 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;
+
+ //====================================================================
+ //= OAccessibleControlContext
+ //====================================================================
+ //--------------------------------------------------------------------
+ OAccessibleControlContext::OAccessibleControlContext()
+ :OAccessibleControlContext_Base( )
+ {
+ // nothing to do here, we have a late ctor
+ }
+
+ //--------------------------------------------------------------------
+ OAccessibleControlContext::~OAccessibleControlContext()
+ {
+ ensureDisposed();
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XINTERFACE3( OAccessibleControlContext, OAccessibleControlContext_Base, OAccessibleImplementationAccess, OAccessibleControlContext_IBase )
+ IMPLEMENT_FORWARD_XTYPEPROVIDER3( OAccessibleControlContext, OAccessibleControlContext_Base, OAccessibleImplementationAccess, OAccessibleControlContext_IBase )
+ // (order matters: the first is the class name, the second is the class doing the ref counting)
+
+ //--------------------------------------------------------------------
+ void OAccessibleControlContext::Init( const Reference< XAccessible >& _rxCreator ) SAL_THROW( ( Exception ) )
+ {
+ OContextEntryGuard aGuard( this );
+
+ // retrieve the model of the control
+ OSL_ENSURE( !m_xControlModel.is(), "OAccessibleControlContext::Init: already know a control model....!???" );
+
+ Reference< awt::XControl > xControl( _rxCreator, UNO_QUERY );
+ if ( xControl.is() )
+ m_xControlModel = m_xControlModel.query( xControl->getModel() );
+ OSL_ENSURE( m_xControlModel.is(), "OAccessibleControlContext::Init: invalid creator (no control, or control without model!" );
+ if ( !m_xControlModel.is() )
+ throw DisposedException(); // caught by the caller (the create method)
+
+ // start listening at the model
+ startModelListening();
+
+ // announce the XAccessible to our base class
+ OAccessibleControlContext_Base::lateInit( _rxCreator );
+ }
+
+ //--------------------------------------------------------------------
+ OAccessibleControlContext* OAccessibleControlContext::create( const Reference< XAccessible >& _rxCreator ) SAL_THROW( ( ) )
+ {
+ OAccessibleControlContext* pNew = NULL;
+ try
+ {
+ pNew = new OAccessibleControlContext;
+ pNew->Init( _rxCreator );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OAccessibleControlContext::create: caught an exception from the late ctor!" );
+ }
+ return pNew;
+ }
+
+ //--------------------------------------------------------------------
+ void OAccessibleControlContext::startModelListening( ) SAL_THROW( ( Exception ) )
+ {
+ Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY );
+ OSL_ENSURE( xModelComp.is(), "OAccessibleControlContext::startModelListening: invalid model!" );
+ if ( xModelComp.is() )
+ xModelComp->addEventListener( this );
+ }
+
+ //--------------------------------------------------------------------
+ void OAccessibleControlContext::stopModelListening( ) SAL_THROW( ( Exception ) )
+ {
+ Reference< XComponent > xModelComp( m_xControlModel, UNO_QUERY );
+ OSL_ENSURE( xModelComp.is(), "OAccessibleControlContext::stopModelListening: invalid model!" );
+ if ( xModelComp.is() )
+ xModelComp->removeEventListener( this );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL OAccessibleControlContext::getAccessibleChildCount( ) throw (RuntimeException)
+ {
+ // we do not have children
+ return 0;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleChild( sal_Int32 ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ // we do not have children
+ throw IndexOutOfBoundsException();
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleParent( ) throw (RuntimeException)
+ {
+ OContextEntryGuard aGuard( this );
+ OSL_ENSURE( implGetForeignControlledParent().is(), "OAccessibleControlContext::getAccessibleParent: somebody forgot to set a parent!" );
+ // this parent of us is foreign controlled - somebody has to set it using the OAccessibleImplementationAccess
+ // class, before integrating our instance into an AccessibleDocumentModel
+ return implGetForeignControlledParent();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int16 SAL_CALL OAccessibleControlContext::getAccessibleRole( ) throw (RuntimeException)
+ {
+ return AccessibleRole::SHAPE;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAccessibleControlContext::getAccessibleDescription( ) throw (RuntimeException)
+ {
+ OContextEntryGuard aGuard( this );
+ return getModelStringProperty( "HelpText" );
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL OAccessibleControlContext::getAccessibleName( ) throw (RuntimeException)
+ {
+ OContextEntryGuard aGuard( this );
+ return getModelStringProperty( "Name" );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleRelationSet > SAL_CALL OAccessibleControlContext::getAccessibleRelationSet( ) throw (RuntimeException)
+ {
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessibleStateSet > SAL_CALL OAccessibleControlContext::getAccessibleStateSet( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ // no OContextEntryGuard here, as we do not want to throw an exception in case we're not alive anymore
+
+ ::utl::AccessibleStateSetHelper* pStateSet = NULL;
+ if ( isAlive() )
+ {
+ // no own states, only the ones which are foreign controlled
+ pStateSet = new ::utl::AccessibleStateSetHelper( implGetForeignControlledStates() );
+ }
+ else
+ { // only the DEFUNC state if we're already disposed
+ pStateSet = new ::utl::AccessibleStateSetHelper;
+ pStateSet->AddState( AccessibleStateType::DEFUNC );
+ }
+ return pStateSet;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OAccessibleControlContext::disposing( const EventObject&
+ #if OSL_DEBUG_LEVEL > 0
+ _rSource
+ #endif
+ ) throw ( RuntimeException )
+ {
+ OSL_ENSURE( Reference< XPropertySet >( _rSource.Source, UNO_QUERY ).get() == m_xControlModel.get(),
+ "OAccessibleControlContext::disposing: where did this come from?" );
+
+ stopModelListening( );
+ m_xControlModel.clear();
+ m_xModelPropsInfo.clear();
+
+ OAccessibleControlContext_Base::disposing();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString OAccessibleControlContext::getModelStringProperty( const sal_Char* _pPropertyName )
+ {
+ ::rtl::OUString sReturn;
+ try
+ {
+ if ( !m_xModelPropsInfo.is() && m_xControlModel.is() )
+ m_xModelPropsInfo = m_xControlModel->getPropertySetInfo();
+
+ ::rtl::OUString sPropertyName( ::rtl::OUString::createFromAscii( _pPropertyName ) );
+ if ( m_xModelPropsInfo.is() && m_xModelPropsInfo->hasPropertyByName( sPropertyName ) )
+ m_xControlModel->getPropertyValue( sPropertyName ) >>= sReturn;
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "OAccessibleControlContext::getModelStringProperty: caught an exception!" );
+ }
+ return sReturn;
+ }
+
+ //--------------------------------------------------------------------
+ Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const
+ {
+ Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY );
+ Reference< awt::XWindow > xWindow;
+ if ( xControl.is() )
+ xWindow = xWindow.query( xControl->getPeer() );
+
+ Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : NULL;
+
+ if ( _pxUNOWindow )
+ *_pxUNOWindow = xWindow;
+ return pWindow;
+ }
+
+ //--------------------------------------------------------------------
+ awt::Rectangle SAL_CALL OAccessibleControlContext::implGetBounds( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // want to do some VCL stuff here ...
+ OContextEntryGuard aGuard( this );
+
+ OSL_ENSURE( sal_False, "OAccessibleControlContext::implGetBounds: performance issue: forced to calc the size myself!" );
+ // In design mode (and this is what this class is for), the surrounding shape (if any) should handle this call
+ // The problem is that in design mode, our size may not be correct (in the drawing layer, controls are
+ // positioned/sized for painting only), and that calculation of our position is expensive
+
+ // what we know (or can obtain from somewhere):
+ // * the PosSize of our peer, relative to it's parent window
+ // * the parent window which the PosSize is relative to
+ // * our foreign controlled accessible parent
+ // from this info, we can determine the the position of our peer relative to the foreign parent
+
+ // our control
+ Reference< awt::XWindow > xWindow;
+ Window* pVCLWindow = implGetWindow( &xWindow );
+
+ awt::Rectangle aBounds( 0, 0, 0, 0 );
+ if ( xWindow.is() )
+ {
+ // ugly, but .... though the XWindow has a getPosSize, it is impossible to determine the
+ // parent which this position/size is relative to. This means we must tunnel UNO and ask the
+ // implementation
+ Window* pVCLParent = pVCLWindow ? pVCLWindow->GetParent() : NULL;
+
+ // the relative location of the window
+ ::Point aWindowRelativePos( 0, 0);
+ if ( pVCLWindow )
+ aWindowRelativePos = pVCLWindow->GetPosPixel();
+
+ // the screnn position of the "window parent" of the control
+ ::Point aVCLParentScreenPos( 0, 0 );
+ if ( pVCLParent )
+ aVCLParentScreenPos = pVCLParent->GetPosPixel();
+
+ // the screen position of the "accessible parent" of the control
+ Reference< XAccessible > xParentAcc( implGetForeignControlledParent() );
+ Reference< XAccessibleComponent > xParentAccComponent;
+ if ( xParentAcc.is() )
+ xParentAccComponent = xParentAccComponent.query( xParentAcc->getAccessibleContext() );
+ awt::Point aAccParentScreenPos( 0, 0 );
+ if ( xParentAccComponent.is() )
+ aAccParentScreenPos = xParentAccComponent->getLocationOnScreen();
+
+ // now the size of the control
+ aBounds = xWindow->getPosSize();
+
+ // correct the pos
+ aBounds.X = aWindowRelativePos.X() + aVCLParentScreenPos.X() - aAccParentScreenPos.X;
+ aBounds.Y = aWindowRelativePos.Y() + aVCLParentScreenPos.Y() - aAccParentScreenPos.Y;
+ }
+
+ return aBounds;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XAccessible > SAL_CALL OAccessibleControlContext::getAccessibleAtPoint( const awt::Point& /* _rPoint */ ) throw (RuntimeException)
+ {
+ // no children at all
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OAccessibleControlContext::grabFocus( ) throw (RuntimeException)
+ {
+ OSL_ENSURE( sal_False, "OAccessibleControlContext::grabFocus: !isFocusTraversable, but grabFocus!" );
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL OAccessibleControlContext::getAccessibleKeyBinding( ) throw (RuntimeException)
+ {
+ // we do not have any key bindings to activate a UNO control in design mode
+ return Any();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL OAccessibleControlContext::getForeground( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // want to do some VCL stuff here ...
+ OContextEntryGuard aGuard( this );
+
+ Window* pWindow = implGetWindow( );
+ sal_Int32 nColor = 0;
+ if ( pWindow )
+ {
+ if ( pWindow->IsControlForeground() )
+ nColor = pWindow->GetControlForeground().GetColor();
+ else
+ {
+ Font aFont;
+ if ( pWindow->IsControlFont() )
+ aFont = pWindow->GetControlFont();
+ else
+ aFont = pWindow->GetFont();
+ nColor = aFont.GetColor().GetColor();
+ }
+ }
+ return nColor;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL OAccessibleControlContext::getBackground( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // want to do some VCL stuff here ...
+ OContextEntryGuard aGuard( this );
+
+ Window* pWindow = implGetWindow( );
+ sal_Int32 nColor = 0;
+ if ( pWindow )
+ {
+ if ( pWindow->IsControlBackground() )
+ nColor = pWindow->GetControlBackground().GetColor();
+ else
+ nColor = pWindow->GetBackground().GetColor().GetColor();
+ }
+
+ return nColor;
+ }
+
+//........................................................................
+} //namespace toolkit
+//........................................................................
+
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
new file mode 100644
index 000000000000..db9634fb44a1
--- /dev/null
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -0,0 +1,2104 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wall.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/controls/dialogcontrol.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <toolkit/controls/unocontrols.hxx>
+#include "toolkit/controls/formattedcontrol.hxx"
+#include "toolkit/controls/roadmapcontrol.hxx"
+#ifndef TOOLKIT_INC_TOOLKIT_CONTROLS_TKSCROLLBAR_HXX
+#include "toolkit/controls/tkscrollbar.hxx"
+#endif
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <tools/list.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <comphelper/processfactory.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+#include <comphelper/types.hxx>
+
+#include <comphelper/componentcontext.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.hxx>
+
+#include "tree/treecontrol.hxx"
+#include "grid/gridcontrol.hxx"
+
+#include <map>
+#include <algorithm>
+#include <functional>
+#include "tools/urlobj.hxx"
+#include "osl/file.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::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::util;
+using namespace toolkit;
+
+#define PROPERTY_RESOURCERESOLVER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ))
+#define PROPERTY_DIALOGSOURCEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DialogSourceURL" ))
+#define PROPERTY_IMAGEURL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImageURL" ))
+#define PROPERTY_GRAPHIC ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Graphic" ))
+
+//HELPER
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
+
+struct LanguageDependentProp
+{
+ const char* pPropName;
+ sal_Int32 nPropNameLength;
+};
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ static const Sequence< ::rtl::OUString >& lcl_getLanguageDependentProperties()
+ {
+ static Sequence< ::rtl::OUString > s_aLanguageDependentProperties;
+ if ( s_aLanguageDependentProperties.getLength() == 0 )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( s_aLanguageDependentProperties.getLength() == 0 )
+ {
+ s_aLanguageDependentProperties.realloc( 2 );
+ s_aLanguageDependentProperties[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpText" ) );
+ s_aLanguageDependentProperties[1] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) );
+ // note: properties must be sorted
+ }
+ }
+ return s_aLanguageDependentProperties;
+ }
+
+ static uno::Reference< graphic::XGraphic > lcl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
+ {
+ uno::Reference< graphic::XGraphic > xGraphic;
+ if ( !_rURL.getLength() )
+ return xGraphic;
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< graphic::XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ uno::Sequence< beans::PropertyValue > aMediaProperties(1);
+ aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aMediaProperties[0].Value <<= _rURL;
+ xGraphic = xProvider->queryGraphic( aMediaProperties );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xGraphic;
+ }
+
+}
+
+// ----------------------------------------------------------------------------
+// functor for disposing a control model
+struct DisposeControlModel : public ::std::unary_function< Reference< XControlModel >, void >
+{
+ void operator()( Reference< XControlModel >& _rxModel )
+ {
+ try
+ {
+ ::comphelper::disposeComponent( _rxModel );
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "DisposeControlModel::(): caught an exception while disposing a component!" );
+ }
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for searching control model by name
+struct FindControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
+{
+private:
+ const ::rtl::OUString& m_rName;
+
+public:
+ FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
+
+ bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
+ {
+ return ( _rCompare.second == m_rName ) ? true : false;
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for cloning a control model, and insertion into a target list
+struct CloneControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, void >
+{
+private:
+ UnoControlDialogModel::UnoControlModelHolderList& m_rTargetList;
+
+public:
+ CloneControlModel( UnoControlDialogModel::UnoControlModelHolderList& _rTargetList )
+ :m_rTargetList( _rTargetList )
+ {
+ }
+
+ void operator()( const UnoControlDialogModel::UnoControlModelHolder& _rSource )
+ {
+ // clone the source object
+ Reference< XCloneable > xCloneSource( _rSource.first, UNO_QUERY );
+ Reference< XControlModel > xClone( xCloneSource->createClone(), UNO_QUERY );
+ // add to target list
+ m_rTargetList.push_back( UnoControlDialogModel::UnoControlModelHolder( xClone, _rSource.second ) );
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for comparing a XControlModel with a given reference
+struct CompareControlModel : public ::std::unary_function< UnoControlDialogModel::UnoControlModelHolder, bool >
+{
+private:
+ Reference< XControlModel > m_xReference;
+public:
+ CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
+
+ bool operator()( const UnoControlDialogModel::UnoControlModelHolder& _rCompare )
+ {
+ return ( _rCompare.first.get() == m_xReference.get() ) ? true : false;
+ }
+};
+
+// ----------------------------------------------------------------------------
+static void lcl_throwIllegalArgumentException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw IllegalArgumentException();
+}
+
+// ----------------------------------------------------------------------------
+static void lcl_throwNoSuchElementException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw NoSuchElementException();
+}
+
+// ----------------------------------------------------------------------------
+static void lcl_throwElementExistException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw ElementExistException();
+}
+
+// ----------------------------------------------------------------------------
+static const ::rtl::OUString& getTabIndexPropertyName( )
+{
+ static const ::rtl::OUString s_sTabIndexProperty( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
+ return s_sTabIndexProperty;
+}
+
+// ----------------------------------------------------------------------------
+static const ::rtl::OUString& getStepPropertyName( )
+{
+ static const ::rtl::OUString s_sStepProperty( RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
+ return s_sStepProperty;
+}
+
+// ----------------------------------------------------
+// class UnoControlDialogModel
+// ----------------------------------------------------
+UnoControlDialogModel::UnoControlDialogModel()
+ :maContainerListeners( *this )
+ ,maChangeListeners ( GetMutex() )
+ ,mbGroupsUpToDate( sal_False )
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+// ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+// ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_TITLE );
+ ImplRegisterProperty( BASEPROPERTY_SIZEABLE );
+ ImplRegisterProperty( BASEPROPERTY_DESKTOP_AS_PARENT );
+ ImplRegisterProperty( BASEPROPERTY_DECORATION );
+ ImplRegisterProperty( BASEPROPERTY_DIALOGSOURCEURL );
+ ImplRegisterProperty( BASEPROPERTY_GRAPHIC );
+ ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+
+ Any aBool;
+ aBool <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_MOVEABLE, aBool );
+ ImplRegisterProperty( BASEPROPERTY_CLOSEABLE, aBool );
+}
+
+UnoControlDialogModel::UnoControlDialogModel( const UnoControlDialogModel& rModel )
+ : UnoControlDialogModel_IBase( rModel )
+ , UnoControlDialogModel_Base( rModel )
+ , maContainerListeners( *this )
+ , maChangeListeners ( GetMutex() )
+ , mbGroupsUpToDate( sal_False )
+{
+}
+
+UnoControlDialogModel::~UnoControlDialogModel()
+{
+ maModels.clear();
+ mbGroupsUpToDate = sal_False;
+}
+
+Any UnoControlDialogModel::queryAggregation( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet( UnoControlDialogModel_IBase::queryInterface( rType ) );
+ return (aRet.hasValue() ? aRet : UnoControlDialogModel_Base::queryAggregation( rType ));
+}
+
+// XTypeProvider
+IMPL_IMPLEMENTATION_ID( UnoControlDialogModel )
+Sequence< Type > UnoControlDialogModel::getTypes() throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ UnoControlDialogModel_IBase::getTypes(),
+ UnoControlDialogModel_Base::getTypes()
+ );
+}
+
+::rtl::OUString UnoControlDialogModel::getServiceName( ) throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialogModel );
+}
+
+Any UnoControlDialogModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ Any aAny;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDialog );
+ break;
+ default:
+ aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+ return aAny;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlDialogModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+void SAL_CALL UnoControlDialogModel::dispose( ) throw(RuntimeException)
+{
+ // ====================================================================
+ // tell our listeners
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = static_cast< XAggregation* >( static_cast< ::cppu::OWeakAggObject* >( this ) );
+
+ maContainerListeners.disposeAndClear( aDisposeEvent );
+ maChangeListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ // ====================================================================
+ // call the base class
+ UnoControlModel::dispose();
+
+ // ====================================================================
+ // dispose our child models
+ // for this, collect the models (we collect them from maModels, and this is modified when disposing children)
+ ::std::vector< Reference< XControlModel > > aChildModels( maModels.size() );
+
+ ::std::transform(
+ maModels.begin(), maModels.end(), // source range
+ aChildModels.begin(), // target location
+ ::std::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part
+ );
+
+ // now dispose
+ ::std::for_each( aChildModels.begin(), aChildModels.end(), DisposeControlModel() );
+ aChildModels.clear();
+
+ mbGroupsUpToDate = sal_False;
+}
+
+// XMultiPropertySet
+Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+UnoControlModel* UnoControlDialogModel::Clone() const
+{
+ // clone the container itself
+ UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
+
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( pClone->maModels )
+ );
+
+ return pClone;
+}
+
+UnoControlDialogModel::UnoControlModelHolderList::iterator UnoControlDialogModel::ImplFindElement( const ::rtl::OUString& rName )
+{
+ return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
+}
+
+// ::XMultiServiceFactory
+Reference< XInterface > UnoControlDialogModel::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ OGeometryControlModel_Base* pNewModel = NULL;
+
+ if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlEditModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFileControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlImageControlModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlListBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoTreeModel >;
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoGridModel >;
+
+ if ( !pNewModel )
+ {
+ Reference< XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() );
+ if ( xORB.is() )
+ {
+ Reference< XInterface > xObject = xORB->createInstance( aServiceSpecifier );
+ Reference< XServiceInfo > xSI( xObject, UNO_QUERY );
+ Reference< XCloneable > xCloneAccess( xSI, UNO_QUERY );
+ Reference< XAggregation > xAgg( xCloneAccess, UNO_QUERY );
+ if ( xAgg.is() )
+ {
+ if ( xSI->supportsService( ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" ) ) )
+ {
+ // release 3 of the 4 references we have to the object
+ xAgg.clear();
+ xSI.clear();
+ xObject.clear();
+
+ pNewModel = new OCommonGeometryControlModel( xCloneAccess, aServiceSpecifier );
+ }
+ }
+ }
+ }
+
+ Reference< XInterface > xNewModel = (::cppu::OWeakObject*)pNewModel;
+ return xNewModel;
+}
+
+Reference< XInterface > UnoControlDialogModel::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
+{
+ return createInstance( ServiceSpecifier );
+}
+
+Sequence< ::rtl::OUString > UnoControlDialogModel::getAvailableServiceNames() throw(RuntimeException)
+{
+ static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
+ if ( !pNamesSeq )
+ {
+ pNamesSeq = new Sequence< ::rtl::OUString >( 21 );
+ ::rtl::OUString* pNames = pNamesSeq->getArray();
+ pNames[0] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlEditModel );
+ pNames[1] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFormattedFieldModel );
+ pNames[2] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFileControlModel );
+ pNames[3] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlButtonModel );
+ pNames[4] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlImageControlModel );
+ pNames[5] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel );
+ pNames[6] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCheckBoxModel );
+ pNames[7] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedTextModel );
+ pNames[8] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlGroupBoxModel );
+ pNames[9] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlListBoxModel );
+ pNames[10] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlComboBoxModel );
+ pNames[11] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlDateFieldModel );
+ pNames[12] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlTimeFieldModel );
+ pNames[13] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlNumericFieldModel );
+ pNames[14] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlCurrencyFieldModel );
+ pNames[15] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlPatternFieldModel );
+ pNames[16] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlProgressBarModel );
+ pNames[17] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlScrollBarModel );
+ pNames[18] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlFixedLineModel );
+ pNames[19] = ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRoadmapModel );
+ pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_TreeControlModel );
+ pNames[20] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
+
+ }
+ return *pNamesSeq;
+}
+
+// XContainer
+void UnoControlDialogModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void UnoControlDialogModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// XElementAcces
+Type UnoControlDialogModel::getElementType() throw(RuntimeException)
+{
+ Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
+ return aType;
+}
+
+sal_Bool UnoControlDialogModel::hasElements() throw(RuntimeException)
+{
+ return !maModels.empty();
+}
+
+// XNameContainer, XNameReplace, XNameAccess
+void UnoControlDialogModel::replaceByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xNewModel;
+ aElement >>= xNewModel;
+ if ( !xNewModel.is() )
+ lcl_throwIllegalArgumentException();
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ // stop listening at the old model
+ stopControlListening( aElementPos->first );
+ Reference< XControlModel > xReplaced( aElementPos->first );
+ // remember the new model, and start listening
+ aElementPos->first = xNewModel;
+ startControlListening( xNewModel );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element = aElement;
+ aEvent.ReplacedElement <<= xReplaced;
+ aEvent.Accessor <<= aName;
+
+ // notify the container listener
+ maContainerListeners.elementReplaced( aEvent );
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+Any UnoControlDialogModel::getByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ return makeAny( aElementPos->first );
+}
+
+Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(RuntimeException)
+{
+ Sequence< ::rtl::OUString > aNames( maModels.size() );
+
+ ::std::transform(
+ maModels.begin(), maModels.end(), // source range
+ aNames.getArray(), // target range
+ ::std::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name)
+ );
+
+ return aNames;
+}
+
+sal_Bool UnoControlDialogModel::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
+{
+ return maModels.end() != ImplFindElement( aName );
+}
+
+void UnoControlDialogModel::insertByName( const ::rtl::OUString& aName, const Any& aElement ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xM;
+ aElement >>= xM;
+
+ if ( xM.is() )
+ {
+ Reference< beans::XPropertySet > xProps( xM, UNO_QUERY );
+ if ( xProps.is() )
+ {
+
+ Reference< beans::XPropertySetInfo > xPropInfo = xProps.get()->getPropertySetInfo();
+
+ ::rtl::OUString sImageSourceProperty = GetPropertyName( BASEPROPERTY_IMAGEURL );
+ if ( xPropInfo.get()->hasPropertyByName( sImageSourceProperty ))
+ {
+ Any aUrl = xProps.get()->getPropertyValue( sImageSourceProperty );
+
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( getPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL ) ), aUrl );
+
+ aUrl <<= absoluteUrl;
+
+ xProps.get()->setPropertyValue( sImageSourceProperty , aUrl );
+ }
+ }
+ }
+
+
+
+ if ( !aName.getLength() || !xM.is() )
+ lcl_throwIllegalArgumentException();
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() != aElementPos )
+ lcl_throwElementExistException();
+
+ maModels.push_back( UnoControlModelHolder( xM, aName ) );
+ mbGroupsUpToDate = sal_False;
+ startControlListening( xM );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementInserted( aEvent );
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+void UnoControlDialogModel::removeByName( const ::rtl::OUString& aName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ UnoControlModelHolderList::iterator aElementPos = ImplFindElement( aName );
+ if ( maModels.end() == aElementPos )
+ lcl_throwNoSuchElementException();
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElementPos->first;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementRemoved( aEvent );
+
+ stopControlListening( aElementPos->first );
+ Reference< XPropertySet > xPS( aElementPos->first, UNO_QUERY );
+ maModels.erase( aElementPos );
+ mbGroupsUpToDate = sal_False;
+
+ if ( xPS.is() )
+ try
+ {
+ xPS->setPropertyValue( PROPERTY_RESOURCERESOLVER, makeAny( Reference< resource::XStringResourceResolver >() ) );
+ }
+ catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION(); }
+
+ // our "tab controller model" has potentially changed -> notify this
+ implNotifyTabModelChange( aName );
+}
+
+// ----------------------------------------------------------------------------
+sal_Bool SAL_CALL UnoControlDialogModel::getGroupControl( ) throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::setGroupControl( sal_Bool ) throw (RuntimeException)
+{
+ DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::setControlModels( const Sequence< Reference< XControlModel > >& _rControls ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ // set the tab indexes according to the order of models in the sequence
+ const Reference< XControlModel >* pControls = _rControls.getConstArray( );
+ const Reference< XControlModel >* pControlsEnd = _rControls.getConstArray( ) + _rControls.getLength();
+
+ sal_Int16 nTabIndex = 1;
+
+ for ( ; pControls != pControlsEnd; ++pControls )
+ {
+ // look up the control in our own structure. This is to prevent invalid arguments
+ UnoControlModelHolderList::const_iterator aPos =
+ ::std::find_if(
+ maModels.begin(), maModels.end(),
+ CompareControlModel( *pControls )
+ );
+ if ( maModels.end() != aPos )
+ {
+ // okay, this is an existent model
+ // now set the TabIndex property (if applicable)
+ Reference< XPropertySet > xProps( aPos->first, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xProps.is() )
+ xPSI = xProps->getPropertySetInfo();
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xProps->setPropertyValue( getTabIndexPropertyName(), makeAny( nTabIndex++ ) );
+ }
+ mbGroupsUpToDate = sal_False;
+ }
+}
+
+
+typedef ::std::multimap< sal_Int32, Reference< XControlModel >, ::std::less< sal_Int32 > > MapIndexToModel;
+
+// ----------------------------------------------------------------------------
+Sequence< Reference< XControlModel > > SAL_CALL UnoControlDialogModel::getControlModels( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ MapIndexToModel aSortedModels;
+ // will be the sorted container of all models which have a tab index property
+ ::std::vector< Reference< XControlModel > > aUnindexedModels;
+ // will be the container of all models which do not have a tab index property
+
+ UnoControlModelHolderList::const_iterator aLoop = maModels.begin();
+ for ( ; aLoop != maModels.end(); ++aLoop )
+ {
+ Reference< XControlModel > xModel( aLoop->first );
+
+ // see if the model has a TabIndex property
+ Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xControlProps.is() )
+ xPSI = xControlProps->getPropertySetInfo( );
+ DBG_ASSERT( xPSI.is(), "UnoControlDialogModel::getControlModels: invalid child model!" );
+
+ // has it?
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ { // yes
+ sal_Int32 nTabIndex = -1;
+ xControlProps->getPropertyValue( getTabIndexPropertyName() ) >>= nTabIndex;
+
+ aSortedModels.insert( MapIndexToModel::value_type( nTabIndex, xModel ) );
+ }
+ else if ( xModel.is() )
+ // no, it hasn't, but we have to include it, anyway
+ aUnindexedModels.push_back( xModel );
+ }
+
+ // okay, here we have a container of all our models, sorted by tab index,
+ // plus a container of "unindexed" models
+ // -> merge them
+ Sequence< Reference< XControlModel > > aReturn( aUnindexedModels.size() + aSortedModels.size() );
+ ::std::transform(
+ aSortedModels.begin(), aSortedModels.end(),
+ ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
+ ::std::select2nd< MapIndexToModel::value_type >( )
+ );
+
+ return aReturn;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::setGroup( const Sequence< Reference< XControlModel > >&, const ::rtl::OUString& ) throw (RuntimeException)
+{
+ // not supported. We have only implicit grouping:
+ // We only have a sequence of control models, and we _know_ (yes, that's a HACK relying on
+ // implementation details) that VCL does grouping according to the order of controls automatically
+ // At least VCL does this for all we're interested in: Radio buttons.
+ DBG_ERROR( "UnoControlDialogModel::setGroup: grouping not supported" );
+}
+
+// ----------------------------------------------------------------------------
+namespace
+{
+ enum GroupingMachineState
+ {
+ eLookingForGroup,
+ eExpandingGroup
+ };
+
+ // ........................................................................
+ static sal_Int32 lcl_getDialogStep( const Reference< XControlModel >& _rxModel )
+ {
+ sal_Int32 nStep = 0;
+ try
+ {
+ Reference< XPropertySet > xModelProps( _rxModel, UNO_QUERY );
+ xModelProps->getPropertyValue( getStepPropertyName() ) >>= nStep;
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "lcl_getDialogStep: caught an exception while determining the dialog page!" );
+ }
+ return nStep;
+ }
+}
+
+// ----------------------------------------------------------------------------
+sal_Int32 SAL_CALL UnoControlDialogModel::getGroupCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ implUpdateGroupStructure();
+
+ return maGroups.size();
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::getGroup( sal_Int32 _nGroup, Sequence< Reference< XControlModel > >& _rGroup, ::rtl::OUString& _rName ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ implUpdateGroupStructure();
+
+ if ( ( _nGroup < 0 ) || ( _nGroup >= (sal_Int32)maGroups.size() ) )
+ {
+ DBG_ERROR( "UnoControlDialogModel::getGroup: invalid argument and I am not allowed to throw an exception!" );
+ _rGroup.realloc( 0 );
+ _rName = ::rtl::OUString();
+ }
+ else
+ {
+ AllGroups::const_iterator aGroupPos = maGroups.begin() + _nGroup;
+ _rGroup.realloc( aGroupPos->size() );
+ // copy the models
+ ::std::copy( aGroupPos->begin(), aGroupPos->end(), _rGroup.getArray() );
+ // give the group a name
+ _rName = ::rtl::OUString::valueOf( _nGroup );
+ }
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::getGroupByName( const ::rtl::OUString& _rName, Sequence< Reference< XControlModel > >& _rGroup ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ ::rtl::OUString sDummyName;
+ getGroup( _rName.toInt32( ), _rGroup, sDummyName );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.addInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.removeInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void UnoControlDialogModel::implNotifyTabModelChange( const ::rtl::OUString& _rAccessor )
+{
+ // multiplex to our change listeners:
+ // the changes event
+ ChangesEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Base <<= aEvent.Source; // the "base of the changes root" is also ourself
+ aEvent.Changes.realloc( 1 ); // exactly one change
+ aEvent.Changes[ 0 ].Accessor <<= _rAccessor;
+
+
+ Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() );
+ const Reference< XInterface >* pListener = aChangeListeners.getConstArray();
+ const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength();
+ for ( ; pListener != pListenerEnd; ++pListener )
+ {
+ if ( pListener->is() )
+ static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent );
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+void UnoControlDialogModel::implUpdateGroupStructure()
+{
+ if ( mbGroupsUpToDate )
+ // nothing to do
+ return;
+
+ // conditions for a group:
+ // * all elements of the group are radio buttons
+ // * all elements of the group are on the same dialog page
+ // * in the overall control order (determined by the tab index), all elements are subsequent
+
+ maGroups.clear();
+
+ Sequence< Reference< XControlModel > > aControlModels = getControlModels();
+ const Reference< XControlModel >* pControlModels = aControlModels.getConstArray();
+ const Reference< XControlModel >* pControlModelsEnd = pControlModels + aControlModels.getLength();
+
+ // in extreme we have as much groups as controls
+ maGroups.reserve( aControlModels.getLength() );
+
+ GroupingMachineState eState = eLookingForGroup; // the current state of our machine
+ Reference< XServiceInfo > xModelSI; // for checking for a radion button
+ AllGroups::iterator aCurrentGroup = maGroups.end(); // the group which we're currently building
+ sal_Int32 nCurrentGroupStep = -1; // the step which all controls of the current group belong to
+ sal_Bool bIsRadioButton; // is it a radio button?
+
+#if OSL_DEBUG_LEVEL > 1
+ ::std::vector< ::rtl::OUString > aCurrentGroupLabels;
+#endif
+
+ for ( ; pControlModels != pControlModelsEnd; ++pControlModels )
+ {
+ // we'll need this in every state
+ xModelSI = xModelSI.query( *pControlModels );
+ bIsRadioButton = xModelSI.is() && xModelSI->supportsService( ::rtl::OUString::createFromAscii( szServiceName2_UnoControlRadioButtonModel ) );
+
+ switch ( eState )
+ {
+ case eLookingForGroup:
+ {
+ if ( !bIsRadioButton )
+ // this is no radio button -> still looking for the beginning of a group
+ continue;
+ // the current model is a radio button
+ // -> we found the beginning of a new group
+ // create the place for this group
+ size_t nGroups = maGroups.size();
+ maGroups.resize( nGroups + 1 );
+ aCurrentGroup = maGroups.begin() + nGroups;
+ // and add the (only, til now) member
+ aCurrentGroup->push_back( *pControlModels );
+
+ // get the step which all controls of this group now have to belong to
+ nCurrentGroupStep = lcl_getDialogStep( *pControlModels );
+ // new state: looking for further members
+ eState = eExpandingGroup;
+
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+
+ case eExpandingGroup:
+ {
+ if ( !bIsRadioButton )
+ { // no radio button -> the group is done
+ aCurrentGroup = maGroups.end();
+ eState = eLookingForGroup;
+#if OSL_DEBUG_LEVEL > 1
+ aCurrentGroupLabels.clear();
+#endif
+ continue;
+ }
+
+ // it is a radio button - is it on the proper page?
+ const sal_Int32 nThisModelStep = lcl_getDialogStep( *pControlModels );
+ if ( ( nThisModelStep == nCurrentGroupStep ) // the current button is on the same dialog page
+ || ( 0 == nThisModelStep ) // the current button appears on all pages
+ )
+ {
+ // -> it belongs to the same group
+ aCurrentGroup->push_back( *pControlModels );
+ // state still is eExpandingGroup - we're looking for further elements
+ eState = eExpandingGroup;
+
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ continue;
+ }
+
+ // it's a radio button, but on a different page
+ // -> we open a new group for it
+
+ // close the old group
+ aCurrentGroup = maGroups.end();
+#if OSL_DEBUG_LEVEL > 1
+ aCurrentGroupLabels.clear();
+#endif
+
+ // open a new group
+ size_t nGroups = maGroups.size();
+ maGroups.resize( nGroups + 1 );
+ aCurrentGroup = maGroups.begin() + nGroups;
+ // and add the (only, til now) member
+ aCurrentGroup->push_back( *pControlModels );
+
+ nCurrentGroupStep = nThisModelStep;
+
+ // state is the same: we still are looking for further elements of the current group
+ eState = eExpandingGroup;
+#if OSL_DEBUG_LEVEL > 1
+ Reference< XPropertySet > xModelProps( *pControlModels, UNO_QUERY );
+ ::rtl::OUString sLabel;
+ if ( xModelProps.is() && xModelProps->getPropertySetInfo().is() && xModelProps->getPropertySetInfo()->hasPropertyByName( ::rtl::OUString::createFromAscii( "Label" ) ) )
+ xModelProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Label" ) ) >>= sLabel;
+ aCurrentGroupLabels.push_back( sLabel );
+#endif
+ }
+ break;
+ }
+ }
+
+ mbGroupsUpToDate = sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::propertyChange( const PropertyChangeEvent& _rEvent ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ DBG_ASSERT( 0 == _rEvent.PropertyName.compareToAscii( "TabIndex" ),
+ "UnoControlDialogModel::propertyChange: not listening for this property!" );
+
+ // the accessor for the changed element
+ ::rtl::OUString sAccessor;
+ UnoControlModelHolderList::const_iterator aPos =
+ ::std::find_if(
+ maModels.begin(), maModels.end(),
+ CompareControlModel( Reference< XControlModel >( _rEvent.Source, UNO_QUERY ) )
+ );
+ OSL_ENSURE( maModels.end() != aPos, "UnoControlDialogModel::propertyChange: don't know this model!" );
+ if ( maModels.end() != aPos )
+ sAccessor = aPos->second;
+
+ // our groups are not up-to-date
+ mbGroupsUpToDate = sal_False;
+
+ // notify
+ implNotifyTabModelChange( sAccessor );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL UnoControlDialogModel::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------------------------
+void UnoControlDialogModel::startControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xModelProps.is() )
+ xPSI = xModelProps->getPropertySetInfo();
+
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xModelProps->addPropertyChangeListener( getTabIndexPropertyName(), this );
+}
+
+// ----------------------------------------------------------------------------
+void UnoControlDialogModel::stopControlListening( const Reference< XControlModel >& _rxChildModel )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XPropertySet > xModelProps( _rxChildModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI;
+ if ( xModelProps.is() )
+ xPSI = xModelProps->getPropertySetInfo();
+
+ if ( xPSI.is() && xPSI->hasPropertyByName( getTabIndexPropertyName() ) )
+ xModelProps->removePropertyChangeListener( getTabIndexPropertyName(), this );
+}
+
+// ============================================================================
+// = class ResourceListener
+// ============================================================================
+
+ResourceListener::ResourceListener(
+ const Reference< util::XModifyListener >& rListener ) :
+ OWeakObject(),
+ m_xListener( rListener ),
+ m_bListening( false )
+{
+}
+
+ResourceListener::~ResourceListener()
+{
+}
+
+// XInterface
+Any SAL_CALL ResourceListener::queryInterface( const Type& rType )
+throw ( RuntimeException )
+{
+ Any a = ::cppu::queryInterface(
+ rType ,
+ static_cast< XModifyListener* >( this ),
+ static_cast< XEventListener* >( this ));
+
+ if ( a.hasValue() )
+ return a;
+
+ return OWeakObject::queryInterface( rType );
+}
+
+void SAL_CALL ResourceListener::acquire() throw ()
+{
+ OWeakObject::acquire();
+}
+
+void SAL_CALL ResourceListener::release() throw ()
+{
+ OWeakObject::release();
+}
+
+void ResourceListener::startListening(
+ const Reference< resource::XStringResourceResolver >& rResource )
+{
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY );
+
+ {
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ bool bListening( m_bListening );
+ bool bResourceSet( m_xResource.is() );
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( bListening && bResourceSet )
+ stopListening();
+
+ // --- SAFE ---
+ aGuard.reset();
+ m_xResource = rResource;
+ aGuard.clear();
+ // --- SAFE ---
+ }
+
+ Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ xModifyBroadcaster->addModifyListener( xThis );
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ m_bListening = true;
+ // --- SAFE ---
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+void ResourceListener::stopListening()
+{
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ if ( m_bListening && m_xResource.is() )
+ xModifyBroadcaster = Reference< util::XModifyBroadcaster >( m_xResource, UNO_QUERY );
+ aGuard.clear();
+ // --- SAFE ---
+
+ Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ m_xResource.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ xModifyBroadcaster->removeModifyListener( xThis );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+// XModifyListener
+void SAL_CALL ResourceListener::modified(
+ const lang::EventObject& aEvent )
+throw ( RuntimeException )
+{
+ Reference< util::XModifyListener > xListener;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ xListener = m_xListener;
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ {
+ try
+ {
+ xListener->modified( aEvent );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+}
+
+// XEventListener
+void SAL_CALL ResourceListener::disposing(
+ const EventObject& Source )
+throw ( RuntimeException )
+{
+ Reference< lang::XEventListener > xListener;
+ Reference< resource::XStringResourceResolver > xResource;
+
+ // --- SAFE ---
+ ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex );
+ Reference< XInterface > xIfacRes( m_xResource, UNO_QUERY );
+ Reference< XInterface > xIfacList( m_xListener, UNO_QUERY );
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( Source.Source == xIfacRes )
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ xResource = m_xResource;
+ xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
+ m_xResource.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ {
+ try
+ {
+ xListener->disposing( Source );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+ }
+ else if ( Source.Source == xIfacList )
+ {
+ // --- SAFE ---
+ aGuard.reset();
+ m_bListening = false;
+ xListener = Reference< lang::XEventListener >( m_xListener, UNO_QUERY );
+ xResource = m_xResource;
+ m_xResource.clear();
+ m_xListener.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ // Remove ourself as listener from resource resolver
+ Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY );
+ Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ if ( xModifyBroadcaster.is() )
+ {
+ try
+ {
+ xModifyBroadcaster->removeModifyListener( xThis );
+ }
+ catch ( RuntimeException& )
+ {
+ throw;
+ }
+ catch ( Exception& )
+ {
+ }
+ }
+ }
+}
+
+// ============================================================================
+// = class UnoDialogControl
+// ============================================================================
+
+UnoDialogControl::UnoDialogControl() :
+ maTopWindowListeners( *this ),
+ mbWindowListener(false),
+ mbSizeModified(false),
+ mbPosModified(false)
+{
+ maComponentInfos.nWidth = 300;
+ maComponentInfos.nHeight = 450;
+ mxListener = new ResourceListener( Reference< util::XModifyListener >(
+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
+}
+
+::rtl::OUString UnoDialogControl::GetComponentServiceName()
+{
+
+ sal_Bool bDecoration( sal_True );
+ ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
+ if ( bDecoration )
+ return ::rtl::OUString::createFromAscii( "Dialog" );
+ else
+ return ::rtl::OUString::createFromAscii( "TabPage" );
+}
+
+// XInterface
+Any UnoDialogControl::queryAggregation( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet( UnoDialogControl_IBase::queryInterface( rType ) );
+ return (aRet.hasValue() ? aRet : UnoControlContainer::queryAggregation( rType ));
+}
+
+// XTypeProvider
+IMPL_IMPLEMENTATION_ID( UnoDialogControl )
+Sequence< Type > UnoDialogControl::getTypes() throw(RuntimeException)
+{
+ return ::comphelper::concatSequences(
+ UnoDialogControl_IBase::getTypes(),
+ UnoControlContainer::getTypes()
+ );
+}
+
+void UnoDialogControl::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+{
+ Reference< XPropertySet > xP( rxModel, UNO_QUERY );
+
+ ::rtl::OUString aDefCtrl;
+ xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
+
+ // Add our own resource resolver to a newly created control
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+
+ Any aAny;
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+
+ aAny <<= xStringResourceResolver;
+ xP->setPropertyValue( aPropName, aAny );
+
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference < XControl > xCtrl( xMSF->createInstance( aDefCtrl ), UNO_QUERY );
+
+ DBG_ASSERT( xCtrl.is(), "UnoDialogControl::ImplInsertControl: could not create the control!" );
+ if ( xCtrl.is() )
+ {
+ xCtrl->setModel( rxModel );
+ addControl( rName, xCtrl );
+ // will implicitly call addingControl, where we can add the PropertiesChangeListener to the model
+ // (which we formerly did herein)
+ // 08.01.2001 - 96008 - fs@openoffice.org
+
+ ImplSetPosSize( xCtrl );
+ }
+}
+
+void UnoDialogControl::ImplRemoveControl( Reference< XControlModel >& rxModel )
+{
+ Sequence< Reference< XControl > > aControls = getControls();
+ Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
+ if ( xCtrl.is() )
+ removeControl( xCtrl );
+}
+
+void UnoDialogControl::ImplSetPosSize( Reference< XControl >& rxCtrl )
+{
+ Reference< XPropertySet > xP( rxCtrl->getModel(), UNO_QUERY );
+
+ sal_Int32 nX = 0, nY = 0, nWidth = 0, nHeight = 0;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ) ) >>= nX;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ) ) >>= nY;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ) ) ) >>= nWidth;
+ xP->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) ) >>= nHeight;
+
+ // Currentley we are simply using MAP_APPFONT
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ DBG_ASSERT( pOutDev, "Missing Default Device!" );
+ if ( pOutDev )
+ {
+ ::Size aTmp( nX, nY );
+ aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+ nX = aTmp.Width();
+ nY = aTmp.Height();
+ aTmp = ::Size( nWidth, nHeight );
+ aTmp = pOutDev->LogicToPixel( aTmp, MAP_APPFONT );
+ nWidth = aTmp.Width();
+ nHeight = aTmp.Height();
+ }
+ else
+ {
+ Reference< XWindowPeer > xPeer = ImplGetCompatiblePeer( sal_True );
+ Reference< XDevice > xD( xPeer, UNO_QUERY );
+
+ SimpleFontMetric aFM;
+ FontDescriptor aFD;
+ Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ) );
+ aVal >>= aFD;
+ if ( aFD.StyleName.getLength() )
+ {
+ Reference< XFont > xFont = xD->getFont( aFD );
+ aFM = xFont->getFontMetric();
+ }
+ else
+ {
+ Reference< XGraphics > xG = xD->createGraphics();
+ aFM = xG->getFontMetric();
+ }
+
+ sal_Int16 nH = aFM.Ascent + aFM.Descent;
+ sal_Int16 nW = nH/2; // calculate avarage width?!
+
+ nX *= nW;
+ nX /= 4;
+ nWidth *= nW;
+ nWidth /= 4;
+ nY *= nH;
+ nY /= 8;
+ nHeight *= nH;
+ nHeight /= 8;
+ }
+ Reference < XWindow > xW( rxCtrl, UNO_QUERY );
+ xW->setPosSize( nX, nY, nWidth, nHeight, PosSize::POSSIZE );
+}
+
+void UnoDialogControl::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ maTopWindowListeners.disposeAndClear( aEvt );
+
+ // Notify our listener helper about dispose
+ // --- SAFE ---
+ ::osl::ResettableGuard< ::osl::Mutex > aGuard( GetMutex() );
+ Reference< XEventListener > xListener( mxListener, UNO_QUERY );
+ mxListener.clear();
+ aGuard.clear();
+ // --- SAFE ---
+
+ if ( xListener.is() )
+ xListener->disposing( aEvt );
+
+ UnoControlContainer::dispose();
+}
+
+void SAL_CALL UnoDialogControl::disposing(
+ const EventObject& Source )
+throw(RuntimeException)
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+ Reference< XInterface > xIfac( xStringResourceResolver, UNO_QUERY );
+
+ if ( Source.Source == xIfac )
+ {
+ Any aAny;
+
+ // Reset resource resolver reference
+ ImplSetPropertyValue( aPropName, aAny, sal_True );
+ ImplUpdateResourceResolver();
+ }
+ else
+ {
+ UnoControlContainer::disposing( Source );
+ }
+}
+
+sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ // destroy the old tab controller, if existent
+ if ( mxTabController.is() )
+ {
+ mxTabController->setModel( NULL ); // just to be sure, should not be necessary
+ removeTabController( mxTabController );
+ ::comphelper::disposeComponent( mxTabController ); // just to be sure, should not be necessary
+ mxTabController.clear();
+ }
+
+ if ( getModel().is() )
+ {
+ Sequence< Reference< XControl > > aControls = getControls();
+ const Reference< XControl >* pCtrls = aControls.getConstArray();
+ const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
+
+ for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
+ removeControl( *pCtrls );
+ // will implicitly call removingControl, which will remove the PropertyChangeListener
+ // (which we formerly did herein)
+ // 08.01.2001 - 96008 - fs@openoffice.org
+
+ Reference< XContainer > xC( getModel(), UNO_QUERY );
+ if ( xC.is() )
+ xC->removeContainerListener( this );
+
+ Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
+ if ( xChangeNotifier.is() )
+ xChangeNotifier->removeChangesListener( this );
+ }
+
+ sal_Bool bRet = UnoControl::setModel( rxModel );
+
+ if ( getModel().is() )
+ {
+ Reference< XNameAccess > xNA( getModel(), UNO_QUERY );
+ if ( xNA.is() )
+ {
+ Sequence< ::rtl::OUString > aNames = xNA->getElementNames();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ sal_uInt32 nCtrls = aNames.getLength();
+
+ Reference< XControlModel > xCtrlModel;
+ for( sal_uInt32 n = 0; n < nCtrls; ++n, ++pNames )
+ {
+ xNA->getByName( *pNames ) >>= xCtrlModel;
+ ImplInsertControl( xCtrlModel, *pNames );
+ }
+ }
+
+ Reference< XContainer > xC( getModel(), UNO_QUERY );
+ if ( xC.is() )
+ xC->addContainerListener( this );
+
+ Reference< XChangesNotifier > xChangeNotifier( getModel(), UNO_QUERY );
+ if ( xChangeNotifier.is() )
+ xChangeNotifier->addChangesListener( this );
+ }
+
+ Reference< XTabControllerModel > xTabbing( getModel(), UNO_QUERY );
+ if ( xTabbing.is() )
+ {
+ mxTabController = new StdTabController;
+ mxTabController->setModel( xTabbing );
+ addTabController( mxTabController );
+ }
+ ImplStartListingForResourceEvents();
+
+ return bRet;
+}
+
+void UnoDialogControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ UnoControl::setDesignMode( bOn );
+
+ Sequence< Reference< XControl > > xCtrls = getControls();
+ sal_Int32 nControls = xCtrls.getLength();
+ Reference< XControl >* pControls = xCtrls.getArray();
+ for ( sal_Int32 n = 0; n < nControls; n++ )
+ pControls[n]->setDesignMode( bOn );
+
+ // #109067# in design mode the tab controller is not notified about
+ // tab index changes, therefore the tab order must be activated
+ // when switching from design mode to live mode
+ if ( mxTabController.is() && !bOn )
+ mxTabController->activateTabOrder();
+}
+
+void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+
+ Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
+ if ( xTW.is() )
+ {
+ xTW->setMenuBar( mxMenuBar );
+
+ if ( !mbWindowListener )
+ {
+ Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
+ addWindowListener( xWL );
+ mbWindowListener = true;
+ }
+
+ if ( maTopWindowListeners.getLength() )
+ xTW->addTopWindowListener( &maTopWindowListeners );
+ }
+}
+
+void UnoDialogControl::PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc )
+{
+ sal_Bool bDecoration( sal_True );
+ ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DECORATION )) >>= bDecoration;
+ if ( !bDecoration )
+ {
+ // Now we have to manipulate the WindowDescriptor
+ rDesc.WindowAttributes = rDesc.WindowAttributes | ::com::sun::star::awt::WindowAttribute::NODECORATION;
+ }
+
+ // We have to set the graphic property before the peer
+ // will be created. Otherwise the properties will be copied
+ // into the peer via propertiesChangeEvents. As the order of
+ // can lead to overwrites we have to set the graphic property
+ // before the propertiesChangeEvents are sent!
+ ::rtl::OUString aImageURL;
+ Reference< graphic::XGraphic > xGraphic;
+ if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
+ ( aImageURL.getLength() > 0 ))
+ {
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
+ ImplGetPropertyValue( PROPERTY_IMAGEURL ));
+
+ xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
+ ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
+ }
+}
+
+void UnoDialogControl::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ ::rtl::OUString aName;
+
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+void UnoDialogControl::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.Element >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+}
+
+void UnoDialogControl::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.ReplacedElement >>= xModel;
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ImplInsertControl( xModel, aName );
+}
+
+void UnoDialogControl::addTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
+{
+ maTopWindowListeners.addInterface( rxListener );
+ if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
+ {
+ Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
+ xTW->addTopWindowListener( &maTopWindowListeners );
+ }
+}
+
+void UnoDialogControl::removeTopWindowListener( const Reference< XTopWindowListener >& rxListener ) throw (RuntimeException)
+{
+ if( getPeer().is() && maTopWindowListeners.getLength() == 1 )
+ {
+ Reference < XTopWindow > xTW( getPeer(), UNO_QUERY );
+ xTW->removeTopWindowListener( &maTopWindowListeners );
+ }
+ maTopWindowListeners.removeInterface( rxListener );
+}
+
+void UnoDialogControl::toFront( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( getPeer().is() )
+ {
+ Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+ if( xTW.is() )
+ xTW->toFront();
+ }
+}
+
+void UnoDialogControl::toBack( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( getPeer().is() )
+ {
+ Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+ if( xTW.is() )
+ xTW->toBack();
+ }
+}
+
+void UnoDialogControl::setMenuBar( const Reference< XMenuBar >& rxMenuBar ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ mxMenuBar = rxMenuBar;
+ if ( getPeer().is() )
+ {
+ Reference< XTopWindow > xTW( getPeer(), UNO_QUERY );
+ if( xTW.is() )
+ xTW->setMenuBar( mxMenuBar );
+ }
+}
+
+static ::Size ImplMapPixelToAppFont( OutputDevice* pOutDev, const ::Size& aSize )
+{
+ ::Size aTmp = pOutDev->PixelToLogic( aSize, MAP_APPFONT );
+ return aTmp;
+}
+
+// ::com::sun::star::awt::XWindowListener
+void SAL_CALL UnoDialogControl::windowResized( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ DBG_ASSERT( pOutDev, "Missing Default Device!" );
+ if ( pOutDev && !mbSizeModified )
+ {
+ // Currentley we are simply using MAP_APPFONT
+ ::Size aAppFontSize( e.Width, e.Height );
+
+ Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW );
+ Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY );
+ OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" );
+ if ( xDialogDevice.is() )
+ {
+ DeviceInfo aDeviceInfo( xDialogDevice->getInfo() );
+ aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
+ aAppFontSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
+ }
+
+ aAppFontSize = ImplMapPixelToAppFont( pOutDev, aAppFontSize );
+
+ // Remember that changes have been done by listener. No need to
+ // update the position because of property change event.
+ mbSizeModified = true;
+ Sequence< rtl::OUString > aProps( 2 );
+ Sequence< Any > aValues( 2 );
+ // Properties in a sequence must be sorted!
+ aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Height" ));
+ aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" ));
+ aValues[0] <<= aAppFontSize.Height();
+ aValues[1] <<= aAppFontSize.Width();
+
+ ImplSetPropertyValues( aProps, aValues, true );
+ mbSizeModified = false;
+ }
+}
+
+void SAL_CALL UnoDialogControl::windowMoved( const ::com::sun::star::awt::WindowEvent& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ DBG_ASSERT( pOutDev, "Missing Default Device!" );
+ if ( pOutDev && !mbPosModified )
+ {
+ // Currentley we are simply using MAP_APPFONT
+ Any aAny;
+ ::Size aTmp( e.X, e.Y );
+ aTmp = ImplMapPixelToAppFont( pOutDev, aTmp );
+
+ // Remember that changes have been done by listener. No need to
+ // update the position because of property change event.
+ mbPosModified = true;
+ Sequence< rtl::OUString > aProps( 2 );
+ Sequence< Any > aValues( 2 );
+ aProps[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ));
+ aProps[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ));
+ aValues[0] <<= aTmp.Width();
+ aValues[1] <<= aTmp.Height();
+
+ ImplSetPropertyValues( aProps, aValues, true );
+ mbPosModified = false;
+ }
+}
+
+void SAL_CALL UnoDialogControl::windowShown( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
+
+void SAL_CALL UnoDialogControl::windowHidden( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
+
+// XPropertiesChangeListener
+void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+{
+ if( !isDesignMode() && !mbCreatingCompatiblePeer )
+ {
+ ::rtl::OUString s1( RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) );
+ ::rtl::OUString s2( RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) );
+ ::rtl::OUString s3( RTL_CONSTASCII_USTRINGPARAM( "Width" ) );
+ ::rtl::OUString s4( RTL_CONSTASCII_USTRINGPARAM( "Height" ) );
+
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
+ Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
+ sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+ if ( ( rEvt.PropertyName == s1 ) ||
+ ( rEvt.PropertyName == s2 ) ||
+ ( rEvt.PropertyName == s3 ) ||
+ ( rEvt.PropertyName == s4 ) )
+ {
+ if ( bOwnModel )
+ {
+ if ( !mbPosModified && !mbSizeModified )
+ {
+ // Don't set new pos/size if we get new values from window listener
+ Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
+ ImplSetPosSize( xThis );
+ }
+ }
+ else
+ {
+ Sequence<Reference<XControl> > aControlSequence(getControls());
+ Reference<XControl> aControlRef( StdTabController::FindControl( aControlSequence, xModel ) );
+ ImplSetPosSize( aControlRef );
+ }
+ break;
+ }
+ else if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
+ {
+ ImplStartListingForResourceEvents();
+ }
+ }
+ }
+
+ sal_Int32 nLen = rEvents.getLength();
+ for( sal_Int32 i = 0; i < nLen; i++ )
+ {
+ const PropertyChangeEvent& rEvt = rEvents.getConstArray()[i];
+ Reference< XControlModel > xModel( rEvt.Source, UNO_QUERY );
+ sal_Bool bOwnModel = (XControlModel*)xModel.get() == (XControlModel*)getModel().get();
+ if ( bOwnModel && rEvt.PropertyName.equalsAsciiL( "ImageURL", 8 ))
+ {
+ ::rtl::OUString aImageURL;
+ Reference< graphic::XGraphic > xGraphic;
+ if (( ImplGetPropertyValue( PROPERTY_IMAGEURL ) >>= aImageURL ) &&
+ ( aImageURL.getLength() > 0 ))
+ {
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( ImplGetPropertyValue( PROPERTY_DIALOGSOURCEURL ),
+ ImplGetPropertyValue( PROPERTY_IMAGEURL ));
+
+ xGraphic = lcl_getGraphicFromURL_nothrow( absoluteUrl );
+ }
+
+ ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
+ break;
+ }
+ }
+
+ UnoControlContainer::ImplModelPropertiesChanged( rEvents );
+}
+
+void UnoDialogControl::ImplStartListingForResourceEvents()
+{
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( PROPERTY_RESOURCERESOLVER ) >>= xStringResourceResolver;
+
+ // Add our helper as listener to retrieve notifications about changes
+ Reference< util::XModifyListener > rListener( mxListener );
+ ResourceListener* pResourceListener = static_cast< ResourceListener* >( rListener.get() );
+
+ // resource listener will stop listening if resolver reference is empty
+ if ( pResourceListener )
+ pResourceListener->startListening( xStringResourceResolver );
+ ImplUpdateResourceResolver();
+}
+
+void UnoDialogControl::ImplUpdateResourceResolver()
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+ if ( !xStringResourceResolver.is() )
+ return;
+
+ Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
+
+ Sequence< rtl::OUString > aPropNames(1);
+ aPropNames[0] = aPropName;
+
+ const Sequence< Reference< awt::XControl > > aSeq = getControls();
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ {
+ Reference< XControl > xControl( aSeq[i] );
+ Reference< XPropertySet > xPropertySet;
+
+ if ( xControl.is() )
+ xPropertySet = Reference< XPropertySet >( xControl->getModel(), UNO_QUERY );
+
+ if ( !xPropertySet.is() )
+ continue;
+
+ try
+ {
+ Reference< resource::XStringResourceResolver > xCurrStringResourceResolver;
+ Any aOldValue = xPropertySet->getPropertyValue( aPropName );
+ if ( ( aOldValue >>= xCurrStringResourceResolver )
+ && ( xStringResourceResolver == xCurrStringResourceResolver )
+ )
+ {
+ Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
+ Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+ xMultiPropSet->firePropertiesChangeEvent( aPropNames, xListener );
+ }
+ else
+ xPropertySet->setPropertyValue( aPropName, xNewStringResourceResolver );
+ }
+ /*catch ( NoSuchElementException& )*/ // that's nonsense, this is never thrown above ...
+ catch ( const Exception& )
+ {
+ }
+ }
+
+ // propagate resource resolver changes to language dependent props of the dialog
+ Reference< XPropertySet > xPropertySet( getModel(), UNO_QUERY );
+ if ( xPropertySet.is() )
+ {
+ Reference< XMultiPropertySet > xMultiPropSet( xPropertySet, UNO_QUERY );
+ Reference< XPropertiesChangeListener > xListener( xPropertySet, UNO_QUERY );
+ xMultiPropSet->firePropertiesChangeEvent( lcl_getLanguageDependentProperties(), xListener );
+ }
+}
+
+void UnoDialogControl::setTitle( const ::rtl::OUString& Title ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Any aAny;
+ aAny <<= Title;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TITLE ), aAny, sal_True );
+}
+
+::rtl::OUString UnoDialogControl::getTitle() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ return ImplGetPropertyValue_UString( BASEPROPERTY_TITLE );
+}
+
+sal_Int16 UnoDialogControl::execute() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ sal_Int16 nDone = -1;
+ if ( getPeer().is() )
+ {
+ Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
+ if( xDlg.is() )
+ {
+ GetComponentInfos().bVisible = sal_True;
+ nDone = xDlg->execute();
+ GetComponentInfos().bVisible = sal_False;
+ }
+ }
+ return nDone;
+}
+
+void UnoDialogControl::endExecute() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ if ( getPeer().is() )
+ {
+ Reference< XDialog > xDlg( getPeer(), UNO_QUERY );
+ if( xDlg.is() )
+ {
+ xDlg->endExecute();
+ GetComponentInfos().bVisible = sal_False;
+ }
+ }
+}
+
+void UnoDialogControl::addingControl( const Reference< XControl >& _rxControl )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::addingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Sequence< ::rtl::OUString > aNames( 4 );
+ ::rtl::OUString* pNames = aNames.getArray();
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionX" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "PositionY" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Width" );
+ *pNames++ = ::rtl::OUString::createFromAscii( "Height" );
+
+ xProps->addPropertiesChangeListener( aNames, this );
+ }
+ }
+}
+
+void UnoDialogControl::removingControl( const Reference< XControl >& _rxControl )
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::removingControl( _rxControl );
+
+ if ( _rxControl.is() )
+ {
+ Reference< XMultiPropertySet > xProps( _rxControl->getModel(), UNO_QUERY );
+ if ( xProps.is() )
+ xProps->removePropertiesChangeListener( this );
+ }
+
+}
+
+void SAL_CALL UnoDialogControl::changesOccurred( const ChangesEvent& ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // a tab controller model may have changed
+
+ // #109067# in design mode don't notify the tab controller
+ // about tab index changes
+ if ( mxTabController.is() && !mbDesignMode )
+ mxTabController->activateTabOrder();
+}
+
+// XModifyListener
+void SAL_CALL UnoDialogControl::modified(
+ const lang::EventObject& /*rEvent*/ )
+throw (RuntimeException)
+{
+ ImplUpdateResourceResolver();
+}
+
+// ----------------------------------------------------
+// Helper Method to convert relative url to physical location
+// ----------------------------------------------------
+
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl )
+{
+
+
+ ::rtl::OUString ret;
+
+ ::rtl::OUString baseLocation;
+ ::rtl::OUString url;
+
+ rbase >>= baseLocation;
+ rUrl >>= url;
+
+ if ( url.getLength() > 0 )
+ {
+ INetURLObject urlObj(baseLocation);
+ urlObj.removeSegment();
+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
+ ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, ret );
+ }
+
+ return ret;
+}
+
diff --git a/toolkit/source/controls/eventcontainer.cxx b/toolkit/source/controls/eventcontainer.cxx
new file mode 100644
index 000000000000..0cbf9d4e7281
--- /dev/null
+++ b/toolkit/source/controls/eventcontainer.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/queryinterface.hxx>
+#ifndef _CPPUHELER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include "toolkit/controls/eventcontainer.hxx"
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::container;
+using namespace com::sun::star::registry;
+using namespace com::sun::star::script;
+using namespace cppu;
+using namespace osl;
+using namespace rtl;
+using namespace std;
+
+
+namespace toolkit
+{
+
+// Methods XElementAccess
+Type NameContainer_Impl::getElementType()
+ throw(RuntimeException)
+{
+ return mType;
+}
+
+sal_Bool NameContainer_Impl::hasElements()
+ throw(RuntimeException)
+{
+ sal_Bool bRet = (mnElementCount > 0);
+ return bRet;
+}
+
+// Methods XNameAccess
+Any NameContainer_Impl::getByName( const OUString& aName )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ NameContainerNameMap::iterator aIt = mHashMap.find( aName );
+ if( aIt == mHashMap.end() )
+ {
+ throw NoSuchElementException();
+ }
+ sal_Int32 iHashResult = (*aIt).second;
+ Any aRetAny = mValues.getConstArray()[ iHashResult ];
+ return aRetAny;
+}
+
+Sequence< OUString > NameContainer_Impl::getElementNames()
+ throw(RuntimeException)
+{
+ return mNames;
+}
+
+sal_Bool NameContainer_Impl::hasByName( const OUString& aName )
+ throw(RuntimeException)
+{
+ NameContainerNameMap::iterator aIt = mHashMap.find( aName );
+ sal_Bool bRet = ( aIt != mHashMap.end() );
+ return bRet;
+}
+
+
+// Methods XNameReplace
+void NameContainer_Impl::replaceByName( const OUString& aName, const Any& aElement )
+ throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ Type aAnyType = aElement.getValueType();
+ if( mType != aAnyType )
+ throw IllegalArgumentException();
+
+ NameContainerNameMap::iterator aIt = mHashMap.find( aName );
+ if( aIt == mHashMap.end() )
+ {
+ throw NoSuchElementException();
+ }
+ sal_Int32 iHashResult = (*aIt).second;
+ Any aOldElement = mValues.getConstArray()[ iHashResult ];
+ mValues.getArray()[ iHashResult ] = aElement;
+
+ // Fire event
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.ReplacedElement = aOldElement;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementReplaced( aEvent );
+}
+
+
+// Methods XNameContainer
+void NameContainer_Impl::insertByName( const OUString& aName, const Any& aElement )
+ throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
+{
+ Type aAnyType = aElement.getValueType();
+ if( mType != aAnyType )
+ throw IllegalArgumentException();
+
+ NameContainerNameMap::iterator aIt = mHashMap.find( aName );
+ if( aIt != mHashMap.end() )
+ {
+ throw ElementExistException();
+ }
+
+ sal_Int32 nCount = mNames.getLength();
+ mNames.realloc( nCount + 1 );
+ mValues.realloc( nCount + 1 );
+ mNames.getArray()[ nCount ] = aName;
+ mValues.getArray()[ nCount ] = aElement;
+ mHashMap[ aName ] = nCount;
+
+ // Fire event
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.Accessor <<= aName;
+ maContainerListeners.elementInserted( aEvent );
+}
+
+void NameContainer_Impl::removeByName( const OUString& Name )
+ throw(NoSuchElementException, WrappedTargetException, RuntimeException)
+{
+ NameContainerNameMap::iterator aIt = mHashMap.find( Name );
+ if( aIt == mHashMap.end() )
+ {
+ throw NoSuchElementException();
+ }
+
+ sal_Int32 iHashResult = (*aIt).second;
+ Any aOldElement = mValues.getConstArray()[ iHashResult ];
+
+ // Fire event
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element = aOldElement;
+ aEvent.Accessor <<= Name;
+ maContainerListeners.elementRemoved( aEvent );
+
+ mHashMap.erase( aIt );
+ sal_Int32 iLast = mNames.getLength() - 1;
+ if( iLast != iHashResult )
+ {
+ OUString* pNames = mNames.getArray();
+ Any* pValues = mValues.getArray();
+ pNames[ iHashResult ] = pNames[ iLast ];
+ pValues[ iHashResult ] = pValues[ iLast ];
+ mHashMap[ pNames[ iHashResult ] ] = iHashResult;
+ }
+ mNames.realloc( iLast );
+ mValues.realloc( iLast );
+
+}
+
+// Methods XContainer
+void NameContainer_Impl::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void NameContainer_Impl::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+
+
+// Ctor
+ScriptEventContainer::ScriptEventContainer( void )
+ : NameContainer_Impl( getCppuType( (ScriptEventDescriptor*) NULL ) )
+{
+}
+
+}
+
+
+
+
diff --git a/toolkit/source/controls/formattedcontrol.cxx b/toolkit/source/controls/formattedcontrol.cxx
new file mode 100644
index 000000000000..67c9c40ebd38
--- /dev/null
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -0,0 +1,468 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <toolkit/controls/formattedcontrol.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+#include <tools/diagnose_ex.h>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ 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::util;
+
+ // -------------------------------------------------------------------
+ namespace
+ {
+ // ...............................................................
+ ::osl::Mutex& getDefaultFormatsMutex()
+ {
+ static ::osl::Mutex s_aDefaultFormatsMutex;
+ return s_aDefaultFormatsMutex;
+ }
+
+ // ...............................................................
+ Reference< XNumberFormatsSupplier >& lcl_getDefaultFormatsAccess_nothrow()
+ {
+ static Reference< XNumberFormatsSupplier > s_xDefaultFormats;
+ return s_xDefaultFormats;
+ }
+
+ // ...............................................................
+ bool& lcl_getTriedCreation()
+ {
+ static bool s_bTriedCreation = false;
+ return s_bTriedCreation;
+ }
+
+ // ...............................................................
+ const Reference< XNumberFormatsSupplier >& lcl_getDefaultFormats_throw()
+ {
+ ::osl::MutexGuard aGuard( getDefaultFormatsMutex() );
+
+ bool& rbTriedCreation = lcl_getTriedCreation();
+ Reference< XNumberFormatsSupplier >& rDefaultFormats( lcl_getDefaultFormatsAccess_nothrow() );
+ if ( !rDefaultFormats.is() && !rbTriedCreation )
+ {
+ rbTriedCreation = true;
+ rDefaultFormats = Reference< XNumberFormatsSupplier >(
+ ::comphelper::createProcessComponent(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatsSupplier" ) ) ),
+ UNO_QUERY_THROW
+ );
+ }
+ if ( !rDefaultFormats.is() )
+ throw RuntimeException();
+
+ return rDefaultFormats;
+ }
+
+ // ...............................................................
+ static oslInterlockedCount s_refCount(0);
+
+ // ...............................................................
+ void lcl_registerDefaultFormatsClient()
+ {
+ osl_incrementInterlockedCount( &s_refCount );
+ }
+
+ // ...............................................................
+ void lcl_revokeDefaultFormatsClient()
+ {
+ ::osl::ClearableMutexGuard aGuard( getDefaultFormatsMutex() );
+ if ( 0 == osl_decrementInterlockedCount( &s_refCount ) )
+ {
+ Reference< XNumberFormatsSupplier >& rDefaultFormats( lcl_getDefaultFormatsAccess_nothrow() );
+ Reference< XNumberFormatsSupplier > xReleasePotentialLastReference( rDefaultFormats );
+ rDefaultFormats.clear();
+ lcl_getTriedCreation() = false;
+
+ aGuard.clear();
+ xReleasePotentialLastReference.clear();
+ }
+ }
+ }
+
+ // ===================================================================
+ // = UnoControlFormattedFieldModel
+ // ===================================================================
+ // -------------------------------------------------------------------
+ UnoControlFormattedFieldModel::UnoControlFormattedFieldModel()
+ :m_bRevokedAsClient( false )
+ ,m_bSettingValueAndText( false )
+ {
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_DEFAULT );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_VALUE );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MAX );
+ ImplRegisterProperty( BASEPROPERTY_EFFECTIVE_MIN );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_FORMATKEY );
+ ImplRegisterProperty( BASEPROPERTY_FORMATSSUPPLIER );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_MAXTEXTLEN );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_REPEAT );
+ ImplRegisterProperty( BASEPROPERTY_REPEAT_DELAY );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_SPIN );
+ ImplRegisterProperty( BASEPROPERTY_STRICTFORMAT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
+ ImplRegisterProperty( BASEPROPERTY_ENFORCE_FORMAT );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
+ ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR );
+
+ Any aTreatAsNumber;
+ aTreatAsNumber <<= (sal_Bool) sal_True;
+ ImplRegisterProperty( BASEPROPERTY_TREATASNUMBER, aTreatAsNumber );
+
+ lcl_registerDefaultFormatsClient();
+ }
+
+ // -------------------------------------------------------------------
+ UnoControlFormattedFieldModel::~UnoControlFormattedFieldModel()
+ {
+ }
+
+ // -------------------------------------------------------------------
+ ::rtl::OUString UnoControlFormattedFieldModel::getServiceName() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedFieldModel );
+ }
+
+ // -------------------------------------------------------------------
+ void SAL_CALL UnoControlFormattedFieldModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
+ {
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ switch ( nHandle )
+ {
+ case BASEPROPERTY_EFFECTIVE_VALUE:
+ if ( !m_bSettingValueAndText )
+ impl_updateTextFromValue_nothrow();
+ break;
+ case BASEPROPERTY_FORMATSSUPPLIER:
+ impl_updateCachedFormatter_nothrow();
+ impl_updateTextFromValue_nothrow();
+ break;
+ case BASEPROPERTY_FORMATKEY:
+ impl_updateCachedFormatKey_nothrow();
+ impl_updateTextFromValue_nothrow();
+ break;
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void UnoControlFormattedFieldModel::impl_updateTextFromValue_nothrow()
+ {
+ if ( !m_xCachedFormatter.is() )
+ impl_updateCachedFormatter_nothrow();
+ if ( !m_xCachedFormatter.is() )
+ return;
+
+ try
+ {
+ Any aEffectiveValue;
+ getFastPropertyValue( aEffectiveValue, BASEPROPERTY_EFFECTIVE_VALUE );
+
+ ::rtl::OUString sStringValue;
+ if ( !( aEffectiveValue >>= sStringValue ) )
+ {
+ double nDoubleValue(0);
+ if ( aEffectiveValue >>= nDoubleValue )
+ {
+ sal_Int32 nFormatKey( 0 );
+ if ( m_aCachedFormat.hasValue() )
+ m_aCachedFormat >>= nFormatKey;
+ sStringValue = m_xCachedFormatter->convertNumberToString( nFormatKey, nDoubleValue );
+ }
+ }
+
+ Reference< XPropertySet > xThis( *this, UNO_QUERY );
+ xThis->setPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), makeAny( sStringValue ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void UnoControlFormattedFieldModel::impl_updateCachedFormatter_nothrow()
+ {
+ Any aFormatsSupplier;
+ getFastPropertyValue( aFormatsSupplier, BASEPROPERTY_FORMATSSUPPLIER );
+ try
+ {
+ Reference< XNumberFormatsSupplier > xSupplier( aFormatsSupplier, UNO_QUERY );
+ if ( !xSupplier.is() )
+ xSupplier = lcl_getDefaultFormats_throw();
+
+ if ( !m_xCachedFormatter.is() )
+ {
+ m_xCachedFormatter = Reference< XNumberFormatter >(
+ ::comphelper::createProcessComponent( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) ),
+ UNO_QUERY_THROW
+ );
+ }
+ m_xCachedFormatter->attachNumberFormatsSupplier( xSupplier );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void UnoControlFormattedFieldModel::impl_updateCachedFormatKey_nothrow()
+ {
+ Any aFormatKey;
+ getFastPropertyValue( aFormatKey, BASEPROPERTY_FORMATKEY );
+ m_aCachedFormat = aFormatKey;
+ }
+
+ // -------------------------------------------------------------------
+ void UnoControlFormattedFieldModel::dispose( ) throw(RuntimeException)
+ {
+ UnoControlModel::dispose();
+
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( !m_bRevokedAsClient )
+ {
+ lcl_revokeDefaultFormatsClient();
+ m_bRevokedAsClient = true;
+ }
+ }
+
+ // -------------------------------------------------------------------
+ void UnoControlFormattedFieldModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
+ Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
+ {
+ ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_EFFECTIVE_VALUE, BASEPROPERTY_TEXT );
+
+ UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
+ }
+
+ // -------------------------------------------------------------------
+ namespace
+ {
+ class ResetFlagOnExit
+ {
+ private:
+ bool& m_rFlag;
+
+ public:
+ ResetFlagOnExit( bool& _rFlag )
+ :m_rFlag( _rFlag )
+ {
+ }
+ ~ResetFlagOnExit()
+ {
+ m_rFlag = false;
+ }
+ };
+ }
+
+ // -------------------------------------------------------------------
+ void SAL_CALL UnoControlFormattedFieldModel::setPropertyValues( const Sequence< ::rtl::OUString >& _rPropertyNames, const Sequence< Any >& _rValues ) throw(PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+ {
+ bool bSettingValue = false;
+ bool bSettingText = false;
+ for ( const ::rtl::OUString* pPropertyNames = _rPropertyNames.getConstArray();
+ pPropertyNames != _rPropertyNames.getConstArray() + _rPropertyNames.getLength();
+ ++pPropertyNames
+ )
+ {
+ if ( BASEPROPERTY_EFFECTIVE_VALUE == GetPropertyId( *pPropertyNames ) )
+ bSettingValue = true;
+
+ if ( BASEPROPERTY_TEXT == GetPropertyId( *pPropertyNames ) )
+ bSettingText = true;
+ }
+
+ m_bSettingValueAndText = ( bSettingValue && bSettingText );
+ ResetFlagOnExit aResetFlag( m_bSettingValueAndText );
+ UnoControlModel::setPropertyValues( _rPropertyNames, _rValues );
+ }
+
+ // -------------------------------------------------------------------
+ sal_Bool UnoControlFormattedFieldModel::convertFastPropertyValue(
+ Any& rConvertedValue, Any& rOldValue, sal_Int32 nPropId,
+ const Any& rValue ) throw (IllegalArgumentException)
+ {
+ if ( BASEPROPERTY_EFFECTIVE_DEFAULT == nPropId && rValue.hasValue() )
+ {
+ double dVal = 0;
+ sal_Int32 nVal = 0;
+ ::rtl::OUString sVal;
+ sal_Bool bStreamed = (rValue >>= dVal);
+ if ( bStreamed )
+ {
+ rConvertedValue <<= dVal;
+ }
+ else
+ {
+ bStreamed = (rValue >>= nVal);
+ if ( bStreamed )
+ {
+ rConvertedValue <<= static_cast<double>(nVal);
+ }
+ else
+ {
+ bStreamed = (rValue >>= sVal);
+ if ( bStreamed )
+ {
+ rConvertedValue <<= sVal;
+ }
+ }
+ }
+
+ if ( bStreamed )
+ {
+ getFastPropertyValue( rOldValue, nPropId );
+ return !CompareProperties( rConvertedValue, rOldValue );
+ }
+
+ throw IllegalArgumentException(
+ ( ::rtl::OUString::createFromAscii("Unable to convert the given value for the property ")
+ += GetPropertyName((sal_uInt16)nPropId) )
+ += ::rtl::OUString::createFromAscii(" (double, integer, or string expected)."),
+ static_cast< XPropertySet* >(this),
+ 1);
+ }
+
+ return UnoControlModel::convertFastPropertyValue( rConvertedValue, rOldValue, nPropId, rValue );
+ }
+
+ // -------------------------------------------------------------------
+ Any UnoControlFormattedFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+ {
+ Any aReturn;
+ switch (nPropId)
+ {
+ case BASEPROPERTY_DEFAULTCONTROL: aReturn <<= ::rtl::OUString( ::rtl::OUString::createFromAscii( szServiceName_UnoControlFormattedField ) ); break;
+
+ case BASEPROPERTY_TREATASNUMBER: aReturn <<= (sal_Bool)sal_True; break;
+
+ case BASEPROPERTY_EFFECTIVE_DEFAULT:
+ case BASEPROPERTY_EFFECTIVE_VALUE:
+ case BASEPROPERTY_EFFECTIVE_MAX:
+ case BASEPROPERTY_EFFECTIVE_MIN:
+ case BASEPROPERTY_FORMATKEY:
+ case BASEPROPERTY_FORMATSSUPPLIER:
+ // (void)
+ break;
+
+ default : aReturn = UnoControlModel::ImplGetDefaultValue( nPropId ); break;
+ }
+
+ return aReturn;
+ }
+
+ // -------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& UnoControlFormattedFieldModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+ // beans::XMultiPropertySet
+ // -------------------------------------------------------------------
+ Reference< XPropertySetInfo > UnoControlFormattedFieldModel::getPropertySetInfo( ) throw(RuntimeException)
+ {
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ // ===================================================================
+ // = UnoFormattedFieldControl
+ // ===================================================================
+ // -------------------------------------------------------------------
+ UnoFormattedFieldControl::UnoFormattedFieldControl()
+ {
+ }
+
+ // -------------------------------------------------------------------
+ ::rtl::OUString UnoFormattedFieldControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "FormattedField" );
+ }
+
+ // -------------------------------------------------------------------
+ void UnoFormattedFieldControl::textChanged(const TextEvent& e) throw(RuntimeException)
+ {
+ Reference< XVclWindowPeer > xPeer(getPeer(), UNO_QUERY);
+ OSL_ENSURE(xPeer.is(), "UnoFormattedFieldControl::textChanged : what kind of peer do I have ?");
+
+ Sequence< ::rtl::OUString > aNames( 2 );
+ aNames[0] = GetPropertyName( BASEPROPERTY_EFFECTIVE_VALUE );
+ aNames[1] = GetPropertyName( BASEPROPERTY_TEXT );
+
+ Sequence< Any > aValues( 2 );
+ aValues[0] = xPeer->getProperty( aNames[0] );
+ aValues[1] = xPeer->getProperty( aNames[1] );
+
+ ImplSetPropertyValues( aNames, aValues, FALSE );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx
new file mode 100644
index 000000000000..ac8a6e83ae28
--- /dev/null
+++ b/toolkit/source/controls/geometrycontrolmodel.cxx
@@ -0,0 +1,653 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include "toolkit/controls/geometrycontrolmodel.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <osl/diagnose.h>
+#include <rtl/instance.hxx>
+#include <comphelper/property.hxx>
+#include <comphelper/sequence.hxx>
+#ifndef _COM_SUN_STAR_XNAMECONTAINER_HPP_
+#include <toolkit/controls/eventcontainer.hxx>
+#endif
+#include <toolkit/helper/property.hxx>
+#include <tools/debug.hxx>
+#include <algorithm>
+#include <functional>
+#include <comphelper/sequence.hxx>
+
+
+#define GCM_PROPERTY_ID_POS_X 1
+#define GCM_PROPERTY_ID_POS_Y 2
+#define GCM_PROPERTY_ID_WIDTH 3
+#define GCM_PROPERTY_ID_HEIGHT 4
+#define GCM_PROPERTY_ID_NAME 5
+#define GCM_PROPERTY_ID_TABINDEX 6
+#define GCM_PROPERTY_ID_STEP 7
+#define GCM_PROPERTY_ID_TAG 8
+#define GCM_PROPERTY_ID_RESOURCERESOLVER 9
+
+#define GCM_PROPERTY_POS_X ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionX"))
+#define GCM_PROPERTY_POS_Y ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PositionY"))
+#define GCM_PROPERTY_WIDTH ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Width"))
+#define GCM_PROPERTY_HEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Height"))
+#define GCM_PROPERTY_NAME ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name"))
+#define GCM_PROPERTY_TABINDEX ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TabIndex"))
+#define GCM_PROPERTY_STEP ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Step"))
+#define GCM_PROPERTY_TAG ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Tag"))
+#define GCM_PROPERTY_RESOURCERESOLVER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ResourceResolver"))
+
+#define DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
+
+//........................................................................
+// namespace toolkit
+// {
+//........................................................................
+
+ 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::util;
+ using namespace ::com::sun::star::container;
+ using namespace ::comphelper;
+
+ //====================================================================
+ //= OGeometryControlModel_Base
+ //====================================================================
+ //--------------------------------------------------------------------
+ OGeometryControlModel_Base::OGeometryControlModel_Base(::com::sun::star::uno::XAggregation* _pAggregateInstance)
+ :OPropertySetAggregationHelper( m_aBHelper )
+ ,OPropertyContainer( m_aBHelper )
+ ,OGCM_Base( m_aMutex )
+ ,m_nPosX(0)
+ ,m_nPosY(0)
+ ,m_nWidth(0)
+ ,m_nHeight(0)
+ ,m_nTabIndex(-1)
+ ,m_nStep(0)
+ ,m_bCloneable(sal_False)
+ {
+ OSL_ENSURE(NULL != _pAggregateInstance, "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid aggregate!");
+
+ increment(m_refCount);
+ {
+ m_xAggregate = _pAggregateInstance;
+
+ { // check if the aggregat is cloneable
+ Reference< XCloneable > xCloneAccess(m_xAggregate, UNO_QUERY);
+ m_bCloneable = xCloneAccess.is();
+ }
+
+ setAggregation(m_xAggregate);
+ m_xAggregate->setDelegator(static_cast< XWeak* >(this));
+ }
+ decrement(m_refCount);
+
+ registerProperties();
+ }
+
+ //--------------------------------------------------------------------
+ OGeometryControlModel_Base::OGeometryControlModel_Base(Reference< XCloneable >& _rxAggregateInstance)
+ :OPropertySetAggregationHelper( m_aBHelper )
+ ,OPropertyContainer( m_aBHelper )
+ ,OGCM_Base( m_aMutex )
+ ,m_nPosX(0)
+ ,m_nPosY(0)
+ ,m_nWidth(0)
+ ,m_nHeight(0)
+ ,m_nTabIndex(-1)
+ ,m_nStep(0)
+ ,m_bCloneable(_rxAggregateInstance.is())
+ {
+ increment(m_refCount);
+ {
+ {
+ // ensure that the temporary gets destructed NOW
+ m_xAggregate = Reference< XAggregation >(_rxAggregateInstance, UNO_QUERY);
+ }
+ OSL_ENSURE(m_xAggregate.is(), "OGeometryControlModel_Base::OGeometryControlModel_Base: invalid object given!");
+
+ // now the aggregate has a ref count of 2, but before setting the delegator it must be 1
+ _rxAggregateInstance.clear();
+ // now it should be the 1 we need here ...
+
+ setAggregation(m_xAggregate);
+ m_xAggregate->setDelegator(static_cast< XWeak* >(this));
+ }
+ decrement(m_refCount);
+
+ registerProperties();
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< Type > SAL_CALL OGeometryControlModel_Base::getTypes( ) throw (RuntimeException)
+ {
+ // our own types
+ Sequence< Type > aTypes = ::comphelper::concatSequences(
+ OPropertySetAggregationHelper::getTypes(),
+ OPropertyContainer::getTypes(),
+ OGCM_Base::getTypes()
+ );
+
+ if ( m_xAggregate.is() )
+ {
+ // retrieve the types of the aggregate
+ Reference< XTypeProvider > xAggregateTypeProv;
+ m_xAggregate->queryAggregation( ::getCppuType( &xAggregateTypeProv ) ) >>= xAggregateTypeProv;
+ OSL_ENSURE( xAggregateTypeProv.is(), "OGeometryControlModel_Base::getTypes: aggregate should be a type provider!" );
+ Sequence< Type > aAggTypes;
+ if ( xAggregateTypeProv.is() )
+ aAggTypes = xAggregateTypeProv->getTypes();
+
+ // concat the sequences
+ sal_Int32 nOldSize = aTypes.getLength();
+ aTypes.realloc( nOldSize + aAggTypes.getLength() );
+ ::std::copy(
+ aAggTypes.getConstArray(),
+ aAggTypes.getConstArray() + aAggTypes.getLength(),
+ aTypes.getArray() + nOldSize
+ );
+ }
+
+ return aTypes;
+ }
+
+ //--------------------------------------------------------------------
+ void OGeometryControlModel_Base::registerProperties()
+ {
+ // register our members for the property handling of the OPropertyContainer
+ registerProperty(GCM_PROPERTY_POS_X, GCM_PROPERTY_ID_POS_X, DEFAULT_ATTRIBS(), &m_nPosX, ::getCppuType(&m_nPosX));
+ registerProperty(GCM_PROPERTY_POS_Y, GCM_PROPERTY_ID_POS_Y, DEFAULT_ATTRIBS(), &m_nPosY, ::getCppuType(&m_nPosY));
+ registerProperty(GCM_PROPERTY_WIDTH, GCM_PROPERTY_ID_WIDTH, DEFAULT_ATTRIBS(), &m_nWidth, ::getCppuType(&m_nWidth));
+ registerProperty(GCM_PROPERTY_HEIGHT, GCM_PROPERTY_ID_HEIGHT, DEFAULT_ATTRIBS(), &m_nHeight, ::getCppuType(&m_nHeight));
+ registerProperty(GCM_PROPERTY_NAME, GCM_PROPERTY_ID_NAME, DEFAULT_ATTRIBS(), &m_aName, ::getCppuType(&m_aName));
+ registerProperty(GCM_PROPERTY_TABINDEX, GCM_PROPERTY_ID_TABINDEX, DEFAULT_ATTRIBS(), &m_nTabIndex, ::getCppuType(&m_nTabIndex));
+ registerProperty(GCM_PROPERTY_STEP, GCM_PROPERTY_ID_STEP, DEFAULT_ATTRIBS(), &m_nStep, ::getCppuType(&m_nStep));
+ registerProperty(GCM_PROPERTY_TAG, GCM_PROPERTY_ID_TAG, DEFAULT_ATTRIBS(), &m_aTag, ::getCppuType(&m_aTag));
+ registerProperty(GCM_PROPERTY_RESOURCERESOLVER, GCM_PROPERTY_ID_RESOURCERESOLVER, DEFAULT_ATTRIBS(), &m_xStrResolver, ::getCppuType(&m_xStrResolver));
+ }
+
+ //--------------------------------------------------------------------
+ ::com::sun::star::uno::Any OGeometryControlModel_Base::ImplGetDefaultValueByHandle(sal_Int32 nHandle) const
+ {
+ ::com::sun::star::uno::Any aDefault;
+
+ switch ( nHandle )
+ {
+ case GCM_PROPERTY_ID_POS_X: aDefault <<= (sal_Int32) 0; break;
+ case GCM_PROPERTY_ID_POS_Y: aDefault <<= (sal_Int32) 0; break;
+ case GCM_PROPERTY_ID_WIDTH: aDefault <<= (sal_Int32) 0; break;
+ case GCM_PROPERTY_ID_HEIGHT: aDefault <<= (sal_Int32) 0; break;
+ case GCM_PROPERTY_ID_NAME: aDefault <<= ::rtl::OUString(); break;
+ case GCM_PROPERTY_ID_TABINDEX: aDefault <<= (sal_Int16) -1; break;
+ case GCM_PROPERTY_ID_STEP: aDefault <<= (sal_Int32) 0; break;
+ case GCM_PROPERTY_ID_TAG: aDefault <<= ::rtl::OUString(); break;
+ case GCM_PROPERTY_ID_RESOURCERESOLVER: aDefault <<= Reference< resource::XStringResourceResolver >(); break;
+ default: DBG_ERROR( "ImplGetDefaultValueByHandle - unknown Property" );
+ }
+
+ return aDefault;
+ }
+
+ //--------------------------------------------------------------------
+ ::com::sun::star::uno::Any OGeometryControlModel_Base::ImplGetPropertyValueByHandle(sal_Int32 nHandle) const
+ {
+ ::com::sun::star::uno::Any aValue;
+
+ switch ( nHandle )
+ {
+ case GCM_PROPERTY_ID_POS_X: aValue <<= m_nPosX; break;
+ case GCM_PROPERTY_ID_POS_Y: aValue <<= m_nPosY; break;
+ case GCM_PROPERTY_ID_WIDTH: aValue <<= m_nWidth; break;
+ case GCM_PROPERTY_ID_HEIGHT: aValue <<= m_nHeight; break;
+ case GCM_PROPERTY_ID_NAME: aValue <<= m_aName; break;
+ case GCM_PROPERTY_ID_TABINDEX: aValue <<= m_nTabIndex; break;
+ case GCM_PROPERTY_ID_STEP: aValue <<= m_nStep; break;
+ case GCM_PROPERTY_ID_TAG: aValue <<= m_aTag; break;
+ case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue <<= m_xStrResolver; break;
+ default: DBG_ERROR( "ImplGetPropertyValueByHandle - unknown Property" );
+ }
+
+ return aValue;
+ }
+
+ //--------------------------------------------------------------------
+ void OGeometryControlModel_Base::ImplSetPropertyValueByHandle(sal_Int32 nHandle, const :: com::sun::star::uno::Any& aValue)
+ {
+ switch ( nHandle )
+ {
+ case GCM_PROPERTY_ID_POS_X: aValue >>= m_nPosX; break;
+ case GCM_PROPERTY_ID_POS_Y: aValue >>= m_nPosY; break;
+ case GCM_PROPERTY_ID_WIDTH: aValue >>= m_nWidth; break;
+ case GCM_PROPERTY_ID_HEIGHT: aValue >>= m_nHeight; break;
+ case GCM_PROPERTY_ID_NAME: aValue >>= m_aName; break;
+ case GCM_PROPERTY_ID_TABINDEX: aValue >>= m_nTabIndex; break;
+ case GCM_PROPERTY_ID_STEP: aValue >>= m_nStep; break;
+ case GCM_PROPERTY_ID_TAG: aValue >>= m_aTag; break;
+ case GCM_PROPERTY_ID_RESOURCERESOLVER: aValue >>= m_xStrResolver; break;
+ default: DBG_ERROR( "ImplSetPropertyValueByHandle - unknown Property" );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL OGeometryControlModel_Base::queryAggregation( const Type& _rType ) throw(RuntimeException)
+ {
+ Any aReturn;
+ if (_rType.equals(::getCppuType(static_cast< Reference< XCloneable>* >(NULL))) && !m_bCloneable)
+ // somebody is asking for the XCloneable interface, but our aggregate does not support it
+ // -> outta here
+ // (need this extra check, cause OGCM_Base::queryAggregation would return this interface
+ // in every case)
+ return aReturn;
+
+ aReturn = OGCM_Base::queryAggregation(_rType);
+ // the basic interfaces (XInterface, XAggregation etc)
+
+ if (!aReturn.hasValue())
+ aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
+ // the property set related interfaces
+
+ if (!aReturn.hasValue() && m_xAggregate.is())
+ aReturn = m_xAggregate->queryAggregation(_rType);
+ // the interfaces our aggregate can provide
+
+ return aReturn;
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL OGeometryControlModel_Base::queryInterface( const Type& _rType ) throw(RuntimeException)
+ {
+ return OGCM_Base::queryInterface(_rType);
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGeometryControlModel_Base::acquire( ) throw()
+ {
+ OGCM_Base::acquire();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGeometryControlModel_Base::release( ) throw()
+ {
+ OGCM_Base::release();
+ }
+
+ //--------------------------------------------------------------------
+ void OGeometryControlModel_Base::releaseAggregation()
+ {
+ // release the aggregate (_before_ clearing m_xAggregate)
+ if (m_xAggregate.is())
+ m_xAggregate->setDelegator(NULL);
+ setAggregation(NULL);
+ }
+
+ //--------------------------------------------------------------------
+ OGeometryControlModel_Base::~OGeometryControlModel_Base()
+ {
+ releaseAggregation();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool SAL_CALL OGeometryControlModel_Base::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue,
+ sal_Int32 _nHandle, const Any& _rValue) throw (IllegalArgumentException)
+ {
+ return OPropertyContainer::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (Exception)
+ {
+ OPropertyContainer::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGeometryControlModel_Base::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
+ {
+ OPropertyArrayAggregationHelper& rPH = static_cast<OPropertyArrayAggregationHelper&>(const_cast<OGeometryControlModel_Base*>(this)->getInfoHelper());
+ ::rtl::OUString sPropName;
+ sal_Int32 nOriginalHandle = -1;
+
+ if (rPH.fillAggregatePropertyInfoByHandle(&sPropName, &nOriginalHandle, _nHandle))
+ OPropertySetAggregationHelper::getFastPropertyValue(_rValue, _nHandle);
+ else
+ OPropertyContainer::getFastPropertyValue(_rValue, _nHandle);
+ }
+
+ //--------------------------------------------------------------------
+ ::com::sun::star::beans::PropertyState OGeometryControlModel_Base::getPropertyStateByHandle(sal_Int32 nHandle)
+ {
+ ::com::sun::star::uno::Any aValue = ImplGetPropertyValueByHandle( nHandle );
+ ::com::sun::star::uno::Any aDefault = ImplGetDefaultValueByHandle( nHandle );
+
+ return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
+ }
+
+ //--------------------------------------------------------------------
+ void OGeometryControlModel_Base::setPropertyToDefaultByHandle(sal_Int32 nHandle)
+ {
+ ImplSetPropertyValueByHandle( nHandle , ImplGetDefaultValueByHandle( nHandle ) );
+ }
+
+ //--------------------------------------------------------------------
+ ::com::sun::star::uno::Any OGeometryControlModel_Base::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
+ {
+ return ImplGetDefaultValueByHandle( nHandle );
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XPropertySetInfo> SAL_CALL OGeometryControlModel_Base::getPropertySetInfo() throw(RuntimeException)
+ {
+ return OPropertySetAggregationHelper::createPropertySetInfo(getInfoHelper());
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL OGeometryControlModel_Base::createClone( ) throw(RuntimeException)
+ {
+ OSL_ENSURE(m_bCloneable, "OGeometryControlModel_Base::createClone: invalid call!");
+ if (!m_bCloneable)
+ return Reference< XCloneable >();
+
+ // let the aggregate create it's own clone
+ // the interface
+ Reference< XCloneable > xCloneAccess;
+ m_xAggregate->queryAggregation(::getCppuType(&xCloneAccess)) >>= xCloneAccess;
+ OSL_ENSURE(xCloneAccess.is(), "OGeometryControlModel_Base::createClone: suspicious aggregate!");
+ if (!xCloneAccess.is())
+ return Reference< XCloneable >();
+ // the aggregate's clone
+ Reference< XCloneable > xAggregateClone = xCloneAccess->createClone();
+ OSL_ENSURE(xAggregateClone.is(), "OGeometryControlModel_Base::createClone: suspicious return of the aggregate!");
+
+ // create a new wrapper aggregating this return value
+ OGeometryControlModel_Base* pOwnClone = createClone_Impl(xAggregateClone);
+ OSL_ENSURE(pOwnClone, "OGeometryControlModel_Base::createClone: invalid derivee behaviour!");
+ OSL_ENSURE(!xAggregateClone.is(), "OGeometryControlModel_Base::createClone: invalid ctor behaviour!");
+ // should have been reset
+
+ // set properties
+ pOwnClone->m_nPosX = m_nPosX;
+ pOwnClone->m_nPosY = m_nPosY;
+ pOwnClone->m_nWidth = m_nWidth;
+ pOwnClone->m_nHeight = m_nHeight;
+ pOwnClone->m_aName = m_aName;
+ pOwnClone->m_nTabIndex = m_nTabIndex;
+ pOwnClone->m_nStep = m_nStep;
+ pOwnClone->m_aTag = m_aTag;
+
+
+ // Clone event container
+ Reference< ::com::sun::star::script::XScriptEventsSupplier > xEventsSupplier =
+ static_cast< ::com::sun::star::script::XScriptEventsSupplier* >( this );
+ Reference< ::com::sun::star::script::XScriptEventsSupplier > xCloneEventsSupplier =
+ static_cast< ::com::sun::star::script::XScriptEventsSupplier* >( pOwnClone );
+
+ if( xEventsSupplier.is() && xCloneEventsSupplier.is() )
+ {
+ Reference< XNameContainer > xEventCont = xEventsSupplier->getEvents();
+ Reference< XNameContainer > xCloneEventCont = xCloneEventsSupplier->getEvents();
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aNames =
+ xEventCont->getElementNames();
+ const ::rtl::OUString* pNames = aNames.getConstArray();
+ sal_Int32 i, nNameCount = aNames.getLength();
+
+ for( i = 0 ; i < nNameCount ; i++ )
+ {
+ ::rtl::OUString aName = pNames[ i ];
+ ::com::sun::star::uno::Any aElement = xEventCont->getByName( aName );
+ xCloneEventCont->insertByName( aName, aElement );
+ }
+ }
+
+ return pOwnClone;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XNameContainer > SAL_CALL OGeometryControlModel_Base::getEvents() throw(RuntimeException)
+ {
+ if( !mxEventContainer.is() )
+ mxEventContainer = (XNameContainer*)new toolkit::ScriptEventContainer();
+ return mxEventContainer;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OGeometryControlModel_Base::disposing()
+ {
+ OGCM_Base::disposing();
+ OPropertySetAggregationHelper::disposing();
+
+ Reference<XComponent> xComp;
+ if ( query_aggregation( m_xAggregate, xComp ) )
+ xComp->dispose();
+ }
+
+ //====================================================================
+ //= OCommonGeometryControlModel
+ //====================================================================
+ //--------------------------------------------------------------------
+
+ typedef ::std::hash_map< ::rtl::OUString, sal_Int32, ::comphelper::UStringHash > HashMapString2Int;
+ typedef ::std::vector< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > > PropSeqArray;
+ typedef ::std::vector< ::std::vector< sal_Int32 > > IntArrayArray;
+
+ // for creating class-unique PropertySetInfo's, we need some info:
+ namespace { struct ServiceSpecifierMap : public rtl::Static< HashMapString2Int, ServiceSpecifierMap > {}; }
+ // this one maps from a String, which is the service specifier for our
+ // aggregate, to a unique id
+
+ namespace { struct AggregateProperties : public rtl::Static< PropSeqArray, AggregateProperties > {}; }
+ // this one contains the properties which belong to all the unique ids
+ // in ServiceSpecifierMap
+
+ namespace { struct AmbiguousPropertyIds : public rtl::Static< IntArrayArray, AmbiguousPropertyIds > {}; }
+ // the ids of the properties which we as well as our aggregate supply
+ // For such props, we let our base class handle them, and whenever such
+ // a prop is set, we forward this to our aggregate.
+
+ // With this, we can ensure that two instances of this class share the
+ // same PropertySetInfo if and only if both aggregates have the same
+ // service specifier.
+
+
+ //--------------------------------------------------------------------
+ OCommonGeometryControlModel::OCommonGeometryControlModel( Reference< XCloneable >& _rxAgg, const ::rtl::OUString& _rServiceSpecifier )
+ :OGeometryControlModel_Base( _rxAgg )
+ ,m_sServiceSpecifier( _rServiceSpecifier )
+ ,m_nPropertyMapId( 0 )
+ {
+ Reference< XPropertySetInfo > xPI;
+ if ( m_xAggregateSet.is() )
+ xPI = m_xAggregateSet->getPropertySetInfo();
+ if ( !xPI.is() )
+ {
+ releaseAggregation();
+ throw IllegalArgumentException();
+ }
+
+ HashMapString2Int &rMap = ServiceSpecifierMap::get();
+ HashMapString2Int::iterator aPropMapIdPos = rMap.find( m_sServiceSpecifier );
+ if ( rMap.end() == aPropMapIdPos )
+ {
+ PropSeqArray &rAggProperties = AggregateProperties::get();
+ m_nPropertyMapId = rAggProperties.size();
+ rAggProperties.push_back( xPI->getProperties() );
+ AmbiguousPropertyIds::get().push_back( IntArrayArray::value_type() );
+
+ rMap[ m_sServiceSpecifier ] = m_nPropertyMapId;
+ }
+ else
+ m_nPropertyMapId = aPropMapIdPos->second;
+ }
+
+ //--------------------------------------------------------------------
+ struct PropertyNameLess : public ::std::binary_function< Property, Property, bool >
+ {
+ bool operator()( const Property& _rLHS, const Property& _rRHS )
+ {
+ return _rLHS.Name < _rRHS.Name ? true : false;
+ }
+ };
+
+ //--------------------------------------------------------------------
+ struct PropertyNameEqual : public ::std::unary_function< Property, bool >
+ {
+ const ::rtl::OUString& m_rCompare;
+ PropertyNameEqual( const ::rtl::OUString& _rCompare ) : m_rCompare( _rCompare ) { }
+
+ bool operator()( const Property& _rLHS )
+ {
+ return _rLHS.Name == m_rCompare ? true : false;
+ }
+ };
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper* OCommonGeometryControlModel::createArrayHelper( sal_Int32 _nId ) const
+ {
+ OSL_ENSURE( _nId == m_nPropertyMapId, "OCommonGeometryControlModel::createArrayHelper: invalid argument!" );
+ OSL_ENSURE( _nId < (sal_Int32)AggregateProperties::get().size(), "OCommonGeometryControlModel::createArrayHelper: invalid status info (1)!" );
+ OSL_ENSURE( _nId < (sal_Int32)AmbiguousPropertyIds::get().size(), "OCommonGeometryControlModel::createArrayHelper: invalid status info (2)!" );
+
+ // our own properties
+ Sequence< Property > aProps;
+ OPropertyContainer::describeProperties( aProps );
+
+ // the aggregate properties
+ Sequence< Property > aAggregateProps;
+ aAggregateProps = AggregateProperties::get()[ _nId ];
+
+ // look for duplicates, and remember them
+ IntArrayArray::value_type& rDuplicateIds = AmbiguousPropertyIds::get()[ _nId ];
+ // for this, sort the aggregate properties
+ ::std::sort(
+ aAggregateProps.getArray(),
+ aAggregateProps.getArray() + aAggregateProps.getLength(),
+ PropertyNameLess()
+ );
+ const Property* pAggProps = aAggregateProps.getConstArray();
+ const Property* pAggPropsEnd = aAggregateProps.getConstArray() + aAggregateProps.getLength();
+
+ // now loop through our own props
+ const Property* pProp = aProps.getConstArray();
+ const Property* pPropEnd = aProps.getConstArray() + aProps.getLength();
+ while ( pProp < pPropEnd )
+ {
+ // look for the current property in the properties of our aggregate
+ const Property* pAggPropPos = ::std::find_if( pAggProps, pAggPropsEnd, PropertyNameEqual( pProp->Name ) );
+ if ( pAggPropPos != pAggPropsEnd )
+ { // found a duplicate
+ // -> remove from the aggregate property sequence
+ ::comphelper::removeElementAt( aAggregateProps, pAggPropPos - pAggProps );
+ // which means we have to adjust the pointers
+ pAggProps = aAggregateProps.getConstArray(),
+ pAggPropsEnd = aAggregateProps.getConstArray() + aAggregateProps.getLength(),
+
+ // and additionally, remember the id of this property
+ rDuplicateIds.push_back( pProp->Handle );
+ }
+
+ ++pProp;
+ }
+
+ // now, finally, sort the duplicates
+ ::std::sort( rDuplicateIds.begin(), rDuplicateIds.end(), ::std::less< sal_Int32 >() );
+
+ return new OPropertyArrayAggregationHelper(aProps, aAggregateProps);
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& SAL_CALL OCommonGeometryControlModel::getInfoHelper()
+ {
+ return *getArrayHelper( m_nPropertyMapId );
+ }
+
+ //--------------------------------------------------------------------
+ OGeometryControlModel_Base* OCommonGeometryControlModel::createClone_Impl( Reference< XCloneable >& _rxAggregateInstance )
+ {
+ return new OCommonGeometryControlModel( _rxAggregateInstance, m_sServiceSpecifier );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< sal_Int8 > SAL_CALL OCommonGeometryControlModel::getImplementationId( ) throw (RuntimeException)
+ {
+ static ::cppu::OImplementationId * pId = NULL;
+ if ( !pId )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if ( !pId )
+ {
+ static ::cppu::OImplementationId s_aId;
+ pId = &s_aId;
+ }
+ }
+ return pId->getImplementationId();
+ }
+
+ //--------------------------------------------------------------------
+ struct Int32Equal : public ::std::unary_function< sal_Int32, bool >
+ {
+ sal_Int32 m_nCompare;
+ Int32Equal( sal_Int32 _nCompare ) : m_nCompare( _nCompare ) { }
+
+ bool operator()( sal_Int32 _nLHS )
+ {
+ return _nLHS == m_nCompare ? true : false;
+ }
+ };
+
+ //--------------------------------------------------------------------
+ void SAL_CALL OCommonGeometryControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) throw ( Exception )
+ {
+ OGeometryControlModel_Base::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
+
+ // look if this id is one we recognized as duplicate
+ IntArrayArray::value_type& rDuplicateIds = AmbiguousPropertyIds::get()[ m_nPropertyMapId ];
+
+ IntArrayArray::value_type::const_iterator aPos = ::std::find_if(
+ rDuplicateIds.begin(),
+ rDuplicateIds.end(),
+ Int32Equal( _nHandle )
+ );
+
+ if ( rDuplicateIds.end() != aPos )
+ {
+ // yes, it is such a property
+ ::rtl::OUString sPropName;
+ sal_Int16 nAttributes(0);
+ static_cast< OPropertyArrayAggregationHelper* >( getArrayHelper( m_nPropertyMapId ) )->fillPropertyMembersByHandle( &sPropName, &nAttributes, _nHandle );
+
+ if ( m_xAggregateSet.is() && sPropName.getLength() )
+ m_xAggregateSet->setPropertyValue( sPropName, _rValue );
+ }
+ }
+
+//........................................................................
+// } // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
new file mode 100644
index 000000000000..fdf91d6a6593
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include "defaultgridcolumnmodel.hxx"
+#include <comphelper/sequence.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ref.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+#define COLUMNSELECTIONALLOWED ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ColumnSelectionAllowed" ))
+
+namespace toolkit
+{
+
+///////////////////////////////////////////////////////////////////////
+// class DefaultGridColumnModel
+///////////////////////////////////////////////////////////////////////
+
+DefaultGridColumnModel::DefaultGridColumnModel()
+: columns(std::vector< Reference< XGridColumn > >())
+{
+}
+
+//---------------------------------------------------------------------
+
+DefaultGridColumnModel::~DefaultGridColumnModel()
+{
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast( broadcast_type eType, const GridColumnEvent& aEvent )
+{
+ ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridColumnListener::static_type() );
+ if( pIter )
+ {
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XGridColumnListener* pListener = static_cast<XGridColumnListener*>(aListIter.next());
+ switch( eType )
+ {
+ case column_added: pListener->columnAdded(aEvent); break;
+ case column_removed: pListener->columnRemoved(aEvent); break;
+ case column_changed: pListener->columnChanged(aEvent); break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, name, oldValue, newValue, 0, NULL );
+ broadcast( column_changed, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast_add( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
+ broadcast( column_added, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridColumnModel::broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, rColumn );
+ broadcast( column_changed, aEvent);
+}
+
+//---------------------------------------------------------------------
+// XDefaultGridColumnModel
+//---------------------------------------------------------------------
+::sal_Bool SAL_CALL DefaultGridColumnModel::getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException)
+{
+ return selectionAllowed;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::setColumnSelectionAllowed(::sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Bool oldValue = selectionAllowed;
+ selectionAllowed = value;
+ broadcast_changed( COLUMNSELECTIONALLOWED, Any(oldValue) , Any(selectionAllowed));
+}
+
+//---------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
+{
+ return columns.size();
+}
+
+//---------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ columns.push_back(column);
+
+ sal_Int32 index = columns.size() - 1;
+ broadcast_add(index, column );
+ return index;
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL DefaultGridColumnModel::getColumns() throw (::com::sun::star::uno::RuntimeException)
+{
+ return comphelper::containerToSequence(columns);
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( index >=0 && index < ((sal_Int32)columns.size()))
+ return columns[index];
+ else
+ return Reference< XGridColumn >();
+}
+
+void SAL_CALL DefaultGridColumnModel::addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XGridColumnListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XGridColumnListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+// XComponent
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::dispose() throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ BrdcstHelper.aLC.disposeAndClear( aEvent );
+
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridColumnModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL DefaultGridColumnModel::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridColumnModel" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ServiceName.equalsAscii( szServiceName_DefaultGridColumnModel );
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+}
+
+Reference< XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel );
+}
+
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
new file mode 100644
index 000000000000..896427ce3e2b
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/awt/grid/GridColumnEvent.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <rtl/ref.hxx>
+#include <vector>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+enum broadcast_type { column_added, column_removed, column_changed};
+
+class DefaultGridColumnModel : public ::cppu::WeakImplHelper2< XGridColumnModel, XServiceInfo >,
+ public MutexAndBroadcastHelper
+{
+public:
+ DefaultGridColumnModel();
+ virtual ~DefaultGridColumnModel();
+
+ // XGridColumnModel
+
+ virtual ::sal_Bool SAL_CALL getColumnSelectionAllowed() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnSelectionAllowed(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & column) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > SAL_CALL getColumns() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL getColumn(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+private:
+
+ void broadcast( broadcast_type eType, const GridColumnEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
+ void broadcast_add( sal_Int32 index,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
+ void broadcast_remove( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > & rColumn );
+
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > columns;
+ sal_Bool selectionAllowed;
+};
+
+}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
new file mode 100644
index 000000000000..70c79e0bcbfa
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -0,0 +1,307 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include "defaultgriddatamodel.hxx"
+#include <comphelper/sequence.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ref.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+#define ROWHEIGHT ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeight" ))
+#define ROWHEADERS ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RowHeaders" ))
+
+namespace toolkit
+{
+
+///////////////////////////////////////////////////////////////////////
+// class DefaultGridDataModel
+///////////////////////////////////////////////////////////////////////
+
+DefaultGridDataModel::DefaultGridDataModel()
+: rowHeight(0),
+ rowHeaders(std::vector< ::rtl::OUString >())
+{
+}
+
+//---------------------------------------------------------------------
+
+DefaultGridDataModel::~DefaultGridDataModel()
+{
+}
+
+void DefaultGridDataModel::broadcast( broadcast_type eType, const GridDataEvent& aEvent )
+{
+ ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XGridDataListener::static_type() );
+ if( pIter )
+ {
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XGridDataListener* pListener = static_cast<XGridDataListener*>(aListIter.next());
+ switch( eType )
+ {
+ case row_added: pListener->rowAdded(aEvent); break;
+ case row_removed: pListener->rowRemoved(aEvent); break;
+ case data_changed: pListener->dataChanged(aEvent); break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridDataModel::broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridDataEvent aEvent( xSource, name, oldValue, newValue, 0, ::rtl::OUString(), Sequence< ::rtl::OUString>() );
+ broadcast( data_changed, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridDataModel::broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
+ broadcast( row_added, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+void DefaultGridDataModel::broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData )
+{
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridDataEvent aEvent( xSource, ::rtl::OUString(), Any(), Any(), index, headerName, rowData );
+ broadcast( row_removed, aEvent);
+}
+
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+// XDefaultGridDataModel
+//---------------------------------------------------------------------
+::sal_Int32 SAL_CALL DefaultGridDataModel::getRowHeight() throw (::com::sun::star::uno::RuntimeException)
+{
+ return rowHeight;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::setRowHeight(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 oldValue = rowHeight;
+ rowHeight = value;
+
+ broadcast_changed( ROWHEIGHT, Any(oldValue), Any(value) );
+}
+
+//---------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException)
+{
+ return data.size();
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getRowHeaders() throw (::com::sun::star::uno::RuntimeException)
+{
+ return comphelper::containerToSequence(rowHeaders);
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > oldValue( comphelper::containerToSequence(rowHeaders) );
+
+ std::vector< rtl::OUString>::iterator iterator;
+ int i = 0;
+ int sequenceSize = value.getLength();
+
+ for(iterator = rowHeaders.begin(); iterator != rowHeaders.end(); iterator++)
+ {
+ if ( sequenceSize > i )
+ *iterator = value[i];
+ else
+ *iterator = ::rtl::OUString();
+ i++;
+ }
+
+ broadcast_changed( ROWHEADERS, Any(oldValue), Any(comphelper::containerToSequence(rowHeaders)) );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rRowdata) throw (::com::sun::star::uno::RuntimeException)
+{
+ // store header name
+ rowHeaders.push_back(headername);
+
+
+ // store row data
+ std::vector< rtl::OUString > newRow(
+ comphelper::sequenceToContainer< std::vector<rtl::OUString > >(rRowdata));
+
+ data.push_back( newRow );
+
+ broadcast_add( data.size()-1, headername, rRowdata);
+
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ if ( index >= 0 && index <= getRowCount()-1)
+ {
+ /* if(Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index ))
+ {
+ ::com::sun::star::uno::Sequence<::sal_Int32> selectedRows = Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
+ selectedRow.erase(selectedRows.begin()+index);
+ }*/
+
+ ::rtl::OUString headerName( (::rtl::OUString) rowHeaders[index] );
+ rowHeaders.erase(rowHeaders.begin() + index);
+
+ Sequence< ::rtl::OUString >& rowData ( (Sequence< ::rtl::OUString >&)data[index] );
+ data.erase(data.begin() + index);
+ broadcast_remove( index, headerName, rowData);
+ }
+ else
+ return;
+}
+//---------------------------------------------------------------------
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL DefaultGridDataModel::getData() throw (::com::sun::star::uno::RuntimeException)
+{
+
+ std::vector< std::vector< ::rtl::OUString > >::iterator iterator;
+ std::vector< Sequence< ::rtl::OUString > > dummyContainer(0);
+
+
+ for(iterator = data.begin(); iterator != data.end(); iterator++)
+ {
+ Sequence< ::rtl::OUString > cols(comphelper::containerToSequence(*iterator));
+ dummyContainer.push_back( cols );
+ }
+ Sequence< Sequence< ::rtl::OUString > > dataSequence(comphelper::containerToSequence(dummyContainer));
+
+ return dataSequence;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XGridDataListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XGridDataListener::static_type(), xListener );
+}
+
+void SAL_CALL DefaultGridDataModel::removeAll() throw (RuntimeException)
+{
+ rowHeaders.clear();
+ data.clear();
+ broadcast_remove( -1, ::rtl::OUString(), 0);
+}
+
+//---------------------------------------------------------------------
+// XComponent
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::dispose() throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ BrdcstHelper.aLC.disposeAndClear( aEvent );
+
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL DefaultGridDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel );
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridDataModel ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+}
+
+Reference< XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridDataModel );
+}
+
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.hxx b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
new file mode 100644
index 000000000000..1aebc07bc2a8
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -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_toolkit.hxx"
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/GridDataEvent.hpp>
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <rtl/ref.hxx>
+#include <vector>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+enum broadcast_type { row_added, row_removed, data_changed};
+
+class DefaultGridDataModel : public ::cppu::WeakImplHelper2< XGridDataModel, XServiceInfo >,
+ public MutexAndBroadcastHelper
+{
+public:
+ DefaultGridDataModel();
+ virtual ~DefaultGridDataModel();
+
+ // XGridDataModel
+ virtual ::sal_Int32 SAL_CALL getRowHeight() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowHeight(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowHeaders() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowHeaders(const ::com::sun::star::uno::Sequence< ::rtl::OUString > & value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRow(const ::rtl::OUString & headername, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & data) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeDataListener( const Reference< XGridDataListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeAll() throw (RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+private:
+
+ void broadcast( broadcast_type eType, const GridDataEvent& aEvent );
+ void broadcast_changed( ::rtl::OUString name, Any oldValue, Any newValue );
+ void broadcast_add( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
+ void broadcast_remove( sal_Int32 index, const ::rtl::OUString & headerName, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rowData );
+
+ sal_Int32 rowHeight;
+ std::vector< std::vector < ::rtl::OUString > > data;
+ std::vector< ::rtl::OUString > rowHeaders;
+};
+
+}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
new file mode 100644
index 000000000000..39c4960351d3
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include "gridcolumn.hxx"
+#include <comphelper/sequence.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ref.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+///////////////////////////////////////////////////////////////////////
+// class GridColumn
+///////////////////////////////////////////////////////////////////////
+
+GridColumn::GridColumn()
+: identifier(Any())
+{
+}
+
+//---------------------------------------------------------------------
+
+GridColumn::~GridColumn()
+{
+}
+
+//---------------------------------------------------------------------
+
+//---------------------------------------------------------------------
+// XGridColumn
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException)
+{
+ return identifier;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException)
+{
+ value >>= identifier;
+}
+
+//--------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
+{
+ return columnWidth;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+{
+ columnWidth = value;
+}
+
+//--------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ return title;
+}
+
+//--------------------------------------------------------------------
+
+void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
+{
+ title = value;
+}
+
+//---------------------------------------------------------------------
+// XComponent
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::dispose() throw (RuntimeException)
+{
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ (void) xListener;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL GridColumn::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ (void) xListener;
+}
+
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+::rtl::OUString SAL_CALL GridColumn::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.GridColumn" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL GridColumn::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ServiceName.equalsAscii( szServiceName_GridColumn );
+}
+
+//---------------------------------------------------------------------
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aServiceName( OUString::createFromAscii( szServiceName_GridColumn ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+}
+
+Reference< XInterface > SAL_CALL GridColumn_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::GridColumn );
+}
+
diff --git a/toolkit/source/controls/grid/gridcolumn.hxx b/toolkit/source/controls/grid/gridcolumn.hxx
new file mode 100644
index 000000000000..7f6d104127ec
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/grid/XGridColumn.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <rtl/ref.hxx>
+#include <vector>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+class GridColumn : public ::cppu::WeakImplHelper2< XGridColumn, XServiceInfo >,
+ public MutexAndBroadcastHelper
+{
+public:
+ GridColumn();
+ virtual ~GridColumn();
+
+ // XGridColumn
+ virtual ::com::sun::star::uno::Any SAL_CALL getIdentifier() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTitle() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+
+private:
+ Any identifier;
+ sal_Int32 columnWidth;
+ ::rtl::OUString title;
+};
+
+}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
new file mode 100644
index 000000000000..f19648ab0af2
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <gridcontrol.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt::grid;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+
+namespace toolkit
+{
+// ----------------------------------------------------
+// class UnoGridModel
+// ----------------------------------------------------
+UnoGridModel::UnoGridModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_SIZEABLE ); // resizeable
+ ImplRegisterProperty( BASEPROPERTY_HSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_VSCROLL );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
+ ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL );
+ ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
+
+}
+
+UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
+: UnoControlModel( rModel )
+{
+}
+
+UnoControlModel* UnoGridModel::Clone() const
+{
+ return new UnoGridModel( *this );
+}
+
+OUString UnoGridModel::getServiceName() throw(RuntimeException)
+{
+ return OUString::createFromAscii( szServiceName_GridControlModel );
+}
+
+Any UnoGridModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_GridControl ) );
+ case BASEPROPERTY_GRID_SELECTIONMODE:
+ return uno::makeAny( SelectionType(1) );
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+}
+
+::cppu::IPropertyArrayHelper& UnoGridModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// XMultiPropertySet
+Reference< XPropertySetInfo > UnoGridModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoGridControl
+// ----------------------------------------------------
+UnoGridControl::UnoGridControl()
+: mSelectionMode(SelectionType(1))
+{
+}
+
+OUString UnoGridControl::GetComponentServiceName()
+{
+ return OUString::createFromAscii( "Grid" );
+}
+
+void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
+{
+ UnoControl::dispose();
+}
+
+void UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
+
+ Reference<XGridDataListener> xListener ( getPeer(), UNO_QUERY_THROW );
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+
+ Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
+ xGridDataModel->addDataListener(xListener);
+}
+
+
+// -------------------------------------------------------------------
+// XGridControl
+// -------------------------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL UnoGridControl::getColumnModel() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ Reference<XGridColumnModel> xGridColumnModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "ColumnModel" )), UNO_QUERY_THROW );
+
+ return xGridColumnModel;
+}
+
+void SAL_CALL UnoGridControl::setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue(OUString::createFromAscii( "ColumnModel" ), Any (model));
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL UnoGridControl::getDataModel() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ Reference<XGridDataModel> xGridDataModel ( xPropSet->getPropertyValue(OUString::createFromAscii( "GridDataModel" )), UNO_QUERY_THROW );
+
+ return xGridDataModel;
+}
+
+void SAL_CALL UnoGridControl::setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference<XPropertySet> xPropSet ( getModel(), UNO_QUERY_THROW );
+ xPropSet->setPropertyValue(OUString::createFromAscii( "GridDataModel" ), Any(model));
+}
+
+::sal_Int32 UnoGridControl::getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getItemIndexAtPoint( x, y );
+}
+
+/*
+void SAL_CALL UnoGridControl::addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addMouseListener( listener );
+}
+
+void SAL_CALL UnoGridControl::removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeMouseListener( listener );
+}
+*/
+// -------------------------------------------------------------------
+// XGridSelection
+// -------------------------------------------------------------------
+
+::sal_Int32 SAL_CALL UnoGridControl::getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMinSelectionIndex();
+}
+
+::sal_Int32 SAL_CALL UnoGridControl::getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getMaxSelectionIndex();
+}
+
+void SAL_CALL UnoGridControl::insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->insertIndexIntervall( start, length);
+}
+
+void SAL_CALL UnoGridControl::removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeIndexIntervall( start, length );
+}
+
+::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL UnoGridControl::getSelection() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
+}
+
+::sal_Bool SAL_CALL UnoGridControl::isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectionEmpty();
+}
+
+::sal_Bool SAL_CALL UnoGridControl::isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException)
+{
+ return Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->isSelectedIndex( index );
+}
+
+void SAL_CALL UnoGridControl::selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( y );
+}
+
+void SAL_CALL UnoGridControl::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->addSelectionListener( listener );
+}
+
+void SAL_CALL UnoGridControl::removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->removeSelectionListener( listener );
+}
+}
+
+Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl );
+}
+
+Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel );
+}
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
new file mode 100644
index 000000000000..4195a1f624e5
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcontrol.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 TOOLKIT_GRID_CONTROL_HXX
+#define TOOLKIT_GRID_CONTROL_HXX
+
+#include <com/sun/star/awt/grid/XGridControl.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+namespace toolkit {
+
+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::container;
+
+// ===================================================================
+// = UnoGridModel
+// ===================================================================
+class UnoGridModel : public UnoControlModel
+{
+protected:
+ Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoGridModel();
+ UnoGridModel( const UnoGridModel& rModel );
+
+ UnoControlModel* Clone() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel )
+};
+
+
+// ===================================================================
+// = UnoGridControl
+// ===================================================================
+class UnoGridControl : public ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::grid::XGridControl >
+{
+public:
+ UnoGridControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XGridControl
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > SAL_CALL getColumnModel() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnModel > & model) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > SAL_CALL getDataModel() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataModel > & model) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getItemIndexAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ //virtual void SAL_CALL addMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ //virtual void SAL_CALL removeMouseListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XGridSelection
+
+ virtual ::sal_Int32 SAL_CALL getMinSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMaxSelectionIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeIndexIntervall(::sal_Int32 start, ::sal_Int32 length) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int32 > SAL_CALL getSelection() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isSelectionEmpty() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isSelectedIndex(::sal_Int32 index) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectRow(::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoGridControl, UnoControlBase, szServiceName_GridControl )
+
+ using UnoControl::getPeer;
+private:
+ ::com::sun::star::view::SelectionType mSelectionMode;
+};
+
+} // toolkit
+
+#endif // _TOOLKIT_TREE_CONTROL_HXX
diff --git a/toolkit/source/controls/grid/makefile.mk b/toolkit/source/controls/grid/makefile.mk
new file mode 100644
index 000000000000..70bfc34b9d02
--- /dev/null
+++ b/toolkit/source/controls/grid/makefile.mk
@@ -0,0 +1,50 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=toolkit
+TARGET=grid
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/gridcontrol.obj\
+ $(SLO)$/defaultgriddatamodel.obj\
+ $(SLO)$/defaultgridcolumnmodel.obj\
+ $(SLO)$/gridcolumn.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/controls/makefile.mk b/toolkit/source/controls/makefile.mk
new file mode 100644
index 000000000000..1ce9f7b22c8c
--- /dev/null
+++ b/toolkit/source/controls/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=controls
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/accessiblecontrolcontext.obj \
+ $(SLO)$/geometrycontrolmodel.obj \
+ $(SLO)$/eventcontainer.obj \
+ $(SLO)$/stdtabcontroller.obj \
+ $(SLO)$/stdtabcontrollermodel.obj \
+ $(SLO)$/unocontrol.obj \
+ $(SLO)$/unocontrolbase.obj \
+ $(SLO)$/unocontrolcontainer.obj \
+ $(SLO)$/unocontrolcontainermodel.obj \
+ $(SLO)$/unocontrolmodel.obj \
+ $(SLO)$/unocontrols.obj \
+ $(SLO)$/formattedcontrol.obj \
+ $(SLO)$/roadmapcontrol.obj \
+ $(SLO)$/roadmapentry.obj \
+ $(SLO)$/dialogcontrol.obj \
+ $(SLO)$/tkscrollbar.obj \
+ $(SLO)$/tkspinbutton.obj \
+ $(SLO)$/tksimpleanimation.obj \
+ $(SLO)$/tkthrobber.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx
new file mode 100644
index 000000000000..acfbee0c5bb6
--- /dev/null
+++ b/toolkit/source/controls/roadmapcontrol.cxx
@@ -0,0 +1,589 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+#ifndef _TOOLKIT_ROADMAP_CONTROL_HXX
+#include <toolkit/controls/roadmapcontrol.hxx>
+#endif
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ 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::container;
+
+// ----------------------------------------------------
+// helper
+// ----------------------------------------------------
+
+ static void lcl_knitImageComponents( const Reference< XControlModel >& _rxModel,
+ const Reference< XWindowPeer >& _rxPeer,
+ bool _bAdd )
+ {
+ Reference< XImageProducer > xProducer( _rxModel, UNO_QUERY );
+ if ( xProducer.is() )
+ {
+ Reference< XImageConsumer > xConsumer( _rxPeer, UNO_QUERY );
+ if ( xConsumer.is() )
+ {
+ if ( _bAdd )
+ {
+ xProducer->addConsumer( xConsumer );
+ xProducer->startProduction();
+ }
+ else
+ xProducer->removeConsumer( xConsumer );
+ }
+ }
+ }
+
+static void lcl_throwIllegalArgumentException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw IllegalArgumentException();
+}
+
+static void lcl_throwIndexOutOfBoundsException( )
+{ // throwing is expensive (in terms of code size), thus we hope the compiler does not inline this ....
+ throw IndexOutOfBoundsException();
+}
+
+ // ===================================================================
+ // = UnoControlRoadmapModel
+ // ===================================================================
+ // -------------------------------------------------------------------
+ UnoControlRoadmapModel::UnoControlRoadmapModel() : maContainerListeners( *this )
+ {
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_COMPLETE );
+ ImplRegisterProperty( BASEPROPERTY_ACTIVATED );
+ ImplRegisterProperty( BASEPROPERTY_CURRENTITEMID );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ }
+
+ // -------------------------------------------------------------------
+ ::rtl::OUString UnoControlRoadmapModel::getServiceName() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlRoadmapModel );
+ }
+
+
+ // -------------------------------------------------------------------
+ Any UnoControlRoadmapModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+ {
+ Any aReturn;
+ switch (nPropId)
+ {
+ case BASEPROPERTY_COMPLETE:
+ aReturn <<= (sal_Bool) sal_True;
+ break;
+ case BASEPROPERTY_ACTIVATED:
+ aReturn <<= (sal_Bool) sal_True;
+ break;
+ case BASEPROPERTY_CURRENTITEMID:
+ aReturn <<= (sal_Int16) -1;
+ break;
+ case BASEPROPERTY_TEXT:
+ break;
+ case BASEPROPERTY_BORDER:
+ aReturn <<= (sal_Int16) 2; // No Border
+ break;
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aReturn <<= ::rtl::OUString( ::rtl::OUString::createFromAscii( szServiceName_UnoControlRoadmap ) );
+ break;
+ default : aReturn = UnoControlModel::ImplGetDefaultValue( nPropId ); break;
+ }
+
+ return aReturn;
+ }
+
+
+ Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstance( ) throw (Exception, ::com::sun::star::uno::RuntimeException)
+ {
+ ORoadmapEntry* pRoadmapItem = new ORoadmapEntry();
+ Reference< XInterface > xNewRoadmapItem = (::cppu::OWeakObject*)pRoadmapItem;
+ return xNewRoadmapItem;
+ }
+
+
+ Reference< XInterface > SAL_CALL UnoControlRoadmapModel::createInstanceWithArguments( const Sequence< Any >& /*aArguments*/ ) throw (Exception, RuntimeException)
+ {
+ // Todo: implementation of the arguments handling
+ ORoadmapEntry* pRoadmapItem = new ORoadmapEntry();
+ Reference< XInterface > xNewRoadmapItem = (::cppu::OWeakObject*)pRoadmapItem;
+ return xNewRoadmapItem;
+ }
+
+
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, UnoControlRoadmapModel_IBase )
+
+
+ // -------------------------------------------------------------------
+ ::com::sun::star::uno::Any SAL_CALL UnoControlRoadmapModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ Any aRet = UnoControlRoadmapModel_Base::queryAggregation( rType );
+ if ( !aRet.hasValue() )
+ aRet = UnoControlRoadmapModel_IBase::queryInterface( rType );
+ return aRet;
+ }
+
+
+ // -------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& UnoControlRoadmapModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+
+ // beans::XMultiPropertySet
+ // -------------------------------------------------------------------
+ Reference< XPropertySetInfo > UnoControlRoadmapModel::getPropertySetInfo( ) throw(RuntimeException)
+ {
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+
+ sal_Int32 SAL_CALL UnoControlRoadmapModel::getCount() throw(RuntimeException)
+ {
+ return maRoadmapItems.size();
+ }
+
+ Any SAL_CALL UnoControlRoadmapModel::getByIndex( sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+ {
+ if (( Index >= (sal_Int32)maRoadmapItems.size()) || (Index < 0))
+ lcl_throwIndexOutOfBoundsException( );
+ Any aAny;
+ aAny = makeAny( maRoadmapItems.at( Index ));
+ return aAny;
+ }
+
+
+
+ void UnoControlRoadmapModel::MakeRMItemValidation( sal_Int32 Index, Reference< XInterface > xRoadmapItem )
+ {
+ if ((Index > (sal_Int32)maRoadmapItems.size()) || ( Index < 0 ) )
+ lcl_throwIndexOutOfBoundsException( );
+ if ( !xRoadmapItem.is() )
+ lcl_throwIllegalArgumentException();
+ Reference< XServiceInfo > xServiceInfo( xRoadmapItem, UNO_QUERY );
+ sal_Bool bIsRoadmapItem = xServiceInfo->supportsService( ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" ) );
+ if ( !bIsRoadmapItem )
+ lcl_throwIllegalArgumentException();
+ }
+
+
+ void UnoControlRoadmapModel::SetRMItemDefaultProperties( const sal_Int32 , Reference< XInterface > xRoadmapItem)
+ {
+ Any aAny;
+ Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY );
+ Reference< XPropertySet > xProps( xRoadmapItem, UNO_QUERY );
+ if ( xProps.is() )
+ {
+ sal_Int32 LocID = 0;
+ Any aValue = xPropertySet->getPropertyValue( ::rtl::OUString::createFromAscii( "ID" ) );
+ aValue >>= LocID;
+ if (LocID < 0) // index may not be smaller than zero
+ {
+ aAny <<= GetUniqueID();
+ xPropertySet->setPropertyValue( ::rtl::OUString::createFromAscii( "ID" ), aAny );
+ }
+ }
+ }
+
+
+// The performance of this method could certainly be improved.
+// As long as only vectors with up to 10 elements are
+// involved it should be sufficient
+ sal_Int32 UnoControlRoadmapModel::GetUniqueID()
+ {
+ Any aAny;
+ sal_Bool bIncrement = sal_True;
+ sal_Int32 CurID = 0;
+ sal_Int32 n_CurItemID = 0;
+ Reference< XInterface > CurRoadmapItem;
+ while ( bIncrement )
+ {
+ bIncrement = sal_False;
+ for ( RoadmapItemHolderList::iterator i = maRoadmapItems.begin(); i < maRoadmapItems.end(); i++ )
+ {
+ CurRoadmapItem = *i;
+ Reference< XPropertySet > xPropertySet( CurRoadmapItem, UNO_QUERY );
+ aAny = xPropertySet->getPropertyValue( ::rtl::OUString::createFromAscii( "ID" ) );
+ aAny >>= n_CurItemID;
+ if (n_CurItemID == CurID)
+ {
+ bIncrement = sal_True;
+ CurID++;
+ break;
+ }
+ }
+ }
+ return CurID;
+ }
+
+
+ ContainerEvent UnoControlRoadmapModel::GetContainerEvent(sal_Int32 Index, Reference< XInterface > xRoadmapItem)
+ {
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= xRoadmapItem;
+ aEvent.Accessor = makeAny(Index);
+ return aEvent;
+ }
+
+
+ sal_Int16 UnoControlRoadmapModel::GetCurrentItemID( Reference< XPropertySet > xPropertySet )
+ {
+ Any aAny = xPropertySet->getPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ) );
+ sal_Int16 n_CurrentItemID = 0;
+ aAny >>= n_CurrentItemID;
+ return n_CurrentItemID;
+ }
+
+
+ void SAL_CALL UnoControlRoadmapModel::insertByIndex( const sal_Int32 Index, const Any& _Element)
+ throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+ {
+ if ( ( Index >= ( (sal_Int32)maRoadmapItems.size() + 1 ) ) || (Index < 0))
+ lcl_throwIndexOutOfBoundsException( );
+ Reference< XInterface > xRoadmapItem;
+ _Element >>= xRoadmapItem;
+ MakeRMItemValidation( Index, xRoadmapItem);
+ SetRMItemDefaultProperties( Index, xRoadmapItem );
+ maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem);
+ ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
+ maContainerListeners.elementInserted( aEvent );
+ Reference< XPropertySet > xPropertySet( (XAggregation*) (::cppu::OWeakAggObject*)this, UNO_QUERY );
+ sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet );
+ if ( Index <= n_CurrentItemID )
+ {
+ Any aAny;
+ aAny <<= ( sal_Int16 ) ( n_CurrentItemID + 1 );
+ xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
+ }
+ }
+
+
+
+ void SAL_CALL UnoControlRoadmapModel::removeByIndex( sal_Int32 Index)
+ throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+ {
+ if (( Index > (sal_Int32)maRoadmapItems.size()) || (Index < 0))
+ lcl_throwIndexOutOfBoundsException( );
+ Reference< XInterface > xRoadmapItem;
+ maRoadmapItems.erase( maRoadmapItems.begin() + Index );
+ ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
+ maContainerListeners.elementRemoved( aEvent );
+ Reference< XPropertySet > xPropertySet( (XAggregation*) (::cppu::OWeakAggObject*)this, UNO_QUERY );
+ sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet );
+ Any aAny;
+ if ( Index <= n_CurrentItemID )
+ {
+ if ( n_CurrentItemID >= (sal_Int32)maRoadmapItems.size() )
+ {
+ n_CurrentItemID = sal::static_int_cast< sal_Int16 >(
+ maRoadmapItems.size()-1);
+ if ( n_CurrentItemID < 0 )
+ return;
+ aAny <<= n_CurrentItemID;
+ }
+ else if (Index == n_CurrentItemID)
+ aAny <<= ( sal_Int16 ) -1;
+ else if( Index < n_CurrentItemID)
+ aAny <<= ( sal_Int16 ) ( n_CurrentItemID - 1 );
+ xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
+ }
+ }
+
+
+ void SAL_CALL UnoControlRoadmapModel::replaceByIndex( const sal_Int32 Index, const Any& _Element)
+ throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
+ {
+ Reference< XInterface > xRoadmapItem;
+ _Element >>= xRoadmapItem;
+ MakeRMItemValidation( Index, xRoadmapItem);
+ SetRMItemDefaultProperties( Index, xRoadmapItem );
+ maRoadmapItems.erase( maRoadmapItems.begin() + Index );
+ maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem); //push_back( xRoadmapItem );
+ ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem);
+ maContainerListeners.elementReplaced( aEvent );
+ }
+
+
+ Type SAL_CALL UnoControlRoadmapModel::getElementType() throw(RuntimeException)
+ {
+ Type aType = getCppuType( ( Reference< XPropertySet>* ) NULL );
+ return aType;
+ }
+
+
+ sal_Bool SAL_CALL UnoControlRoadmapModel::hasElements() throw(RuntimeException)
+ {
+ return !maRoadmapItems.empty();
+ }
+
+
+ void SAL_CALL UnoControlRoadmapModel::addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ maContainerListeners.addInterface( xListener );
+ }
+
+ void SAL_CALL UnoControlRoadmapModel::removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ maContainerListeners.removeInterface( xListener );
+ }
+
+
+ void UnoControlRoadmapModel::addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ maImageListeners.push_back( xConsumer );
+ }
+
+
+ void UnoControlRoadmapModel::removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ maImageListeners.remove( xConsumer );
+ }
+
+
+ void UnoControlRoadmapModel::startProduction( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ Sequence<Any> aArgs(1);
+ aArgs.getArray()[0] = getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) );
+ Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ Reference< XImageProducer > xImageProducer( xMSF->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ImageProducer" ), aArgs ), UNO_QUERY );
+ if ( xImageProducer.is() )
+ {
+ std::list< Reference< XImageConsumer > >::iterator aIter( maImageListeners.begin() );
+ while ( aIter != maImageListeners.end() )
+ {
+ xImageProducer->addConsumer( *aIter );
+ aIter++;
+ }
+ xImageProducer->startProduction();
+ }
+ }
+
+
+
+
+ // ===================================================================
+ // = UnoRoadmapControl
+ // ===================================================================
+ // -------------------------------------------------------------------
+ UnoRoadmapControl::UnoRoadmapControl(): maItemListeners( *this )
+ {
+ }
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase )
+IMPLEMENT_FORWARD_XINTERFACE2( UnoRoadmapControl, UnoControlRoadmap_Base, UnoControlRoadmap_IBase )
+
+
+sal_Bool SAL_CALL UnoRoadmapControl::setModel(const Reference< XControlModel >& _rModel) throw ( RuntimeException )
+ {
+
+
+ // remove the peer as image consumer from the model
+ lcl_knitImageComponents( getModel(), getPeer(), false );
+
+ Reference< XContainer > xC( getModel(), UNO_QUERY );
+ if ( xC.is() )
+ xC->removeContainerListener( this );
+
+ sal_Bool bReturn = UnoControlBase::setModel( _rModel );
+
+ xC = xC.query( getModel());
+ if ( xC.is() )
+ xC->addContainerListener( this );
+
+ // add the peer as image consumer to the model
+ lcl_knitImageComponents( getModel(), getPeer(), true );
+
+ return bReturn;
+ }
+
+
+ // -------------------------------------------------------------------
+ ::rtl::OUString UnoRoadmapControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "Roadmap" );
+ }
+
+
+
+ void SAL_CALL UnoRoadmapControl::createPeer( const Reference<XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+ {
+ // remove the peer as image consumer from the model
+ lcl_knitImageComponents( getModel(), getPeer(), false );
+
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ lcl_knitImageComponents( getModel(), getPeer(), true );
+
+ }
+
+
+ void UnoRoadmapControl::dispose() throw(RuntimeException)
+ {
+ EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+ }
+
+
+
+void UnoRoadmapControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal )
+{
+ sal_uInt16 nType = GetPropertyId( rPropName );
+ if ( getPeer().is() && ( nType == BASEPROPERTY_IMAGEURL ) )
+ {
+ Reference < XImageProducer > xImgProd( getModel(), UNO_QUERY );
+ Reference < XImageConsumer > xImgCons( getPeer(), UNO_QUERY );
+
+ if ( xImgProd.is() && xImgCons.is() )
+ {
+ xImgProd->startProduction();
+ }
+ }
+ else
+ UnoControlBase::ImplSetPeerProperty( rPropName, rVal );
+}
+
+
+void UnoRoadmapControl::elementInserted( const ContainerEvent& rEvent )throw(RuntimeException)
+{
+ Reference< XInterface > xRoadmapItem;
+ rEvent.Element >>= xRoadmapItem;
+ Reference< XPropertySet > xRoadmapPropertySet( xRoadmapItem, UNO_QUERY );
+ if ( xRoadmapPropertySet.is() )
+ xRoadmapPropertySet->addPropertyChangeListener( rtl::OUString(), this );
+
+ Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY);
+ if ( xPeer.is() )
+ {
+ xPeer->elementInserted( rEvent );
+ Reference < XPropertySet > xPropertySet( xPeer, UNO_QUERY );
+ if ( xPropertySet.is() )
+ xPropertySet->addPropertyChangeListener( rtl::OUString(), this );
+ }
+}
+
+
+void UnoRoadmapControl::elementRemoved( const ContainerEvent& rEvent )throw(RuntimeException)
+{
+ Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY);
+ if ( xPeer.is() )
+ xPeer->elementRemoved( rEvent );
+ Reference< XInterface > xRoadmapItem;
+ rEvent.Element >>= xRoadmapItem;
+ Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY );
+ if ( xPropertySet.is() )
+ xPropertySet->removePropertyChangeListener( rtl::OUString(), this );
+}
+
+
+void UnoRoadmapControl::elementReplaced( const ContainerEvent& rEvent )throw(RuntimeException)
+{
+ Reference< XContainerListener > xPeer(getPeer(), UNO_QUERY);
+ if ( xPeer.is() )
+ xPeer->elementReplaced( rEvent );
+}
+
+
+void SAL_CALL UnoRoadmapControl::itemStateChanged( const ItemEvent& rEvent ) throw (RuntimeException)
+{
+ sal_Int16 CurItemIndex = sal::static_int_cast< sal_Int16 >(rEvent.ItemId);
+ Any aAny;
+ aAny <<= CurItemIndex;
+ Reference< XControlModel > xModel( getModel( ), UNO_QUERY );
+ Reference< XPropertySet > xPropertySet( xModel, UNO_QUERY );
+ xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), aAny );
+ if ( maItemListeners.getLength() )
+ maItemListeners.itemStateChanged( rEvent );
+}
+
+
+void SAL_CALL UnoRoadmapControl::addItemListener( const Reference< XItemListener >& l ) throw (RuntimeException)
+{
+ maItemListeners.addInterface( l );
+ if( getPeer().is() && maItemListeners.getLength() == 1 )
+ {
+ Reference < XItemEventBroadcaster > xRoadmap( getPeer(), UNO_QUERY );
+ xRoadmap->addItemListener( this );
+ }
+}
+
+
+void SAL_CALL UnoRoadmapControl::removeItemListener( const Reference< XItemListener >& l ) throw (RuntimeException)
+{
+ if( getPeer().is() && maItemListeners.getLength() == 1 )
+ {
+ Reference < XItemEventBroadcaster > xRoadmap( getPeer(), UNO_QUERY );
+ xRoadmap->removeItemListener( this );
+ }
+
+ maItemListeners.removeInterface( l );
+}
+
+
+void SAL_CALL UnoRoadmapControl::propertyChange( const PropertyChangeEvent& evt ) throw (RuntimeException)
+{
+ Reference< XPropertyChangeListener > xPeer(getPeer(), UNO_QUERY);
+ if ( xPeer.is() )
+ xPeer->propertyChange( evt );
+}
+
+}
+
diff --git a/toolkit/source/controls/roadmapentry.cxx b/toolkit/source/controls/roadmapentry.cxx
new file mode 100644
index 000000000000..fb760e404b93
--- /dev/null
+++ b/toolkit/source/controls/roadmapentry.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <toolkit/controls/roadmapentry.hxx>
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/OUString.hxx>
+#endif
+
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+
+ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
+ ,OPropertyContainer( GetBroadcastHelper() )
+{
+ // registerProperty or registerMayBeVoidProperty or registerPropertyNoMember
+
+ registerProperty( ::rtl::OUString::createFromAscii( "Label" ), RM_PROPERTY_ID_LABEL,
+ ::com::sun::star::beans::PropertyAttribute::BOUND |
+ ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
+ & m_sLabel, ::getCppuType( &m_sLabel ) );
+ m_nID = -1;
+ registerProperty( ::rtl::OUString::createFromAscii( "ID" ), RM_PROPERTY_ID_ID,
+ ::com::sun::star::beans::PropertyAttribute::BOUND |
+ ::com::sun::star::beans::PropertyAttribute::CONSTRAINED,
+ & m_nID, ::getCppuType( &m_nID ) );
+ m_bEnabled = sal_True;
+ registerProperty( ::rtl::OUString::createFromAscii( "Enabled" ), RM_PROPERTY_ID_ENABLED,
+ ::com::sun::star::beans::PropertyAttribute::BOUND |
+ ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
+ & m_bEnabled, ::getCppuType( &m_bEnabled ) );
+
+ registerProperty( ::rtl::OUString::createFromAscii( "Interactive" ), RM_PROPERTY_ID_INTERACTIVE,
+ ::com::sun::star::beans::PropertyAttribute::BOUND |
+ ::com::sun::star::beans::PropertyAttribute::MAYBEDEFAULT,
+ & m_bInteractive, ::getCppuType( &m_bInteractive ) );
+
+
+ // ...
+
+ // Note that the list of registered properties has to be fixed: Different
+ // instances of this class have to register the same set of properties with
+ // the same attributes.
+ //
+ // This is because all instances of the class share the same PropertySetInfo
+ // which has been built from the registered property of _one_ instance.
+}
+
+//--------------------------------------------------------------------------
+IMPLEMENT_FORWARD_XINTERFACE2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( ORoadmapEntry, ORoadmapEntry_Base, ::comphelper::OPropertyContainer );
+ // order matters:
+ // the first is the class name
+ // the second is the class which implements the ref-counting
+ // the third up to n-th (when using IMPLEMENT_FORWARD_*3 and so on) are other base classes
+ // whose XInterface and XTypeProvider implementations should be merged
+
+//--------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star:: beans::XPropertySetInfo > SAL_CALL
+ ORoadmapEntry::getPropertySetInfo()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >(
+ createPropertySetInfo( getInfoHelper() ) );
+}
+
+::rtl::OUString SAL_CALL ORoadmapEntry::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString aStr = ::rtl::OUString::createFromAscii("com.sun.star.comp.toolkit.RoadmapItem");
+ return aStr;
+}
+
+sal_Bool SAL_CALL ORoadmapEntry::supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return ServiceName.equals( ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" ) );
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1);
+ ::rtl::OUString* pArray = aRet.getArray();
+ pArray[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.RoadmapItem" );
+ return aRet;
+}
+//--------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& ORoadmapEntry::getInfoHelper()
+{
+ return *getArrayHelper();
+}
+
+//--------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper* ORoadmapEntry::createArrayHelper() const
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
+ // describes all properties which have been registered in the ctor
+ describeProperties( aProps );
+
+ return new ::cppu::OPropertyArrayHelper( aProps );
+}
diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx
new file mode 100644
index 000000000000..012a7bc0a084
--- /dev/null
+++ b/toolkit/source/controls/stdtabcontroller.cxx
@@ -0,0 +1,428 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/controls/stdtabcontrollermodel.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <tools/debug.hxx>
+#include <vcl/window.hxx>
+#include <comphelper/sequence.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;
+
+// ----------------------------------------------------
+// class StdTabController
+// ----------------------------------------------------
+StdTabController::StdTabController()
+{
+}
+
+StdTabController::~StdTabController()
+{
+}
+
+sal_Bool StdTabController::ImplCreateComponentSequence(
+ Sequence< Reference< XControl > >& rControls,
+ const Sequence< Reference< XControlModel > >& rModels,
+ Sequence< Reference< XWindow > >& rComponents,
+ Sequence< Any>* pTabStops,
+ sal_Bool bPeerComponent ) const
+{
+ sal_Bool bOK = sal_True;
+
+ // nur die wirklich geforderten Controls
+ sal_Int32 nModels = rModels.getLength();
+ if (nModels != rControls.getLength())
+ {
+ Sequence< Reference< XControl > > aSeq( nModels );
+ const Reference< XControlModel >* pModels = rModels.getConstArray();
+ Reference< XControl > xCurrentControl;
+
+ sal_Int32 nRealControls = 0;
+ for (sal_Int32 n = 0; n < nModels; ++n, ++pModels)
+ {
+ xCurrentControl = FindControl(rControls, *pModels);
+ if (xCurrentControl.is())
+ aSeq.getArray()[nRealControls++] = xCurrentControl;
+ }
+ aSeq.realloc(nRealControls);
+ rControls = aSeq;
+ }
+#ifdef DBG_UTIL
+ DBG_ASSERT( rControls.getLength() <= rModels.getLength(), "StdTabController:ImplCreateComponentSequence: inconsistence!" );
+ // there may be less controls than models, but never more controls than models
+#endif
+
+
+ const Reference< XControl > * pControls = rControls.getConstArray();
+ sal_uInt32 nCtrls = rControls.getLength();
+ rComponents.realloc( nCtrls );
+ Reference< XWindow > * pComps = rComponents.getArray();
+ Any* pTabs = NULL;
+
+
+ if ( pTabStops )
+ {
+ *pTabStops = Sequence< Any>( nCtrls );
+ pTabs = pTabStops->getArray();
+ }
+
+ for ( sal_uInt32 n = 0; bOK && ( n < nCtrls ); n++ )
+ {
+ // Zum Model passendes Control suchen
+ Reference< XControl > xCtrl(pControls[n]);
+ if ( xCtrl.is() )
+ {
+ if (bPeerComponent)
+ pComps[n] = Reference< XWindow > (xCtrl->getPeer(), UNO_QUERY);
+ else
+ pComps[n] = Reference< XWindow > (xCtrl, UNO_QUERY);
+
+ // TabStop-Property
+ if ( pTabs )
+ {
+ // opt: String fuer TabStop als Konstante
+ static const ::rtl::OUString aTabStopName( ::rtl::OUString::createFromAscii( "Tabstop" ) );
+
+ Reference< XPropertySet > xPSet( xCtrl->getModel(), UNO_QUERY );
+ Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
+ if( xInfo->hasPropertyByName( aTabStopName ) )
+ *pTabs++ = xPSet->getPropertyValue( aTabStopName );
+ else
+ ++pTabs;
+ }
+ }
+ else
+ {
+ DBG_TRACE( "ImplCreateComponentSequence: Control not found" );
+ bOK = sal_False;
+ }
+ }
+ return bOK;
+}
+
+void StdTabController::ImplActivateControl( sal_Bool bFirst ) const
+{
+ // HACK wegen #53688#, muss auf ein Interface abgebildet werden, wenn Controls Remote liegen koennen.
+ Reference< XTabController > xTabController(const_cast< ::cppu::OWeakObject* >(static_cast< const ::cppu::OWeakObject* >(this)), UNO_QUERY);
+ Sequence< Reference< XControl > > aCtrls = xTabController->getControls();
+ const Reference< XControl > * pControls = aCtrls.getConstArray();
+ sal_uInt32 nCount = aCtrls.getLength();
+
+ for ( sal_uInt32 n = bFirst ? 0 : nCount; bFirst ? ( n < nCount ) : n; )
+ {
+ sal_uInt32 nCtrl = bFirst ? n++ : --n;
+ DBG_ASSERT( pControls[nCtrl].is(), "Control nicht im Container!" );
+ if ( pControls[nCtrl].is() )
+ {
+ Reference< XWindowPeer > xCP = pControls[nCtrl]->getPeer();
+ if ( xCP.is() )
+ {
+ VCLXWindow* pC = VCLXWindow::GetImplementation( xCP );
+ if ( pC && pC->GetWindow() && ( pC->GetWindow()->GetStyle() & WB_TABSTOP ) )
+ {
+ pC->GetWindow()->GrabFocus();
+ break;
+ }
+ }
+ }
+ }
+}
+
+// XInterface
+Any StdTabController::queryAggregation( const Type & rType ) throw(RuntimeException)
+{
+ Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( XTabController*, this ),
+ SAL_STATIC_CAST( XServiceInfo*, this ),
+ SAL_STATIC_CAST( XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+}
+
+// XTypeProvider
+IMPL_XTYPEPROVIDER_START( StdTabController )
+ getCppuType( ( Reference< XTabController>* ) NULL ),
+ getCppuType( ( Reference< XServiceInfo>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+void StdTabController::setModel( const Reference< XTabControllerModel >& Model ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mxModel = Model;
+}
+
+Reference< XTabControllerModel > StdTabController::getModel( ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxModel;
+}
+
+void StdTabController::setContainer( const Reference< XControlContainer >& Container ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mxControlContainer = Container;
+}
+
+Reference< XControlContainer > StdTabController::getContainer( ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mxControlContainer;
+}
+
+Sequence< Reference< XControl > > StdTabController::getControls( ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ Sequence< Reference< XControl > > aSeq;
+
+ if ( mxControlContainer.is() )
+ {
+ Sequence< Reference< XControlModel > > aModels = mxModel->getControlModels();
+ const Reference< XControlModel > * pModels = aModels.getConstArray();
+
+ Sequence< Reference< XControl > > xCtrls = mxControlContainer->getControls();
+
+ sal_uInt32 nCtrls = aModels.getLength();
+ aSeq = Sequence< Reference< XControl > >( nCtrls );
+ for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ Reference< XControlModel > xCtrlModel = pModels[n];
+ // Zum Model passendes Control suchen
+ Reference< XControl > xCtrl = FindControl( xCtrls, xCtrlModel );
+ aSeq.getArray()[n] = xCtrl;
+ }
+ }
+ return aSeq;
+}
+
+void StdTabController::autoTabOrder( ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ DBG_ASSERT( mxControlContainer.is(), "autoTabOrder: No ControlContainer!" );
+ if ( !mxControlContainer.is() )
+ return;
+
+ Sequence< Reference< XControlModel > > aSeq = mxModel->getControlModels();
+ Sequence< Reference< XWindow > > aCompSeq;
+
+ // vieleicht erhalte ich hier einen TabController,
+ // der schneller die Liste meiner Controls ermittelt
+ Reference< XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);
+ Sequence< Reference< XControl > > aControls = xTabController->getControls();
+
+ // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im Container,
+ // dann kommt spaeter nochmal ein autoTabOrder...
+ if( !ImplCreateComponentSequence( aControls, aSeq, aCompSeq, NULL, sal_False ) )
+ return;
+
+ sal_uInt32 nCtrls = aCompSeq.getLength();
+ Reference< XWindow > * pComponents = aCompSeq.getArray();
+
+ ComponentEntryList aCtrls;
+ sal_uInt32 n;
+ for ( n = 0; n < nCtrls; n++ )
+ {
+ XWindow* pC = (XWindow*)pComponents[n].get();
+ ComponentEntry* pE = new ComponentEntry;
+ pE->pComponent = pC;
+ awt::Rectangle aPosSize = pC->getPosSize();
+ pE->aPos.X() = aPosSize.X;
+ pE->aPos.Y() = aPosSize.Y;
+
+ sal_uInt16 nPos;
+ for ( nPos = 0; nPos < aCtrls.Count(); nPos++ )
+ {
+ ComponentEntry* pEntry = aCtrls.GetObject( nPos );
+ if ( pEntry->aPos.Y() >= pE->aPos.Y() )
+ {
+ while ( pEntry && ( pEntry->aPos.Y() == pE->aPos.Y() )
+ && ( pEntry->aPos.X() < pE->aPos.X() ) )
+ {
+ pEntry = aCtrls.GetObject( ++nPos );
+ }
+ break;
+ }
+ }
+ aCtrls.Insert( pE, nPos );
+ }
+
+ Sequence< Reference< XControlModel > > aNewSeq( nCtrls );
+ for ( n = 0; n < nCtrls; n++ )
+ {
+ ComponentEntry* pE = aCtrls.GetObject( n );
+ Reference< XControl > xUC( pE->pComponent, UNO_QUERY );
+ aNewSeq.getArray()[n] = xUC->getModel();
+ delete pE;
+ }
+ aCtrls.Clear();
+
+ mxModel->setControlModels( aNewSeq );
+}
+
+void StdTabController::activateTabOrder( ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Am Container die Tab-Reihenfolge aktivieren...
+
+ Reference< XControl > xC( mxControlContainer, UNO_QUERY );
+ Reference< XVclContainerPeer > xVclContainerPeer;
+ if ( xC.is() )
+ xVclContainerPeer = xVclContainerPeer.query( xC->getPeer() );
+ if ( !xC.is() || !xVclContainerPeer.is() )
+ return;
+
+ // vieleicht erhalte ich hier einen TabController,
+ // der schneller die Liste meiner Controls ermittelt
+ Reference< XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY);
+
+ // Flache Liste besorgen...
+ Sequence< Reference< XControlModel > > aModels = mxModel->getControlModels();
+ Sequence< Reference< XWindow > > aCompSeq;
+ Sequence< Any> aTabSeq;
+
+ // DG: Aus Optimierungsgruenden werden die Controls mittels getControls() geholt,
+ // dieses hoert sich zwar wiedersinning an, fuehrt aber im konkreten Fall (Forms) zu sichtbaren
+ // Geschwindigkeitsvorteilen
+ Sequence< Reference< XControl > > aControls = xTabController->getControls();
+
+ // #58317# Es sind ggf. noch nicht alle Controls fuer die Models im Container,
+ // dann kommt spaeter nochmal ein activateTabOrder...
+ if( !ImplCreateComponentSequence( aControls, aModels, aCompSeq, &aTabSeq, sal_True ) )
+ return;
+
+ xVclContainerPeer->setTabOrder( aCompSeq, aTabSeq, mxModel->getGroupControl() );
+
+ ::rtl::OUString aName;
+ Sequence< Reference< XControlModel > > aThisGroupModels;
+ Sequence< Reference< XWindow > > aControlComponents;
+
+ sal_uInt32 nGroups = mxModel->getGroupCount();
+ for ( sal_uInt32 nG = 0; nG < nGroups; nG++ )
+ {
+ mxModel->getGroup( nG, aThisGroupModels, aName );
+
+ aControls = xTabController->getControls();
+ // ImplCreateComponentSequence has a really strange semantics regarding it's first parameter:
+ // upon method entry, it expects a super set of the controls which it returns
+ // this means we need to completely fill this sequence with all available controls before
+ // calling into ImplCreateComponentSequence
+
+ aControlComponents.realloc( 0 );
+
+ ImplCreateComponentSequence( aControls, aThisGroupModels, aControlComponents, NULL, sal_True );
+ xVclContainerPeer->setGroup( aControlComponents );
+ }
+}
+
+void StdTabController::activateFirst( ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ImplActivateControl( sal_True );
+}
+
+void StdTabController::activateLast( ) throw(RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ImplActivateControl( sal_False );
+}
+
+
+Reference< XControl > StdTabController::FindControl( Sequence< Reference< XControl > >& rCtrls,
+ const Reference< XControlModel > & rxCtrlModel )
+{
+
+/*
+ // MT: Funktioniert nicht mehr, weil ich nicht mehr bei mir angemeldet bin,
+ // weil DG das abfaengt.
+
+ // #54677# Beim Laden eines HTML-Dokuments wird nach jedem Control ein
+ // activateTabOrder gerufen und jede Menge Zeit in dieser Methode verbraten.
+ // Die Anzahl dieser Schleifendurchlaufe steigt quadratisch, also versuchen
+ // das Control direkt vom Model zu erhalten.
+ // => Wenn genau ein Control als PropertyChangeListener angemeldet ist,
+ // dann muss das auch das richtige sein.
+
+ UnoControlModel* pUnoCtrlModel = UnoControlModel::GetImplementation( rxCtrlModel );
+
+
+ if ( pUnoCtrlModel )
+ {
+ ListenerIterator aIt( pUnoCtrlModel->maPropertiesListeners );
+ while( aIt.hasMoreElements() )
+ {
+ XEventListener* pL = aIt.next();
+ Reference< XControl > xC( pL, UNO_QUERY );
+ if ( xC.is() )
+ {
+ if( xC->getContext() == mxControlContainer )
+ {
+ xCtrl = xC;
+ break;
+ }
+ }
+ }
+ }
+ if ( !xCtrl.is() && rxCtrlModel.is())
+*/
+ DBG_ASSERT( rxCtrlModel.is(), "ImplFindControl - welches ?!" );
+
+ const Reference< XControl > * pCtrls = rCtrls.getConstArray();
+ sal_Int32 nCtrls = rCtrls.getLength();
+ for ( sal_Int32 n = 0; n < nCtrls; n++ )
+ {
+ Reference< XControlModel > xModel(pCtrls[n].is() ? pCtrls[n]->getModel() : Reference< XControlModel > ());
+ if ( (XControlModel*)xModel.get() == (XControlModel*)rxCtrlModel.get() )
+ {
+ Reference< XControl > xCtrl( pCtrls[n] );
+ ::comphelper::removeElementAt( rCtrls, n );
+ return xCtrl;
+ }
+ }
+ return Reference< XControl > ();
+}
diff --git a/toolkit/source/controls/stdtabcontrollermodel.cxx b/toolkit/source/controls/stdtabcontrollermodel.cxx
new file mode 100644
index 000000000000..db0555762511
--- /dev/null
+++ b/toolkit/source/controls/stdtabcontrollermodel.cxx
@@ -0,0 +1,408 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/io/XMarkableStream.hpp>
+
+#include <toolkit/controls/stdtabcontrollermodel.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/property.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <tools/debug.hxx>
+
+#define UNOCONTROL_STREAMVERSION (short)2
+
+// ----------------------------------------------------
+// class UnoControlModelEntryList
+// ----------------------------------------------------
+UnoControlModelEntryList::UnoControlModelEntryList()
+{
+}
+
+UnoControlModelEntryList::~UnoControlModelEntryList()
+{
+ Reset();
+}
+
+void UnoControlModelEntryList::Reset()
+{
+ for ( sal_uInt32 n = Count(); n; )
+ DestroyEntry( --n );
+}
+
+void UnoControlModelEntryList::DestroyEntry( sal_uInt32 nEntry )
+{
+ UnoControlModelEntry* pEntry = GetObject( nEntry );
+
+ if ( pEntry->bGroup )
+ delete pEntry->pGroup;
+ else
+ delete pEntry->pxControl;
+
+ Remove( nEntry );
+ delete pEntry;
+}
+
+// ----------------------------------------------------
+// class StdTabControllerModel
+// ----------------------------------------------------
+StdTabControllerModel::StdTabControllerModel()
+{
+ mbGroupControl = sal_True;
+}
+
+StdTabControllerModel::~StdTabControllerModel()
+{
+}
+
+sal_uInt32 StdTabControllerModel::ImplGetControlCount( const UnoControlModelEntryList& rList ) const
+{
+ sal_uInt32 nCount = 0;
+ sal_uInt32 nEntries = rList.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = rList.GetObject( n );
+ if ( pEntry->bGroup )
+ nCount += ImplGetControlCount( *pEntry->pGroup );
+ else
+ nCount++;
+ }
+ return nCount;
+}
+
+void StdTabControllerModel::ImplGetControlModels( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ** ppRefs, const UnoControlModelEntryList& rList ) const
+{
+ sal_uInt32 nEntries = rList.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = rList.GetObject( n );
+ if ( pEntry->bGroup )
+ ImplGetControlModels( ppRefs, *pEntry->pGroup );
+ else
+ {
+ **ppRefs = *pEntry->pxControl;
+ (*ppRefs)++;
+ }
+ }
+}
+
+void StdTabControllerModel::ImplSetControlModels( UnoControlModelEntryList& rList, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) const
+{
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = Controls.getConstArray();
+ sal_uInt32 nControls = Controls.getLength();
+ for ( sal_uInt32 n = 0; n < nControls; n++ )
+ {
+ UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
+ pNewEntry->bGroup = sal_False;
+ pNewEntry->pxControl = new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > ;
+ *pNewEntry->pxControl = pRefs[n];
+ rList.Insert( pNewEntry, LIST_APPEND );
+ }
+}
+
+sal_uInt32 StdTabControllerModel::ImplGetControlPos( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xCtrl, const UnoControlModelEntryList& rList ) const
+{
+ for ( sal_uInt32 n = rList.Count(); n; )
+ {
+ UnoControlModelEntry* pEntry = rList.GetObject( --n );
+ if ( !pEntry->bGroup && ( *pEntry->pxControl == xCtrl ) )
+ return n;
+ }
+ return CONTROLPOS_NOTFOUND;
+}
+
+void ImplWriteControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream > & OutStream, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rCtrls )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
+
+ sal_uInt32 nStoredControls = 0;
+ sal_Int32 nDataBeginMark = xMark->createMark();
+
+ OutStream->writeLong( 0L ); // DataLen
+ OutStream->writeLong( 0L ); // nStoredControls
+
+ sal_uInt32 nCtrls = rCtrls.getLength();
+ for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI = rCtrls.getConstArray()[n];
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xPO( xI, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xPO.is(), "write: Control doesn't support XPersistObject" );
+ if ( xPO.is() )
+ {
+ OutStream->writeObject( xPO );
+ nStoredControls++;
+ }
+ }
+ sal_Int32 nDataLen = xMark->offsetToMark( nDataBeginMark );
+ xMark->jumpToMark( nDataBeginMark );
+ OutStream->writeLong( nDataLen );
+ OutStream->writeLong( nStoredControls );
+ xMark->jumpToFurthest();
+ xMark->deleteMark(nDataBeginMark);
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > ImplReadControls( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream > & InStream )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
+
+ sal_Int32 nDataBeginMark = xMark->createMark();
+
+ sal_Int32 nDataLen = InStream->readLong();
+ sal_uInt32 nCtrls = InStream->readLong();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( nCtrls );
+ for ( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject > xObj = InStream->readObject();
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > xI( xObj, ::com::sun::star::uno::UNO_QUERY );
+ aSeq.getArray()[n] = xI;
+ }
+
+ // Falls bereits mehr drinsteht als diese Version kennt:
+ xMark->jumpToMark( nDataBeginMark );
+ InStream->skipBytes( nDataLen );
+ xMark->deleteMark(nDataBeginMark);
+ return aSeq;
+}
+
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any StdTabControllerModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XTabControllerModel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( StdTabControllerModel )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+sal_Bool StdTabControllerModel::getGroupControl( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mbGroupControl;
+}
+
+void StdTabControllerModel::setGroupControl( sal_Bool GroupControl ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ mbGroupControl = GroupControl;
+}
+
+void StdTabControllerModel::setControlModels( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Controls ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maControls.Reset();
+ ImplSetControlModels( maControls, Controls );
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > StdTabControllerModel::getControlModels( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq( ImplGetControlCount( maControls ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
+ ImplGetControlModels( &pRefs, maControls );
+ return aSeq;
+}
+
+void StdTabControllerModel::setGroup( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& Group, const ::rtl::OUString& GroupName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Die Controls stehen eventuel flach in der Liste und werden jetzt gruppiert.
+ // Verschachtelte Gruppen sind erstmal nicht moeglich...
+ // Das erste Element der Gruppe welches auch schon in der flachen Liste
+ // stand bestimmt die Position der Gruppe.
+
+ UnoControlModelEntry* pNewEntry = new UnoControlModelEntry;
+ pNewEntry->bGroup = sal_True;
+ pNewEntry->pGroup = new UnoControlModelEntryList;
+ pNewEntry->pGroup->SetName( GroupName );
+ ImplSetControlModels( *pNewEntry->pGroup, Group );
+
+ sal_Bool bInserted = sal_False;
+ sal_uInt32 nElements = pNewEntry->pGroup->Count();
+ for ( sal_uInt32 n = 0; n < nElements; n++ )
+ {
+ UnoControlModelEntry* pEntry = pNewEntry->pGroup->GetObject( n );
+ if ( !pEntry->bGroup )
+ {
+ sal_uInt32 nPos = ImplGetControlPos( *pEntry->pxControl, maControls );
+ // Eigentlich sollten alle Controls vorher in der flachen Liste stehen
+ DBG_ASSERT( nPos != CONTROLPOS_NOTFOUND, "setGroup - Element not found" );
+ if ( nPos != CONTROLPOS_NOTFOUND )
+ {
+ maControls.DestroyEntry( nPos );
+ if ( !bInserted )
+ {
+ maControls.Insert( pNewEntry, nPos );
+ bInserted = sal_True;
+ }
+ }
+ }
+ }
+ if ( !bInserted )
+ maControls.Insert( pNewEntry, LIST_APPEND );
+}
+
+sal_Int32 StdTabControllerModel::getGroupCount( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // erstmal nur eine Ebene...
+ // Das Model und die Impl-Methoden arbeiten zwar rekursiv, aber das wird
+ // erstmal nich nach aussen gegeben.
+
+ sal_Int32 nGroups = 0;
+ sal_uInt32 nEntries = maControls.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = maControls.GetObject( n );
+ if ( pEntry->bGroup )
+ nGroups++;
+ }
+ return nGroups;
+}
+
+void StdTabControllerModel::getGroup( sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup, ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq;
+ sal_uInt32 nG = 0;
+ sal_uInt32 nEntries = maControls.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = maControls.GetObject( n );
+ if ( pEntry->bGroup )
+ {
+ if ( nG == (sal_uInt32)nGroup )
+ {
+ sal_uInt32 nCount = ImplGetControlCount( *pEntry->pGroup );
+ aSeq = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >( nCount );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > * pRefs = aSeq.getArray();
+ ImplGetControlModels( &pRefs, *pEntry->pGroup );
+ rName = pEntry->pGroup->GetName();
+ break;
+ }
+ nG++;
+ }
+ }
+ rGroup = aSeq;
+}
+
+void StdTabControllerModel::getGroupByName( const ::rtl::OUString& rName, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& rGroup ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nGroup = 0;
+ sal_uInt32 nEntries = maControls.Count();
+ for ( sal_uInt32 n = 0; n < nEntries; n++ )
+ {
+ UnoControlModelEntry* pEntry = maControls.GetObject( n );
+ if ( pEntry->bGroup )
+ {
+ if ( pEntry->pGroup->GetName() == rName )
+ {
+ ::rtl::OUString Dummy;
+ getGroup( nGroup, rGroup, Dummy );
+ break;
+ }
+ nGroup++;
+ }
+ }
+}
+
+
+// ::com::sun::star::io::XPersistObject
+::rtl::OUString StdTabControllerModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_TabControllerModel );
+}
+
+void StdTabControllerModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no XMarkableStream!" );
+
+ OutStream->writeShort( UNOCONTROL_STREAMVERSION );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrls = getControlModels();
+ ImplWriteControls( OutStream, aCtrls );
+
+ sal_uInt32 nGroups = getGroupCount();
+ OutStream->writeLong( nGroups );
+ for ( sal_uInt32 n = 0; n < nGroups; n++ )
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aGroupCtrls;
+ ::rtl::OUString aGroupName;
+ getGroup( n, aGroupCtrls, aGroupName );
+ OutStream->writeUTF( aGroupName );
+ ImplWriteControls( OutStream, aGroupCtrls );
+ }
+}
+
+void StdTabControllerModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aSeq = ImplReadControls( InStream );
+ setControlModels( aSeq );
+
+ sal_uInt32 nGroups = InStream->readLong();
+ for ( sal_uInt32 n = 0; n < nGroups; n++ )
+ {
+ ::rtl::OUString aGroupName = InStream->readUTF();
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > aCtrlSeq = ImplReadControls( InStream );
+ setGroup( aCtrlSeq, aGroupName );
+ }
+}
+
+
+
+
+
diff --git a/toolkit/source/controls/tkscrollbar.cxx b/toolkit/source/controls/tkscrollbar.cxx
new file mode 100644
index 000000000000..2de8b56131c8
--- /dev/null
+++ b/toolkit/source/controls/tkscrollbar.cxx
@@ -0,0 +1,294 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include "toolkit/controls/tkscrollbar.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+
+// for introspection
+#include <toolkit/awt/vclxwindows.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= UnoControlScrollBarModel
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoControlScrollBarModel::UnoControlScrollBarModel()
+ {
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXScrollBar );
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoControlScrollBarModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlScrollBarModel );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any UnoControlScrollBarModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+ {
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_LIVE_SCROLL:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlScrollBar ) );
+
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& UnoControlScrollBarModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+ //--------------------------------------------------------------------
+ uno::Reference< beans::XPropertySetInfo > UnoControlScrollBarModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+ {
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+
+ //====================================================================
+ //= UnoControlScrollBarModel
+ //====================================================================
+ UnoScrollBarControl::UnoScrollBarControl()
+ : maAdjustmentListeners( *this )
+ {
+ }
+
+ ::rtl::OUString UnoScrollBarControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "ScrollBar" );
+ }
+
+ // ::com::sun::star::uno::XInterface
+ uno::Any UnoScrollBarControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+ {
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XAdjustmentListener*, this ),
+ SAL_STATIC_CAST( awt::XScrollBar*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+ }
+
+ // ::com::sun::star::lang::XTypeProvider
+ IMPL_XTYPEPROVIDER_START( UnoScrollBarControl )
+ getCppuType( ( uno::Reference< awt::XAdjustmentListener>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XScrollBar>* ) NULL ),
+ UnoControlBase::getTypes()
+ IMPL_XTYPEPROVIDER_END
+
+ void UnoScrollBarControl::dispose() throw(uno::RuntimeException)
+ {
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maAdjustmentListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+ }
+
+ void UnoScrollBarControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+ {
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+ xScrollBar->addAdjustmentListener( this );
+ }
+
+ // ::com::sun::star::awt::XAdjustmentListener
+ void UnoScrollBarControl::adjustmentValueChanged( const ::com::sun::star::awt::AdjustmentEvent& rEvent ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ switch ( rEvent.Type )
+ {
+ case ::com::sun::star::awt::AdjustmentType_ADJUST_LINE:
+ case ::com::sun::star::awt::AdjustmentType_ADJUST_PAGE:
+ case ::com::sun::star::awt::AdjustmentType_ADJUST_ABS:
+ {
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+
+ if ( xScrollBar.is() )
+ {
+ uno::Any aAny;
+ aAny <<= xScrollBar->getValue();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE ), aAny, sal_False );
+ }
+ }
+ break;
+ default:
+ {
+ DBG_ERROR( "UnoScrollBarControl::adjustmentValueChanged - unknown Type" );
+
+ }
+ }
+
+ if ( maAdjustmentListeners.getLength() )
+ maAdjustmentListeners.adjustmentValueChanged( rEvent );
+ }
+
+ // ::com::sun::star::awt::XScrollBar
+ void UnoScrollBarControl::addAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ maAdjustmentListeners.addInterface( l );
+ }
+
+ void UnoScrollBarControl::removeAdjustmentListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XAdjustmentListener > & l ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ maAdjustmentListeners.removeInterface( l );
+ }
+
+ void UnoScrollBarControl::setValue( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE ), uno::makeAny( n ), sal_True );
+ }
+
+ void UnoScrollBarControl::setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ uno::Any aAny;
+ aAny <<= nValue;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE ), aAny, sal_True );
+ aAny <<= nVisible;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VISIBLESIZE ), aAny, sal_True );
+ aAny <<= nMax;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE_MAX ), aAny, sal_True );
+ }
+
+ sal_Int32 UnoScrollBarControl::getValue() throw(::com::sun::star::uno::RuntimeException)
+ {
+ sal_Int32 n = 0;
+ if ( getPeer().is() )
+ {
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+ n = xScrollBar->getValue();
+ }
+ return n;
+ }
+
+ void UnoScrollBarControl::setMaximum( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SCROLLVALUE_MAX ), uno::makeAny( n ), sal_True );
+ }
+
+ sal_Int32 UnoScrollBarControl::getMaximum() throw(::com::sun::star::uno::RuntimeException)
+ {
+ sal_Int32 n = 0;
+ if ( getPeer().is() )
+ {
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+ n = xScrollBar->getMaximum();
+ }
+ return n;
+ }
+
+ void UnoScrollBarControl::setLineIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINEINCREMENT ), uno::makeAny( n ), sal_True );
+ }
+
+ sal_Int32 UnoScrollBarControl::getLineIncrement() throw(::com::sun::star::uno::RuntimeException)
+ {
+ sal_Int32 n = 0;
+ if ( getPeer().is() )
+ {
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+ n = xScrollBar->getLineIncrement();
+ }
+ return n;
+ }
+
+ void UnoScrollBarControl::setBlockIncrement( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_BLOCKINCREMENT ), uno::makeAny( n ), sal_True );
+ }
+
+ sal_Int32 UnoScrollBarControl::getBlockIncrement() throw(::com::sun::star::uno::RuntimeException)
+ {
+ sal_Int32 n = 0;
+ if ( getPeer().is() )
+ {
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+ n = xScrollBar->getBlockIncrement();
+ }
+ return n;
+ }
+
+ void UnoScrollBarControl::setVisibleSize( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VISIBLESIZE ), uno::makeAny( n ), sal_True );
+ }
+
+ sal_Int32 UnoScrollBarControl::getVisibleSize() throw(::com::sun::star::uno::RuntimeException)
+ {
+ sal_Int32 n = 0;
+ if ( getPeer().is() )
+ {
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+ n = xScrollBar->getVisibleSize();
+ }
+ return n;
+ }
+
+ void UnoScrollBarControl::setOrientation( sal_Int32 n ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ORIENTATION ), uno::makeAny( n ), sal_True );
+ }
+
+ sal_Int32 UnoScrollBarControl::getOrientation() throw(::com::sun::star::uno::RuntimeException)
+ {
+ sal_Int32 n = 0;
+ if ( getPeer().is() )
+ {
+ uno::Reference< awt::XScrollBar > xScrollBar( getPeer(), uno::UNO_QUERY );
+ n = xScrollBar->getOrientation();
+ }
+ return n;
+ }
+
+
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
diff --git a/toolkit/source/controls/tksimpleanimation.cxx b/toolkit/source/controls/tksimpleanimation.cxx
new file mode 100644
index 000000000000..9c32ba500407
--- /dev/null
+++ b/toolkit/source/controls/tksimpleanimation.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_toolkit.hxx"
+#include "toolkit/controls/tksimpleanimation.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= UnoSimpleAnimationControlModel
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoSimpleAnimationControlModel::UnoSimpleAnimationControlModel()
+ {
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_REPEAT );
+ ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoSimpleAnimationControlModel::getServiceName()
+ throw( uno::RuntimeException )
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any UnoSimpleAnimationControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+ {
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl ) );
+
+ case BASEPROPERTY_STEP_TIME:
+ return uno::makeAny( (sal_Int32) 100 );
+
+ case BASEPROPERTY_REPEAT:
+ return uno::makeAny( (sal_Bool)sal_True );
+
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& UnoSimpleAnimationControlModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+ //--------------------------------------------------------------------
+ uno::Reference< beans::XPropertySetInfo > UnoSimpleAnimationControlModel::getPropertySetInfo( )
+ throw( uno::RuntimeException )
+ {
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UnoSimpleAnimationControlModel::getImplementationName()
+ throw( uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSimpleAnimationControlModel" ) );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Sequence< ::rtl::OUString > SAL_CALL UnoSimpleAnimationControlModel::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+ {
+ uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
+ return aServices;
+ }
+
+ //====================================================================
+ //= UnoSimpleAnimationControl
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoSimpleAnimationControl::UnoSimpleAnimationControl()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoSimpleAnimationControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "SimpleAnimation" );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any UnoSimpleAnimationControl::queryAggregation( const uno::Type & rType )
+ throw( uno::RuntimeException )
+ {
+ uno::Any aRet = UnoControlBase::queryAggregation( rType );
+ if ( !aRet.hasValue() )
+ aRet = UnoSimpleAnimationControl_Base::queryInterface( rType );
+ return aRet;
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoSimpleAnimationControl, UnoControlBase, UnoSimpleAnimationControl_Base )
+
+ //--------------------------------------------------------------------
+ void UnoSimpleAnimationControl::dispose() throw( uno::RuntimeException )
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+
+ UnoControl::dispose();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UnoSimpleAnimationControl::getImplementationName()
+ throw( uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSimpleAnimationControl" ) );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Sequence< ::rtl::OUString > SAL_CALL UnoSimpleAnimationControl::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+ {
+ uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl );
+ return aServices;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoSimpleAnimationControl::createPeer( const uno::Reference< awt::XToolkit > &rxToolkit,
+ const uno::Reference< awt::XWindowPeer > &rParentPeer )
+ throw( uno::RuntimeException )
+ {
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSimpleAnimationControl::start() throw ( uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ uno::Reference< XSimpleAnimation > xAnimation( getPeer(), uno::UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->start();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSimpleAnimationControl::stop() throw ( uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ uno::Reference< XSimpleAnimation > xAnimation( getPeer(), uno::UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->stop();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSimpleAnimationControl::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& ImageList )
+ throw ( uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ uno::Reference< XSimpleAnimation > xAnimation( getPeer(), uno::UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->setImageList( ImageList );
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
diff --git a/toolkit/source/controls/tkspinbutton.cxx b/toolkit/source/controls/tkspinbutton.cxx
new file mode 100644
index 000000000000..5929dc7a4635
--- /dev/null
+++ b/toolkit/source/controls/tkspinbutton.cxx
@@ -0,0 +1,350 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include "toolkit/controls/tkspinbutton.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+#include <com/sun/star/awt/ScrollBarOrientation.hpp>
+
+
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::beans;
+
+ //====================================================================
+ //= UnoSpinButtonModel
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoSpinButtonModel::UnoSpinButtonModel()
+ {
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_ORIENTATION );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_REPEAT );
+ ImplRegisterProperty( BASEPROPERTY_REPEAT_DELAY );
+ ImplRegisterProperty( BASEPROPERTY_SYMBOL_COLOR );
+ ImplRegisterProperty( BASEPROPERTY_SPINVALUE );
+ ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MIN );
+ ImplRegisterProperty( BASEPROPERTY_SPINVALUE_MAX );
+ ImplRegisterProperty( BASEPROPERTY_SPININCREMENT );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoSpinButtonModel::getServiceName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonModel );
+ }
+
+ //--------------------------------------------------------------------
+ Any UnoSpinButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+ {
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonControl ) );
+
+ case BASEPROPERTY_BORDER:
+ return makeAny( (sal_Int16) 0 );
+
+ case BASEPROPERTY_REPEAT:
+ return makeAny( (sal_Bool)sal_True );
+
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& UnoSpinButtonModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+ //--------------------------------------------------------------------
+ Reference< XPropertySetInfo > UnoSpinButtonModel::getPropertySetInfo( ) throw(RuntimeException)
+ {
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UnoSpinButtonModel::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSpinButtonModel" ) );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UnoSpinButtonModel::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonModel );
+ return aServices;
+ }
+
+ //====================================================================
+ //= UnoSpinButtonControl
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoSpinButtonControl::UnoSpinButtonControl()
+ :maAdjustmentListeners( *this )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoSpinButtonControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "SpinButton" );
+ }
+
+ //--------------------------------------------------------------------
+ Any UnoSpinButtonControl::queryAggregation( const Type & rType ) throw(RuntimeException)
+ {
+ Any aRet = UnoControlBase::queryAggregation( rType );
+ if ( !aRet.hasValue() )
+ aRet = UnoSpinButtonControl_Base::queryInterface( rType );
+ return aRet;
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoSpinButtonControl, UnoControlBase, UnoSpinButtonControl_Base )
+
+ //--------------------------------------------------------------------
+ void UnoSpinButtonControl::dispose() throw(RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ if ( maAdjustmentListeners.getLength() )
+ {
+ Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
+ if ( xSpinnable.is() )
+ xSpinnable->removeAdjustmentListener( this );
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = *this;
+
+ aGuard.clear();
+ maAdjustmentListeners.disposeAndClear( aDisposeEvent );
+ }
+
+ UnoControl::dispose();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UnoSpinButtonControl::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoSpinButtonControl" ) );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UnoSpinButtonControl::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSpinButtonControl );
+ return aServices;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoSpinButtonControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+ {
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ Reference < XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
+ if ( xSpinnable.is() )
+ xSpinnable->addAdjustmentListener( this );
+ }
+
+ //--------------------------------------------------------------------
+ void UnoSpinButtonControl::adjustmentValueChanged( const AdjustmentEvent& rEvent ) throw(RuntimeException)
+ {
+ switch ( rEvent.Type )
+ {
+ case AdjustmentType_ADJUST_LINE:
+ case AdjustmentType_ADJUST_PAGE:
+ case AdjustmentType_ADJUST_ABS:
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( rEvent.Value ), sal_False );
+ break;
+ default:
+ DBG_ERROR( "UnoSpinButtonControl::adjustmentValueChanged - unknown Type" );
+ }
+
+ if ( maAdjustmentListeners.getLength() )
+ {
+ AdjustmentEvent aEvent( rEvent );
+ aEvent.Source = *this;
+ maAdjustmentListeners.adjustmentValueChanged( aEvent );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void UnoSpinButtonControl::addAdjustmentListener( const Reference< XAdjustmentListener > & listener ) throw(RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maAdjustmentListeners.addInterface( listener );
+ }
+
+ //--------------------------------------------------------------------
+ void UnoSpinButtonControl::removeAdjustmentListener( const Reference< XAdjustmentListener > & listener ) throw(RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maAdjustmentListeners.removeInterface( listener );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSpinButtonControl::setValue( sal_Int32 value ) throw (RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( value ), sal_True );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSpinButtonControl::setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) throw (RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MIN ), makeAny( minValue ), sal_True );
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MAX ), makeAny( maxValue ), sal_True );
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE ), makeAny( currentValue ), sal_True );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL UnoSpinButtonControl::getValue( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ sal_Int32 nValue = 0;
+
+ Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
+ if ( xSpinnable.is() )
+ nValue = xSpinnable->getValue();
+
+ return nValue;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSpinButtonControl::setMinimum( sal_Int32 minValue ) throw (RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MIN ), makeAny( minValue ), sal_True );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSpinButtonControl::setMaximum( sal_Int32 maxValue ) throw (RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPINVALUE_MAX ), makeAny( maxValue ), sal_True );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL UnoSpinButtonControl::getMinimum( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ sal_Int32 nMin = 0;
+
+ Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
+ if ( xSpinnable.is() )
+ nMin = xSpinnable->getMinimum();
+
+ return nMin;
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL UnoSpinButtonControl::getMaximum( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ sal_Int32 nMax = 0;
+
+ Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
+ if ( xSpinnable.is() )
+ nMax = xSpinnable->getMaximum();
+
+ return nMax;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSpinButtonControl::setSpinIncrement( sal_Int32 spinIncrement ) throw (RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SPININCREMENT ), makeAny( spinIncrement ), sal_True );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL UnoSpinButtonControl::getSpinIncrement( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ sal_Int32 nIncrement = 0;
+
+ Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
+ if ( xSpinnable.is() )
+ nIncrement = xSpinnable->getSpinIncrement();
+
+ return nIncrement;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSpinButtonControl::setOrientation( sal_Int32 orientation ) throw (NoSupportException, RuntimeException)
+ {
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ORIENTATION ), makeAny( orientation ), sal_True );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Int32 SAL_CALL UnoSpinButtonControl::getOrientation( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ sal_Int32 nOrientation = ScrollBarOrientation::HORIZONTAL;
+
+ Reference< XSpinValue > xSpinnable( getPeer(), UNO_QUERY );
+ if ( xSpinnable.is() )
+ nOrientation = xSpinnable->getOrientation();
+
+ return nOrientation;
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
diff --git a/toolkit/source/controls/tkthrobber.cxx b/toolkit/source/controls/tkthrobber.cxx
new file mode 100644
index 000000000000..978d3183fe23
--- /dev/null
+++ b/toolkit/source/controls/tkthrobber.cxx
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include "toolkit/controls/tkthrobber.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/debug.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= UnoThrobberControlModel
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoThrobberControlModel::UnoThrobberControlModel()
+ {
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoThrobberControlModel::getServiceName( ) throw ( uno::RuntimeException )
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any UnoThrobberControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+ {
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl ) );
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& UnoThrobberControlModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+ //--------------------------------------------------------------------
+ uno::Reference< beans::XPropertySetInfo > UnoThrobberControlModel::getPropertySetInfo()
+ throw( uno::RuntimeException )
+ {
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UnoThrobberControlModel::getImplementationName()
+ throw( uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoThrobberControlModel" ) );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControlModel::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+ {
+ uno::Sequence< ::rtl::OUString > aServices( UnoControlModel::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
+ return aServices;
+ }
+
+ //====================================================================
+ //= UnoThrobberControl
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoThrobberControl::UnoThrobberControl()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoThrobberControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "Throbber" );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any UnoThrobberControl::queryAggregation( const uno::Type & rType ) throw( uno::RuntimeException )
+ {
+ uno::Any aRet = UnoControlBase::queryAggregation( rType );
+ if ( !aRet.hasValue() )
+ aRet = UnoThrobberControl_Base::queryInterface( rType );
+ return aRet;
+ }
+
+ //--------------------------------------------------------------------
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoThrobberControl, UnoControlBase, UnoThrobberControl_Base )
+
+ //--------------------------------------------------------------------
+ void UnoThrobberControl::dispose() throw( uno::RuntimeException )
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+
+ UnoControl::dispose();
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UnoThrobberControl::getImplementationName()
+ throw( uno::RuntimeException )
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.toolkit.UnoThrobberControl" ) );
+ }
+
+ //--------------------------------------------------------------------
+ uno::Sequence< ::rtl::OUString > SAL_CALL UnoThrobberControl::getSupportedServiceNames()
+ throw( uno::RuntimeException )
+ {
+ uno::Sequence< ::rtl::OUString > aServices( UnoControlBase::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
+ return aServices;
+ }
+
+ //--------------------------------------------------------------------
+ void UnoThrobberControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit,
+ const uno::Reference< awt::XWindowPeer > & rParentPeer )
+ throw( uno::RuntimeException )
+ {
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoThrobberControl::start() throw ( uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->start();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoThrobberControl::stop() throw ( uno::RuntimeException )
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ uno::Reference< XThrobber > xAnimation( getPeer(), uno::UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->stop();
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
diff --git a/toolkit/source/controls/tree/makefile.mk b/toolkit/source/controls/tree/makefile.mk
new file mode 100644
index 000000000000..4e72b62b416b
--- /dev/null
+++ b/toolkit/source/controls/tree/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=toolkit
+TARGET=tree
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/treecontrol.obj\
+ $(SLO)$/treedatamodel.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/controls/tree/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx
new file mode 100644
index 000000000000..5655e4e10abc
--- /dev/null
+++ b/toolkit/source/controls/tree/treecontrol.cxx
@@ -0,0 +1,502 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+#ifndef _TOOLKIT_TREE_CONTROL_HXX
+#include <treecontrol.hxx>
+#endif
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/awt/tree/XTreeDataModel.hpp>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt::tree;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+
+namespace toolkit
+{
+// ----------------------------------------------------
+// class UnoTreeModel
+// ----------------------------------------------------
+UnoTreeModel::UnoTreeModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TREE_SELECTIONTYPE );
+ ImplRegisterProperty( BASEPROPERTY_TREE_EDITABLE );
+ ImplRegisterProperty( BASEPROPERTY_TREE_DATAMODEL );
+ ImplRegisterProperty( BASEPROPERTY_TREE_ROOTDISPLAYED );
+ ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSHANDLES );
+ ImplRegisterProperty( BASEPROPERTY_TREE_SHOWSROOTHANDLES );
+ ImplRegisterProperty( BASEPROPERTY_TREE_ROWHEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING );
+}
+
+UnoTreeModel::UnoTreeModel( const UnoTreeModel& rModel )
+: UnoControlModel( rModel )
+{
+}
+
+UnoControlModel* UnoTreeModel::Clone() const
+{
+ return new UnoTreeModel( *this );
+}
+
+OUString UnoTreeModel::getServiceName() throw(RuntimeException)
+{
+ return OUString::createFromAscii( szServiceName_TreeControlModel );
+}
+
+Any UnoTreeModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch( nPropId )
+ {
+ case BASEPROPERTY_TREE_SELECTIONTYPE:
+ return Any( SelectionType_NONE );
+ case BASEPROPERTY_TREE_ROWHEIGHT:
+ return Any( sal_Int32( 0 ) );
+ case BASEPROPERTY_TREE_DATAMODEL:
+ return Any( Reference< XTreeDataModel >( 0 ) );
+ case BASEPROPERTY_TREE_EDITABLE:
+ case BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING:
+ return Any( sal_False );
+ case BASEPROPERTY_TREE_ROOTDISPLAYED:
+ case BASEPROPERTY_TREE_SHOWSROOTHANDLES:
+ case BASEPROPERTY_TREE_SHOWSHANDLES:
+ return Any( sal_True );
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_TreeControl ) );
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+}
+
+::cppu::IPropertyArrayHelper& UnoTreeModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// XMultiPropertySet
+Reference< XPropertySetInfo > UnoTreeModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoTreeControl
+// ----------------------------------------------------
+UnoTreeControl::UnoTreeControl()
+: maSelectionListeners( *this )
+, maTreeExpansionListeners( *this )
+, maTreeEditListeners( *this )
+{
+}
+
+OUString UnoTreeControl::GetComponentServiceName()
+{
+ return OUString::createFromAscii( "Tree" );
+}
+
+// -------------------------------------------------------------------
+// ::com::sun::star::view::XSelectionSupplier
+// -------------------------------------------------------------------
+
+sal_Bool SAL_CALL UnoTreeControl::select( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->select( rSelection );
+}
+
+// -------------------------------------------------------------------
+
+Any SAL_CALL UnoTreeControl::getSelection() throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getSelection();
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::addSelectionChangeListener( const Reference< XSelectionChangeListener >& xListener ) throw (RuntimeException)
+{
+ maSelectionListeners.addInterface( xListener );
+ if( getPeer().is() && (maSelectionListeners.getLength() == 1) )
+ {
+ // maSelectionListeners acts as a proxy,
+ // add it to the peer if this is the first listener added to that proxy
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addSelectionChangeListener(&maSelectionListeners);
+ }
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& xListener ) throw (RuntimeException)
+{
+ if( getPeer().is() && (maSelectionListeners.getLength() == 1) )
+ {
+ // maSelectionListeners acts as a proxy,
+ // remove it from the peer if this is the last listener removed from that proxy
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeSelectionChangeListener(&maSelectionListeners);
+ }
+ maSelectionListeners.removeInterface( xListener );
+}
+
+// -------------------------------------------------------------------
+// ::com::sun::star::view::XMultiSelectionSupplier
+// -------------------------------------------------------------------
+
+sal_Bool SAL_CALL UnoTreeControl::addSelection( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->addSelection(rSelection);
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::removeSelection( const Any& rSelection ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeSelection(rSelection);
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::clearSelection() throw (RuntimeException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->clearSelection();
+}
+
+// -------------------------------------------------------------------
+
+sal_Int32 SAL_CALL UnoTreeControl::getSelectionCount() throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getSelectionCount();
+}
+
+// -------------------------------------------------------------------
+
+Reference< XEnumeration > SAL_CALL UnoTreeControl::createSelectionEnumeration() throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->createSelectionEnumeration();
+}
+
+// -------------------------------------------------------------------
+
+Reference< XEnumeration > SAL_CALL UnoTreeControl::createReverseSelectionEnumeration() throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->createReverseSelectionEnumeration();
+}
+
+// --------------------------------------------------------------------
+// XTreeControl
+// --------------------------------------------------------------------
+
+OUString SAL_CALL UnoTreeControl::getDefaultExpandedGraphicURL() throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getDefaultExpandedGraphicURL();
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::setDefaultExpandedGraphicURL( const OUString& _defaultexpansiongraphicurl ) throw (RuntimeException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->setDefaultExpandedGraphicURL(_defaultexpansiongraphicurl);
+}
+
+// -------------------------------------------------------------------
+
+OUString SAL_CALL UnoTreeControl::getDefaultCollapsedGraphicURL() throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getDefaultCollapsedGraphicURL();
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::setDefaultCollapsedGraphicURL( const OUString& _defaultcollapsedgraphicurl ) throw (RuntimeException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->setDefaultCollapsedGraphicURL(_defaultcollapsedgraphicurl);
+}
+
+// -------------------------------------------------------------------
+
+sal_Bool SAL_CALL UnoTreeControl::isNodeExpanded( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeExpanded(xNode);
+}
+
+// -------------------------------------------------------------------
+
+sal_Bool SAL_CALL UnoTreeControl::isNodeCollapsed( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeCollapsed(xNode);
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::makeNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->makeNodeVisible(xNode);
+}
+
+// -------------------------------------------------------------------
+
+sal_Bool SAL_CALL UnoTreeControl::isNodeVisible( const Reference< XTreeNode >& xNode ) throw (RuntimeException, IllegalArgumentException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isNodeVisible(xNode);
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::expandNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->expandNode(xNode);
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::collapseNode( const Reference< XTreeNode >& xNode ) throw (RuntimeException, ExpandVetoException, IllegalArgumentException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->collapseNode(xNode);
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::addTreeExpansionListener( const Reference< XTreeExpansionListener >& xListener ) throw (RuntimeException)
+{
+ maTreeExpansionListeners.addInterface( xListener );
+ if( getPeer().is() && (maTreeExpansionListeners.getLength() == 1) )
+ {
+ // maSelectionListeners acts as a proxy,
+ // add it to the peer if this is the first listener added to that proxy
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addTreeExpansionListener(&maTreeExpansionListeners);
+ }
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::removeTreeExpansionListener( const Reference< XTreeExpansionListener >& xListener ) throw (RuntimeException)
+{
+ if( getPeer().is() && (maTreeExpansionListeners.getLength() == 1) )
+ {
+ // maSelectionListeners acts as a proxy,
+ // remove it from the peer if this is the last listener removed from that proxy
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeTreeExpansionListener(&maTreeExpansionListeners);
+ }
+ maTreeExpansionListeners.removeInterface( xListener );
+}
+
+// -------------------------------------------------------------------
+
+Reference< XTreeNode > SAL_CALL UnoTreeControl::getNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeForLocation(x,y);
+}
+
+// -------------------------------------------------------------------
+
+Reference< XTreeNode > SAL_CALL UnoTreeControl::getClosestNodeForLocation( sal_Int32 x, sal_Int32 y ) throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getClosestNodeForLocation(x,y);
+}
+
+// -------------------------------------------------------------------
+
+sal_Bool SAL_CALL UnoTreeControl::isEditing( ) throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->isEditing();
+}
+
+// -------------------------------------------------------------------
+
+sal_Bool SAL_CALL UnoTreeControl::stopEditing() throw (RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->stopEditing();
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::cancelEditing() throw (RuntimeException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->cancelEditing();
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::startEditingAtNode( const Reference< XTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->startEditingAtNode(xNode);
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::addTreeEditListener( const Reference< XTreeEditListener >& xListener ) throw (RuntimeException)
+{
+ maTreeEditListeners.addInterface( xListener );
+ if( getPeer().is() && (maTreeEditListeners.getLength() == 1) )
+ {
+ // maSelectionListeners acts as a proxy,
+ // add it to the peer if this is the first listener added to that proxy
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->addTreeEditListener(&maTreeEditListeners);
+ }
+}
+
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::removeTreeEditListener( const Reference< XTreeEditListener >& xListener ) throw (RuntimeException)
+{
+ if( getPeer().is() && (maTreeEditListeners.getLength() == 1) )
+ {
+ // maSelectionListeners acts as a proxy,
+ // remove it from the peer if this is the last listener removed from that proxy
+ Reference< XWindowPeer > xGcc3WorkaroundTemporary( getPeer());
+ Reference< XTreeControl >( xGcc3WorkaroundTemporary, UNO_QUERY_THROW )->removeTreeEditListener(&maTreeEditListeners);
+ }
+ maTreeEditListeners.removeInterface( xListener );
+}
+
+// -------------------------------------------------------------------
+// XComponent
+// -------------------------------------------------------------------
+
+void SAL_CALL UnoTreeControl::dispose( ) throw(RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
+ maSelectionListeners.disposeAndClear( aEvt );
+ maTreeExpansionListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoTreeControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ Reference< XTreeControl > xTree( getPeer(), UNO_QUERY_THROW );
+ if( maSelectionListeners.getLength() )
+ xTree->addSelectionChangeListener( &maSelectionListeners );
+ if( maTreeExpansionListeners.getLength() )
+ xTree->addTreeExpansionListener( &maTreeExpansionListeners );
+}
+
+}
+
+Reference< XInterface > SAL_CALL TreeControl_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeControl );
+}
+
+Reference< XInterface > SAL_CALL TreeControlModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeModel );
+}
+
+void SAL_CALL TreeEditListenerMultiplexer::nodeEditing( const Reference< XTreeNode >& Node ) throw (RuntimeException, ::com::sun::star::util::VetoException)
+{
+ ::cppu::OInterfaceIteratorHelper aIt( *this );
+ while( aIt.hasMoreElements() )
+ {
+ Reference< XTreeEditListener > xListener(static_cast< XTreeEditListener* >( aIt.next() ) );
+ try
+ {
+ xListener->nodeEditing( Node );
+ }
+ catch( DisposedException& e )
+ {
+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" );
+ if ( e.Context == xListener || !e.Context.is() )
+ aIt.remove();
+ }
+ catch( RuntimeException& e )
+ {
+ (void)e;
+ DISPLAY_EXCEPTION( TreeEditListenerMultiplexer, nodeEditing, e )
+ }
+ }
+}
+
+void SAL_CALL TreeEditListenerMultiplexer::nodeEdited( const Reference< XTreeNode >& Node, const OUString& NewText ) throw (RuntimeException)
+{
+ ::cppu::OInterfaceIteratorHelper aIt( *this );
+ while( aIt.hasMoreElements() )
+ {
+ Reference< XTreeEditListener > xListener( static_cast< XTreeEditListener* >( aIt.next() ) );
+ try
+ {
+ xListener->nodeEdited( Node, NewText );
+ }
+ catch( DisposedException& e )
+ {
+ OSL_ENSURE( e.Context.is(), "caught DisposedException with empty Context field" );
+ if ( e.Context == xListener || !e.Context.is() )
+ aIt.remove();
+ }
+ catch( RuntimeException& e )
+ {
+ (void)e;
+ DISPLAY_EXCEPTION( TreeEditListenerMultiplexer, nodeEdited, e )
+ }
+ }
+}
diff --git a/toolkit/source/controls/tree/treecontrol.hxx b/toolkit/source/controls/tree/treecontrol.hxx
new file mode 100644
index 000000000000..0cae86616aa4
--- /dev/null
+++ b/toolkit/source/controls/tree/treecontrol.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_TREE_CONTROL_HXX
+#define TOOLKIT_TREE_CONTROL_HXX
+
+#include <com/sun/star/awt/tree/XTreeControl.hpp>
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+namespace toolkit {
+
+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::container;
+
+// ===================================================================
+// = UnoTreeModel
+// ===================================================================
+class UnoTreeModel : public UnoControlModel
+{
+protected:
+ Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoTreeModel();
+ UnoTreeModel( const UnoTreeModel& rModel );
+
+ UnoControlModel* Clone() const;
+
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoTreeModel, UnoControlModel, szServiceName_TreeControlModel )
+};
+
+
+// ===================================================================
+// = UnoTreeControl
+// ===================================================================
+class UnoTreeControl : public ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::tree::XTreeControl >
+{
+public:
+ UnoTreeControl();
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XControl
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& Toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& Parent ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::view::XSelectionSupplier
+ virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::view::XMultiSelectionSupplier
+ virtual ::sal_Bool SAL_CALL addSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeSelection( const ::com::sun::star::uno::Any& Selection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getSelectionCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createSelectionEnumeration( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createReverseSelectionEnumeration( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::XTreeControl
+ virtual ::rtl::OUString SAL_CALL getDefaultExpandedGraphicURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultExpandedGraphicURL( const ::rtl::OUString& _defaultexpandedgraphicurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getDefaultCollapsedGraphicURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultCollapsedGraphicURL( const ::rtl::OUString& _defaultcollapsedgraphicurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isNodeExpanded( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isNodeCollapsed( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL makeNodeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isNodeVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL expandNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL collapseNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::awt::tree::ExpandVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTreeExpansionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeExpansionListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isEditing( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL stopEditing( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL cancelEditing( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startEditingAtNode( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTreeEditListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeEditListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoTreeControl, UnoControlBase, szServiceName_TreeControl )
+
+ using UnoControl::getPeer;
+private:
+ TreeSelectionListenerMultiplexer maSelectionListeners;
+ TreeExpansionListenerMultiplexer maTreeExpansionListeners;
+ TreeEditListenerMultiplexer maTreeEditListeners;
+};
+
+} // toolkit
+
+#endif // _TOOLKIT_TREE_CONTROL_HXX
diff --git a/toolkit/source/controls/tree/treedatamodel.cxx b/toolkit/source/controls/tree/treedatamodel.cxx
new file mode 100644
index 000000000000..8ca76c0e57a8
--- /dev/null
+++ b/toolkit/source/controls/tree/treedatamodel.cxx
@@ -0,0 +1,673 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/tree/XMutableTreeDataModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <rtl/ref.hxx>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::awt::tree;
+using namespace ::com::sun::star::lang;
+
+namespace toolkit
+{
+
+ enum broadcast_type { nodes_changed, nodes_inserted, nodes_removed, structure_changed };
+
+class MutableTreeNode;
+class MutableTreeDataModel;
+
+typedef rtl::Reference< MutableTreeNode > MutableTreeNodeRef;
+typedef std::vector< MutableTreeNodeRef > TreeNodeVector;
+typedef rtl::Reference< MutableTreeDataModel > MutableTreeDataModelRef;
+
+static void implThrowIllegalArgumentException() throw( IllegalArgumentException )
+{
+ throw IllegalArgumentException();
+}
+
+class MutableTreeDataModel : public ::cppu::WeakAggImplHelper2< XMutableTreeDataModel, XServiceInfo >,
+ public MutexAndBroadcastHelper
+{
+public:
+ MutableTreeDataModel();
+ virtual ~MutableTreeDataModel();
+
+ void broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >* pNodes, sal_Int32 nNodes );
+
+ // XMutableTreeDataModel
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode > SAL_CALL createNode( const ::com::sun::star::uno::Any& DisplayValue, ::sal_Bool ChildsOnDemand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRoot( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& RootNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XTreeDataModel
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getRoot( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTreeDataModelListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeDataModelListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTreeDataModelListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeDataModelListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose( ) throw (RuntimeException);
+ virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
+ virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+private:
+ bool mbDisposed;
+ Reference< XTreeNode > mxRootNode;
+};
+
+class MutableTreeNode: public ::cppu::WeakAggImplHelper2< XMutableTreeNode, XServiceInfo >
+{
+ friend class MutableTreeDataModel;
+
+public:
+ MutableTreeNode( const MutableTreeDataModelRef& xModel, const Any& rValue, sal_Bool bChildsOnDemand );
+ virtual ~MutableTreeNode();
+
+ void setParent( MutableTreeNode* pParent );
+ void broadcast_changes();
+ void broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew);
+
+ // XMutableTreeNode
+ virtual ::com::sun::star::uno::Any SAL_CALL getDataValue() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataValue( const ::com::sun::star::uno::Any& _datavalue ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL appendChild( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& ChildNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertChildByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XMutableTreeNode >& ChildNode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChildByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHasChildrenOnDemand( ::sal_Bool ChildrenOnDemand ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDisplayValue( const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setNodeGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setExpandedGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCollapsedGraphicURL( const ::rtl::OUString& URL ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTreeNode
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getChildAt( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getIndex( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tree::XTreeNode >& Node ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasChildrenOnDemand( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getDisplayValue( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getNodeGraphicURL( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getExpandedGraphicURL( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCollapsedGraphicURL( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
+ virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
+
+ static MutableTreeNode* getImplementation( const Reference< XTreeNode >& xNode, bool bThrows ) throw (IllegalArgumentException);
+ Reference< XTreeNode > getReference( MutableTreeNode* pNode )
+ {
+ return Reference< XTreeNode >( pNode );
+ }
+
+private:
+ TreeNodeVector maChilds;
+ Any maDisplayValue;
+ Any maDataValue;
+ sal_Bool mbHasChildsOnDemand;
+ ::osl::Mutex maMutex;
+ MutableTreeNode* mpParent;
+ MutableTreeDataModelRef mxModel;
+ OUString maNodeGraphicURL;
+ OUString maExpandedGraphicURL;
+ OUString maCollapsedGraphicURL;
+ bool mbIsInserted;
+};
+
+///////////////////////////////////////////////////////////////////////
+// class MutableTreeDataModel
+///////////////////////////////////////////////////////////////////////
+
+MutableTreeDataModel::MutableTreeDataModel()
+: mbDisposed( false )
+{
+}
+
+//---------------------------------------------------------------------
+
+MutableTreeDataModel::~MutableTreeDataModel()
+{
+}
+
+//---------------------------------------------------------------------
+
+void MutableTreeDataModel::broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >* pNodes, sal_Int32 nNodes )
+{
+ ::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( XTreeDataModelListener::static_type() );
+ if( pIter )
+ {
+ Reference< XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ const Sequence< Reference< XTreeNode > > aNodes( pNodes, nNodes );
+ TreeDataModelEvent aEvent( xSource, aNodes, xParentNode );
+
+ ::cppu::OInterfaceIteratorHelper aListIter(*pIter);
+ while(aListIter.hasMoreElements())
+ {
+ XTreeDataModelListener* pListener = static_cast<XTreeDataModelListener*>(aListIter.next());
+ switch( eType )
+ {
+ case nodes_changed: pListener->treeNodesChanged(aEvent); break;
+ case nodes_inserted: pListener->treeNodesInserted(aEvent); break;
+ case nodes_removed: pListener->treeNodesRemoved(aEvent); break;
+ case structure_changed: pListener->treeStructureChanged(aEvent); break;
+ }
+ }
+ }
+}
+
+//---------------------------------------------------------------------
+// XMutableTreeDataModel
+//---------------------------------------------------------------------
+
+Reference< XMutableTreeNode > SAL_CALL MutableTreeDataModel::createNode( const Any& aValue, sal_Bool bChildsOnDemand ) throw (RuntimeException)
+{
+ return new MutableTreeNode( this, aValue, bChildsOnDemand );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeDataModel::setRoot( const Reference< XMutableTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException)
+{
+ if( !xNode.is() )
+ throw IllegalArgumentException();
+
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if( xNode != mxRootNode )
+ {
+ if( mxRootNode.is() )
+ {
+ MutableTreeNodeRef xOldImpl( dynamic_cast< MutableTreeNode* >( mxRootNode.get() ) );
+ if( xOldImpl.is() )
+ xOldImpl->mbIsInserted = false;
+ }
+
+ MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
+ if( !xImpl.is() || xImpl->mbIsInserted )
+ throw IllegalArgumentException();
+
+ xImpl->mbIsInserted = true;
+ mxRootNode.set(xImpl.get());
+
+ Reference< XTreeNode > xParentNode;
+ broadcast( structure_changed, xParentNode, &mxRootNode, 1 );
+ }
+}
+
+//---------------------------------------------------------------------
+// XTreeDataModel
+//---------------------------------------------------------------------
+
+Reference< XTreeNode > SAL_CALL MutableTreeDataModel::getRoot( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return mxRootNode;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeDataModel::addTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XTreeDataModelListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeDataModel::removeTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XTreeDataModelListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+// XComponent
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeDataModel::dispose() throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( !mbDisposed )
+ {
+ mbDisposed = true;
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( static_cast< ::cppu::OWeakObject* >( this ) );
+ BrdcstHelper.aLC.disposeAndClear( aEvent );
+ }
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.addListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
+{
+ BrdcstHelper.removeListener( XEventListener::static_type(), xListener );
+}
+
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+OUString SAL_CALL MutableTreeDataModel::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.MutableTreeDataModel" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL MutableTreeDataModel::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return ServiceName.equalsAscii( szServiceName_MutableTreeDataModel );
+}
+
+//---------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL MutableTreeDataModel::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ static const OUString aServiceName( OUString::createFromAscii( szServiceName_MutableTreeDataModel ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+///////////////////////////////////////////////////////////////////////
+// class MutabelTreeNode
+///////////////////////////////////////////////////////////////////////
+
+MutableTreeNode::MutableTreeNode( const MutableTreeDataModelRef& xModel, const Any& rValue, sal_Bool bChildsOnDemand )
+: maDisplayValue( rValue )
+, mbHasChildsOnDemand( bChildsOnDemand )
+, mpParent( 0 )
+, mxModel( xModel )
+, mbIsInserted( false )
+{
+}
+
+//---------------------------------------------------------------------
+
+MutableTreeNode::~MutableTreeNode()
+{
+ TreeNodeVector::iterator aIter( maChilds.begin() );
+ while( aIter != maChilds.end() )
+ (*aIter++)->setParent(0);
+}
+
+//---------------------------------------------------------------------
+
+void MutableTreeNode::setParent( MutableTreeNode* pParent )
+{
+ mpParent = pParent;
+}
+
+//---------------------------------------------------------------------
+
+MutableTreeNode* MutableTreeNode::getImplementation( const Reference< XTreeNode >& xNode, bool bThrows ) throw (IllegalArgumentException)
+{
+ MutableTreeNode* pImpl = dynamic_cast< MutableTreeNode* >( xNode.get() );
+ if( bThrows && !pImpl )
+ implThrowIllegalArgumentException();
+
+ return pImpl;
+}
+
+//---------------------------------------------------------------------
+
+void MutableTreeNode::broadcast_changes()
+{
+ if( mxModel.is() )
+ {
+ Reference< XTreeNode > xParent( getReference( mpParent ) );
+ Reference< XTreeNode > xNode( getReference( this ) );
+ mxModel->broadcast( nodes_changed, xParent, &xNode, 1 );
+ }
+}
+
+//---------------------------------------------------------------------
+
+void MutableTreeNode::broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew)
+{
+ if( mxModel.is() )
+ {
+ Reference< XTreeNode > xParent( getReference( this ) );
+ mxModel->broadcast( bNew ? nodes_inserted : nodes_removed, xParent, &xNode, 1 );
+ }
+}
+
+//---------------------------------------------------------------------
+// XMutableTreeNode
+//---------------------------------------------------------------------
+
+Any SAL_CALL MutableTreeNode::getDataValue() throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return maDataValue;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::setDataValue( const Any& _datavalue ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ maDataValue = _datavalue;
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ Reference< XTreeNode > xNode( xChildNode.get() );
+ MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
+
+ if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) )
+ throw IllegalArgumentException();
+
+ maChilds.push_back( xImpl );
+ xImpl->setParent(this);
+ xImpl->mbIsInserted = true;
+
+ broadcast_changes( xNode, true );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+
+ if( (nChildIndex < 0) || (nChildIndex > (sal_Int32)maChilds.size()) )
+ throw IndexOutOfBoundsException();
+
+ Reference< XTreeNode > xNode( xChildNode.get() );
+ MutableTreeNodeRef xImpl( dynamic_cast< MutableTreeNode* >( xNode.get() ) );
+ if( !xImpl.is() || xImpl->mbIsInserted || (this == xImpl.get()) )
+ throw IllegalArgumentException();
+
+ xImpl->mbIsInserted = true;
+
+ TreeNodeVector::iterator aIter( maChilds.begin() );
+ while( (nChildIndex-- > 0) && (aIter != maChilds.end()) )
+ aIter++;
+
+ maChilds.insert( aIter, xImpl );
+ xImpl->setParent( this );
+
+ broadcast_changes( xNode, true );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+
+ MutableTreeNodeRef xImpl;
+
+ if( (nChildIndex >= 0) && (nChildIndex < (sal_Int32)maChilds.size()) )
+ {
+ TreeNodeVector::iterator aIter( maChilds.begin() );
+ while( nChildIndex-- && (aIter != maChilds.end()) )
+ aIter++;
+
+ if( aIter != maChilds.end() )
+ {
+ xImpl = (*aIter);
+ maChilds.erase( aIter );
+ }
+ }
+
+ if( !xImpl.is() )
+ throw IndexOutOfBoundsException();
+
+ xImpl->setParent(0);
+ xImpl->mbIsInserted = false;
+
+ broadcast_changes( getReference( xImpl.get() ), false );
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::setHasChildrenOnDemand( sal_Bool bChildsOnDemand ) throw (RuntimeException)
+{
+ bool bChanged;
+
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ bChanged = mbHasChildsOnDemand != bChildsOnDemand;
+ mbHasChildsOnDemand = bChildsOnDemand;
+ }
+
+ if( bChanged )
+ broadcast_changes();
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::setDisplayValue( const Any& aValue ) throw (RuntimeException)
+{
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ maDisplayValue = aValue;
+ }
+
+ broadcast_changes();
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::setNodeGraphicURL( const OUString& rURL ) throw (RuntimeException)
+{
+ bool bChanged;
+
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ bChanged = maNodeGraphicURL != rURL;
+ maNodeGraphicURL = rURL;
+ }
+
+ if( bChanged )
+ broadcast_changes();
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::setExpandedGraphicURL( const OUString& rURL ) throw (RuntimeException)
+{
+ bool bChanged;
+
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ bChanged = maExpandedGraphicURL != rURL;
+ maExpandedGraphicURL = rURL;
+ }
+
+ if( bChanged )
+ broadcast_changes();
+}
+
+//---------------------------------------------------------------------
+
+void SAL_CALL MutableTreeNode::setCollapsedGraphicURL( const OUString& rURL ) throw (RuntimeException)
+{
+ bool bChanged;
+
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ bChanged = maCollapsedGraphicURL != rURL;
+ maCollapsedGraphicURL = rURL;
+ }
+
+ if( bChanged )
+ broadcast_changes();
+}
+
+//---------------------------------------------------------------------
+// XTreeNode
+//---------------------------------------------------------------------
+
+Reference< XTreeNode > SAL_CALL MutableTreeNode::getChildAt( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException,RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+
+ if( (nChildIndex < 0) || (nChildIndex >= (sal_Int32)maChilds.size()) )
+ throw IndexOutOfBoundsException();
+ return getReference( maChilds[nChildIndex].get() );
+}
+
+//---------------------------------------------------------------------
+
+sal_Int32 SAL_CALL MutableTreeNode::getChildCount( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return (sal_Int32)maChilds.size();
+}
+
+//---------------------------------------------------------------------
+
+Reference< XTreeNode > SAL_CALL MutableTreeNode::getParent( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return getReference( mpParent );
+}
+
+//---------------------------------------------------------------------
+
+sal_Int32 SAL_CALL MutableTreeNode::getIndex( const Reference< XTreeNode >& xNode ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+
+ MutableTreeNodeRef xImpl( MutableTreeNode::getImplementation( xNode, false ) );
+ if( xImpl.is() )
+ {
+ sal_Int32 nChildCount = maChilds.size();
+ while( nChildCount-- )
+ {
+ if( maChilds[nChildCount] == xImpl )
+ return nChildCount;
+ }
+ }
+
+ return -1;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL MutableTreeNode::hasChildrenOnDemand( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return mbHasChildsOnDemand;
+}
+
+//---------------------------------------------------------------------
+
+Any SAL_CALL MutableTreeNode::getDisplayValue( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return maDisplayValue;
+}
+
+//---------------------------------------------------------------------
+
+OUString SAL_CALL MutableTreeNode::getNodeGraphicURL( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return maNodeGraphicURL;
+}
+
+//---------------------------------------------------------------------
+
+OUString SAL_CALL MutableTreeNode::getExpandedGraphicURL( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return maExpandedGraphicURL;
+}
+
+//---------------------------------------------------------------------
+
+OUString SAL_CALL MutableTreeNode::getCollapsedGraphicURL( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return maCollapsedGraphicURL;
+}
+
+//---------------------------------------------------------------------
+// XServiceInfo
+//---------------------------------------------------------------------
+
+OUString SAL_CALL MutableTreeNode::getImplementationName( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ static const OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.MutableTreeNode" ) );
+ return aImplName;
+}
+
+//---------------------------------------------------------------------
+
+sal_Bool SAL_CALL MutableTreeNode::supportsService( const OUString& ServiceName ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.awt.tree.MutableTreeNode" ) );
+}
+
+//---------------------------------------------------------------------
+
+Sequence< OUString > SAL_CALL MutableTreeNode::getSupportedServiceNames( ) throw (RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
+ static const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.tree.MutableTreeNode" ) );
+ static const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+}
+
+Reference< XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const Reference< XMultiServiceFactory >& )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::MutableTreeDataModel );
+}
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
new file mode 100644
index 000000000000..1abe0b34004f
--- /dev/null
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -0,0 +1,1537 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#ifndef _COM_SUN_STAR_LAN_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <toolkit/controls/unocontrol.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <vos/mutex.hxx>
+#include <tools/string.hxx>
+#include <tools/table.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <comphelper/stl_types.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <toolkit/controls/accessiblecontrolcontext.hxx>
+#include <comphelper/container.hxx>
+
+#include <algorithm>
+#include <set>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::util;
+
+using ::com::sun::star::accessibility::XAccessibleContext;
+using ::com::sun::star::accessibility::XAccessible;
+
+struct LanguageDependentProp
+{
+ const char* pPropName;
+ sal_Int32 nPropNameLength;
+};
+
+static const LanguageDependentProp aLanguageDependentProp[] =
+{
+ { "Text", 4 },
+ { "Label", 5 },
+ { "Title", 5 },
+ { "HelpText", 8 },
+ { "CurrencySymbol", 14 },
+ { "StringItemList", 14 },
+ { 0, 0 }
+};
+
+WorkWindow* lcl_GetDefaultWindow()
+{
+ static WorkWindow* pW = NULL;
+ if ( !pW )
+ {
+ pW = new WorkWindow( NULL, 0 );
+ pW->EnableChildTransparentMode();
+ }
+ return pW;
+}
+
+static Sequence< ::rtl::OUString> lcl_ImplGetPropertyNames( const Reference< XMultiPropertySet > & rxModel )
+{
+ Sequence< ::rtl::OUString> aNames;
+ Reference< XPropertySetInfo > xPSInf = rxModel->getPropertySetInfo();
+ DBG_ASSERT( xPSInf.is(), "UpdateFromModel: No PropertySetInfo!" );
+ if ( xPSInf.is() )
+ {
+ Sequence< Property> aProps = xPSInf->getProperties();
+ sal_Int32 nLen = aProps.getLength();
+ aNames = Sequence< ::rtl::OUString>( nLen );
+ ::rtl::OUString* pNames = aNames.getArray();
+ const Property* pProps = aProps.getConstArray();
+ for ( sal_Int32 n = 0; n < nLen; ++n, ++pProps, ++pNames)
+ *pNames = pProps->Name;
+ }
+ return aNames;
+}
+
+// ====================================================
+class VclListenerLock
+{
+private:
+ VCLXWindow* m_pLockWindow;
+
+public:
+ inline VclListenerLock( VCLXWindow* _pLockWindow )
+ :m_pLockWindow( _pLockWindow )
+ {
+ if ( m_pLockWindow )
+ m_pLockWindow->suspendVclEventListening( );
+ }
+ inline ~VclListenerLock( )
+ {
+ if ( m_pLockWindow )
+ m_pLockWindow->resumeVclEventListening( );
+ }
+
+private:
+ VclListenerLock(); // never implemented
+ VclListenerLock( const VclListenerLock& ); // never implemented
+ VclListenerLock& operator=( const VclListenerLock& ); // never implemented
+};
+
+typedef ::std::map< ::rtl::OUString, sal_Int32 > MapString2Int;
+struct UnoControl_Data
+{
+ MapString2Int aSuspendedPropertyNotifications;
+ /// true if and only if our model has a property ResourceResolver
+ bool bLocalizationSupport;
+
+ UnoControl_Data()
+ :aSuspendedPropertyNotifications()
+ ,bLocalizationSupport( false )
+ {
+ }
+};
+
+// ----------------------------------------------------
+// class UnoControl
+// ----------------------------------------------------
+DBG_NAME( UnoControl )
+UnoControl::UnoControl()
+ : maDisposeListeners( *this )
+ , maWindowListeners( *this )
+ , maFocusListeners( *this )
+ , maKeyListeners( *this )
+ , maMouseListeners( *this )
+ , maMouseMotionListeners( *this )
+ , maPaintListeners( *this )
+ , maModeChangeListeners( GetMutex() )
+ , mpData( new UnoControl_Data )
+{
+ DBG_CTOR( UnoControl, NULL );
+ mbDisposePeer = sal_True;
+ mbRefeshingPeer = sal_False;
+ mbCreatingPeer = sal_False;
+ mbCreatingCompatiblePeer = sal_False;
+ mbDesignMode = sal_False;
+}
+
+UnoControl::~UnoControl()
+{
+ DELETEZ( mpData );
+ DBG_DTOR( UnoControl, NULL );
+}
+
+::rtl::OUString UnoControl::GetComponentServiceName()
+{
+ return ::rtl::OUString();
+}
+
+Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer( sal_Bool bAcceptExistingPeer )
+{
+ DBG_ASSERT( !mbCreatingCompatiblePeer, "ImplGetCompatiblePeer - rekursive?" );
+
+ mbCreatingCompatiblePeer = sal_True;
+
+ Reference< XWindowPeer > xCompatiblePeer;
+
+ if ( bAcceptExistingPeer )
+ xCompatiblePeer = getPeer();
+
+ if ( !xCompatiblePeer.is() )
+ {
+ // Peer unsichtbar erzeugen...
+ sal_Bool bVis = maComponentInfos.bVisible;
+ if( bVis )
+ maComponentInfos.bVisible = sal_False;
+
+ Reference< XWindowPeer > xCurrentPeer = getPeer();
+ setPeer( NULL );
+
+ // queryInterface ourself, to allow aggregation
+ Reference< XControl > xMe;
+ OWeakAggObject::queryInterface( ::getCppuType( &xMe ) ) >>= xMe;
+
+ WorkWindow* pWW;
+ {
+ osl::Guard< vos::IMutex > aGuard( Application::GetSolarMutex() );
+ pWW = lcl_GetDefaultWindow();
+ }
+ try
+ {
+ xMe->createPeer( NULL, pWW->GetComponentInterface( sal_True ) );
+ }
+ catch( const Exception& )
+ {
+ mbCreatingCompatiblePeer = sal_False;
+ throw;
+ }
+ xCompatiblePeer = getPeer();
+ setPeer( xCurrentPeer );
+
+ if ( xCompatiblePeer.is() && mxGraphics.is() )
+ {
+ Reference< XView > xPeerView( xCompatiblePeer, UNO_QUERY );
+ if ( xPeerView.is() )
+ xPeerView->setGraphics( mxGraphics );
+ }
+
+ if( bVis )
+ maComponentInfos.bVisible = sal_True;
+ }
+
+ mbCreatingCompatiblePeer = sal_False;
+
+ return xCompatiblePeer;
+}
+
+bool UnoControl::ImplCheckLocalize( ::rtl::OUString& _rPossiblyLocalizable )
+{
+ if ( !mpData->bLocalizationSupport
+ || ( _rPossiblyLocalizable.getLength() == 0 )
+ || ( _rPossiblyLocalizable[0] != '&' )
+ // TODO: make this reasonable. At the moment, everything which by accident starts with a & is considered
+ // localizable, which is probably wrong.
+ )
+ return false;
+
+ try
+ {
+ Reference< XPropertySet > xPropSet( mxModel, UNO_QUERY_THROW );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver(
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
+ UNO_QUERY
+ );
+ if ( xStringResourceResolver.is() )
+ {
+ ::rtl::OUString aLocalizationKey( _rPossiblyLocalizable.copy( 1 ) );
+ _rPossiblyLocalizable = xStringResourceResolver->resolveString( aLocalizationKey );
+ return true;
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return false;
+}
+
+void UnoControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal )
+{
+ // since a change made in propertiesChange, we can't be sure that this is called with an valid getPeer(),
+ // this assumption may be false in some (seldom) multi-threading scenarios (cause propertiesChange
+ // releases our mutex before calling here in)
+ // That's why this additional check
+
+ if ( mxVclWindowPeer.is() )
+ {
+ Any aConvertedValue( rVal );
+
+ if ( mpData->bLocalizationSupport )
+ {
+ // We now support a mapping for language dependent properties. This is the
+ // central method to implement it.
+ if (( rPropName.equalsAsciiL( "Text", 4 )) ||
+ ( rPropName.equalsAsciiL( "Label", 5 )) ||
+ ( rPropName.equalsAsciiL( "Title", 5 )) ||
+ ( rPropName.equalsAsciiL( "HelpText", 8 )) ||
+ ( rPropName.equalsAsciiL( "CurrencySymbol", 14 )) ||
+ ( rPropName.equalsAsciiL( "StringItemList", 14 )) )
+ {
+ ::rtl::OUString aValue;
+ uno::Sequence< rtl::OUString > aSeqValue;
+ if ( aConvertedValue >>= aValue )
+ {
+ if ( ImplCheckLocalize( aValue ) )
+ aConvertedValue <<= aValue;
+ }
+ else if ( aConvertedValue >>= aSeqValue )
+ {
+ for ( sal_Int32 i = 0; i < aSeqValue.getLength(); i++ )
+ ImplCheckLocalize( aSeqValue[i] );
+ aConvertedValue <<= aSeqValue;
+ }
+ }
+ }
+
+ mxVclWindowPeer->setProperty( rPropName, aConvertedValue );
+ }
+}
+
+void UnoControl::PrepareWindowDescriptor( WindowDescriptor& )
+{
+}
+
+Reference< XWindow > UnoControl::getParentPeer() const
+{
+ Reference< XWindow > xPeer;
+ if( mxContext.is() )
+ {
+ Reference< XControl > xContComp( mxContext, UNO_QUERY );
+ if ( xContComp.is() )
+ {
+ Reference< XWindowPeer > xP = xContComp->getPeer();
+ if ( xP.is() )
+ xP->queryInterface( ::getCppuType((const Reference< XWindow >*)0) ) >>= xPeer;
+ }
+ }
+ return xPeer;
+}
+
+void UnoControl::updateFromModel()
+{
+ // Alle standard Properties werden ausgelesen und in das Peer uebertragen
+ if( getPeer().is() )
+ {
+ Reference< XMultiPropertySet > xPropSet( mxModel, UNO_QUERY );
+ if( xPropSet.is() )
+ {
+ Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
+ xPropSet->firePropertiesChangeEvent( aNames, this );
+ }
+ }
+}
+
+
+// XTypeProvider
+IMPL_IMPLEMENTATION_ID( UnoControl )
+
+void UnoControl::disposeAccessibleContext()
+{
+ Reference< XComponent > xContextComp( maAccessibleContext.get(), UNO_QUERY );
+ if ( xContextComp.is() )
+ {
+ maAccessibleContext = NULL;
+ try
+ {
+ xContextComp->removeEventListener( this );
+ xContextComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_ERROR( "UnoControl::disposeAccessibleContext: could not dispose my AccessibleContext!" );
+ }
+ }
+}
+
+void UnoControl::dispose( ) throw(RuntimeException)
+{
+ Reference< XWindowPeer > xPeer;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if( mbDisposePeer )
+ {
+ xPeer = mxPeer;
+ }
+ setPeer( NULL );
+ }
+ if( xPeer.is() )
+ {
+ xPeer->dispose();
+ }
+
+ // dispose and release our AccessibleContext
+ disposeAccessibleContext();
+
+ EventObject aDisposeEvent;
+ aDisposeEvent.Source = static_cast< XAggregation* >( this );
+
+ maDisposeListeners.disposeAndClear( aDisposeEvent );
+ maWindowListeners.disposeAndClear( aDisposeEvent );
+ maFocusListeners.disposeAndClear( aDisposeEvent );
+ maKeyListeners.disposeAndClear( aDisposeEvent );
+ maMouseListeners.disposeAndClear( aDisposeEvent );
+ maMouseMotionListeners.disposeAndClear( aDisposeEvent );
+ maPaintListeners.disposeAndClear( aDisposeEvent );
+ maModeChangeListeners.disposeAndClear( aDisposeEvent );
+
+ // Model wieder freigeben
+ setModel( Reference< XControlModel > () );
+ setContext( Reference< XInterface > () );
+}
+
+void UnoControl::addEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ maDisposeListeners.addInterface( rxListener );
+}
+
+void UnoControl::removeEventListener( const Reference< XEventListener >& rxListener ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ maDisposeListeners.removeInterface( rxListener );
+}
+
+sal_Bool UnoControl::requiresNewPeer( const ::rtl::OUString& /* _rPropertyName */ ) const
+{
+ return sal_False;
+}
+
+// XPropertiesChangeListener
+void UnoControl::propertiesChange( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+{
+ Sequence< PropertyChangeEvent > aEvents( rEvents );
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ if ( !mpData->aSuspendedPropertyNotifications.empty() )
+ {
+ // strip the property which we are currently updating (somewhere up the stack)
+ PropertyChangeEvent* pEvents = aEvents.getArray();
+ PropertyChangeEvent* pEventsEnd = pEvents + aEvents.getLength();
+ for ( ; pEvents < pEventsEnd; )
+ if ( mpData->aSuspendedPropertyNotifications.find( pEvents->PropertyName ) != mpData->aSuspendedPropertyNotifications.end() )
+ {
+ if ( pEvents != pEventsEnd )
+ ::std::copy( pEvents + 1, pEventsEnd, pEvents );
+ --pEventsEnd;
+ }
+ else
+ ++pEvents;
+ aEvents.realloc( pEventsEnd - aEvents.getConstArray() );
+
+ if ( !aEvents.getLength() )
+ return;
+ }
+ }
+
+ ImplModelPropertiesChanged( aEvents );
+}
+
+void UnoControl::ImplLockPropertyChangeNotification( const ::rtl::OUString& rPropertyName, bool bLock )
+{
+ MapString2Int::iterator pos = mpData->aSuspendedPropertyNotifications.find( rPropertyName );
+ if ( bLock )
+ {
+ if ( pos == mpData->aSuspendedPropertyNotifications.end() )
+ pos = mpData->aSuspendedPropertyNotifications.insert( MapString2Int::value_type( rPropertyName, 0 ) ).first;
+ ++pos->second;
+ }
+ else
+ {
+ OSL_ENSURE( pos != mpData->aSuspendedPropertyNotifications.end(), "UnoControl::ImplLockPropertyChangeNotification: property not locked!" );
+ if ( pos != mpData->aSuspendedPropertyNotifications.end() )
+ {
+ OSL_ENSURE( pos->second > 0, "UnoControl::ImplLockPropertyChangeNotification: invalid suspension counter!" );
+ if ( 0 == --pos->second )
+ mpData->aSuspendedPropertyNotifications.erase( pos );
+ }
+ }
+}
+
+void UnoControl::ImplLockPropertyChangeNotifications( const Sequence< ::rtl::OUString >& rPropertyNames, bool bLock )
+{
+ for ( const ::rtl::OUString* pPropertyName = rPropertyNames.getConstArray();
+ pPropertyName != rPropertyNames.getConstArray() + rPropertyNames.getLength();
+ ++pPropertyName
+ )
+ ImplLockPropertyChangeNotification( *pPropertyName, bLock );
+}
+
+void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents )
+{
+ ::osl::ClearableGuard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( getPeer().is() )
+ {
+ DECLARE_STL_VECTOR( PropertyValue, PropertyValueVector);
+ PropertyValueVector aPeerPropertiesToSet;
+ sal_Int32 nIndependentPos = 0;
+ bool bResourceResolverSet( false );
+ // position where to insert the independent properties into aPeerPropertiesToSet,
+ // dependent ones are inserted at the end of the vector
+
+ sal_Bool bNeedNewPeer = sal_False;
+ // some properties require a re-creation of the peer, 'cause they can't be changed on the fly
+
+ Reference< XControlModel > xOwnModel( getModel(), UNO_QUERY );
+ // our own model for comparison
+ Reference< XPropertySet > xPS( xOwnModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xPSI( xPS->getPropertySetInfo(), UNO_QUERY );
+ OSL_ENSURE( xPSI.is(), "UnoControl::ImplModelPropertiesChanged: should have property set meta data!" );
+
+ const PropertyChangeEvent* pEvents = rEvents.getConstArray();
+
+ sal_Int32 nLen = rEvents.getLength();
+ aPeerPropertiesToSet.reserve(nLen);
+
+ for( sal_Int32 i = 0; i < nLen; ++i, ++pEvents )
+ {
+ Reference< XControlModel > xModel( pEvents->Source, UNO_QUERY );
+ sal_Bool bOwnModel = xModel.get() == xOwnModel.get();
+ if ( !bOwnModel )
+ continue;
+
+ // Detect changes on our resource resolver which invalidates
+ // automatically some language dependent properties.
+ if ( pEvents->PropertyName.equalsAsciiL( "ResourceResolver", 16 ))
+ {
+ Reference< resource::XStringResourceResolver > xStrResolver;
+ if ( pEvents->NewValue >>= xStrResolver )
+ bResourceResolverSet = xStrResolver.is();
+ }
+
+ sal_uInt16 nPType = GetPropertyId( pEvents->PropertyName );
+ if ( mbDesignMode && mbDisposePeer && !mbRefeshingPeer && !mbCreatingPeer )
+ {
+ // if we're in design mode, then some properties can change which
+ // require creating a *new* peer (since these properties cannot
+ // be switched at existing peers)
+ if ( nPType )
+ bNeedNewPeer = ( nPType == BASEPROPERTY_BORDER )
+ || ( nPType == BASEPROPERTY_MULTILINE )
+ || ( nPType == BASEPROPERTY_DROPDOWN )
+ || ( nPType == BASEPROPERTY_HSCROLL )
+ || ( nPType == BASEPROPERTY_VSCROLL )
+ || ( nPType == BASEPROPERTY_AUTOHSCROLL )
+ || ( nPType == BASEPROPERTY_AUTOVSCROLL )
+ || ( nPType == BASEPROPERTY_ORIENTATION )
+ || ( nPType == BASEPROPERTY_SPIN )
+ || ( nPType == BASEPROPERTY_ALIGN )
+ || ( nPType == BASEPROPERTY_PAINTTRANSPARENT );
+ else
+ bNeedNewPeer = requiresNewPeer( pEvents->PropertyName );
+
+ if ( bNeedNewPeer )
+ break;
+ }
+
+ if ( nPType && ( nLen > 1 ) && DoesDependOnOthers( nPType ) )
+ {
+ // Properties die von anderen abhaengen erst hinterher einstellen,
+ // weil sie von anderen Properties abhaengig sind, die aber erst spaeter
+ // eingestellt werden, z.B. VALUE nach VALUEMIN/MAX.
+ aPeerPropertiesToSet.push_back(PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
+ }
+ else
+ {
+ if ( bResourceResolverSet )
+ {
+ // The resource resolver property change should be one of the first ones.
+ // All language dependent properties are dependent on this property.
+ // As BASEPROPERTY_NATIVE_WIDGET_LOOK is not dependent on resource
+ // resolver. We don't need to handle a special order for these two props.
+ aPeerPropertiesToSet.insert(
+ aPeerPropertiesToSet.begin(),
+ PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) );
+ ++nIndependentPos;
+ }
+ else if ( nPType == BASEPROPERTY_NATIVE_WIDGET_LOOK )
+ {
+ // since *a lot* of other properties might be overruled by this one, we need
+ // a special handling:
+ // NativeWidgetLook needs to be set first: If it is set to ON, all other
+ // properties describing the look (e.g. BackgroundColor) are ignored, anyway.
+ // If it is switched OFF, then we need to do it first because else it will
+ // overrule other look-related properties, and re-initialize them from system
+ // defaults.
+ aPeerPropertiesToSet.insert(
+ aPeerPropertiesToSet.begin(),
+ PropertyValue( pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE ) );
+ ++nIndependentPos;
+ }
+ else
+ {
+ aPeerPropertiesToSet.insert(aPeerPropertiesToSet.begin() + nIndependentPos,
+ PropertyValue(pEvents->PropertyName, 0, pEvents->NewValue, PropertyState_DIRECT_VALUE));
+ ++nIndependentPos;
+ }
+ }
+ }
+
+ Reference< XWindow > xParent = getParentPeer();
+ Reference< XControl > xThis( (XAggregation*)(::cppu::OWeakAggObject*)this, UNO_QUERY );
+ // call createPeer via a interface got from queryInterface, so the aggregating class can intercept it
+
+ DBG_ASSERT( !bNeedNewPeer || xParent.is(), "Need new peer, but don't have a parent!" );
+
+ // Check if we have to update language dependent properties
+ if ( !bNeedNewPeer && bResourceResolverSet )
+ {
+ // Add language dependent properties into the peer property set.
+ // Our resource resolver has been changed and we must be sure
+ // that language dependent props use the new resolver.
+ const LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
+ while ( pLangDepProp->pPropName != 0 )
+ {
+ bool bMustBeInserted( true );
+ for ( sal_uInt32 i = 0; i < aPeerPropertiesToSet.size(); i++ )
+ {
+ if ( aPeerPropertiesToSet[i].Name.equalsAsciiL(
+ pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
+ {
+ bMustBeInserted = false;
+ break;
+ }
+ }
+
+ if ( bMustBeInserted )
+ {
+ // Add language dependent props at the end
+ ::rtl::OUString aPropName( ::rtl::OUString::createFromAscii( pLangDepProp->pPropName ));
+ if ( xPSI.is() && xPSI->hasPropertyByName( aPropName ) )
+ {
+ aPeerPropertiesToSet.push_back(
+ PropertyValue( aPropName, 0, xPS->getPropertyValue( aPropName ), PropertyState_DIRECT_VALUE ) );
+ }
+ }
+
+ ++pLangDepProp;
+ }
+ }
+ aGuard.clear();
+
+ // clear the guard before creating a new peer - as usual, our peer implementations use the SolarMutex
+ // #82300# - 2000-12-21 - fs@openoffice.org
+ if (bNeedNewPeer && xParent.is())
+ {
+ NAMESPACE_VOS(OGuard) aVclGuard( Application::GetSolarMutex() );
+ // and now this is the final withdrawal:
+ // With 83561, I have no other idea than locking the SolarMutex here ....
+ // I really hate the fact that VCL is not theadsafe ....
+ // #83561# - 2001-03-01 - fs@openoffice.org
+
+ // Funktioniert beim Container nicht!
+ getPeer()->dispose();
+ mxPeer.clear();
+ mxVclWindowPeer = NULL;
+ mbRefeshingPeer = sal_True;
+ Reference< XWindowPeer > xP( xParent, UNO_QUERY );
+ xThis->createPeer( Reference< XToolkit > (), xP );
+ mbRefeshingPeer = sal_False;
+ aPeerPropertiesToSet.clear();
+ }
+
+ // lock the multiplexing of VCL events to our UNO listeners
+ // this is for compatibility reasons: in OOo 1.0.x, changes which were done at the
+ // model did not cause the listeners of the controls/peers to be called
+ // Since the implementations for the listeners changed a lot towards 1.1, this
+ // would not be the case anymore, if we would not do this listener-lock below
+ // #i14703# - 2003-05-23 - fs@openoffice.org
+ Window* pVclPeer = VCLUnoHelper::GetWindow( getPeer() );
+ VCLXWindow* pPeer = pVclPeer ? pVclPeer->GetWindowPeer() : NULL;
+ VclListenerLock aNoVclEventMultiplexing( pPeer );
+
+ // setting peer properties may result in an attemp to acquire the solar mutex, 'cause the peers
+ // usually don't have an own mutex but use the SolarMutex instead.
+ // To prevent deadlocks resulting from this, we do this without our own mutex locked
+ // 2000-11-03 - fs@openoffice.org
+ PropertyValueVectorIterator aEnd = aPeerPropertiesToSet.end();
+ for ( PropertyValueVectorIterator aLoop = aPeerPropertiesToSet.begin();
+ aLoop != aEnd;
+ ++aLoop
+ )
+ {
+ ImplSetPeerProperty( aLoop->Name, aLoop->Value );
+ }
+ }
+}
+
+void UnoControl::disposing( const EventObject& rEvt ) throw(RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // bei "Multible Inheritance" nicht unterschiedliche Typen vergleichen.
+
+ if ( maAccessibleContext.get() == rEvt.Source )
+ {
+ // just in case the context is disposed, but not released - ensure that we do not re-use it in the future
+ maAccessibleContext = NULL;
+ }
+ else if( mxModel.get() == Reference< XControlModel >(rEvt.Source,UNO_QUERY).get() )
+ {
+ // #62337# if the model dies, it does not make sense for us to live ...
+ Reference< XControl > xThis = this;
+
+ aGuard.clear();
+ xThis->dispose();
+
+ DBG_ASSERT( !mxModel.is(), "UnoControl::disposing: invalid dispose behaviour!" );
+ mxModel.clear();
+ }
+}
+
+
+void SAL_CALL UnoControl::setOutputSize( const awt::Size& aSize ) throw (RuntimeException)
+{
+ Reference< XWindow2 > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ }
+
+ if ( xPeerWindow.is() )
+ xPeerWindow->setOutputSize( aSize );
+}
+
+namespace
+{
+ template < typename RETVALTYPE >
+ RETVALTYPE lcl_askPeer( const uno::Reference< awt::XWindowPeer >& _rxPeer, RETVALTYPE (SAL_CALL XWindow2::*_pMethod)(), RETVALTYPE _aDefault )
+ {
+ RETVALTYPE aReturn( _aDefault );
+
+ Reference< XWindow2 > xPeerWindow( _rxPeer, UNO_QUERY );
+ if ( xPeerWindow.is() )
+ aReturn = (xPeerWindow.get()->*_pMethod)();
+
+ return aReturn;
+ }
+}
+
+awt::Size SAL_CALL UnoControl::getOutputSize( ) throw (RuntimeException)
+{
+ return lcl_askPeer( getPeer(), &XWindow2::getOutputSize, awt::Size() );
+}
+
+::sal_Bool SAL_CALL UnoControl::isVisible( ) throw (RuntimeException)
+{
+ return lcl_askPeer( getPeer(), &XWindow2::isVisible, maComponentInfos.bVisible );
+}
+
+::sal_Bool SAL_CALL UnoControl::isActive( ) throw (RuntimeException)
+{
+ return lcl_askPeer( getPeer(), &XWindow2::isActive, sal_False );
+}
+
+::sal_Bool SAL_CALL UnoControl::isEnabled( ) throw (RuntimeException)
+{
+ return lcl_askPeer( getPeer(), &XWindow2::isEnabled, maComponentInfos.bEnable );
+}
+
+::sal_Bool SAL_CALL UnoControl::hasFocus( ) throw (RuntimeException)
+{
+ return lcl_askPeer( getPeer(), &XWindow2::hasFocus, sal_False );
+}
+
+// XWindow
+void UnoControl::setPosSize( sal_Int32 X, sal_Int32 Y, sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) throw(RuntimeException)
+{
+ Reference< XWindow > xWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ if ( Flags & awt::PosSize::X )
+ maComponentInfos.nX = X;
+ if ( Flags & awt::PosSize::Y )
+ maComponentInfos.nY = Y;
+ if ( Flags & awt::PosSize::WIDTH )
+ maComponentInfos.nWidth = Width;
+ if ( Flags & awt::PosSize::HEIGHT )
+ maComponentInfos.nHeight = Height;
+ maComponentInfos.nFlags |= Flags;
+
+ xWindow = xWindow.query( getPeer() );
+ }
+
+ if( xWindow.is() )
+ xWindow->setPosSize( X, Y, Width, Height, Flags );
+}
+
+awt::Rectangle UnoControl::getPosSize( ) throw(RuntimeException)
+{
+ awt::Rectangle aRect( maComponentInfos.nX, maComponentInfos.nY, maComponentInfos.nWidth, maComponentInfos.nHeight);
+ Reference< XWindow > xWindow;
+
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xWindow = xWindow.query( getPeer() );
+ }
+
+ if( xWindow.is() )
+ aRect = xWindow->getPosSize();
+ return aRect;
+}
+
+void UnoControl::setVisible( sal_Bool bVisible ) throw(RuntimeException)
+{
+ Reference< XWindow > xWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ // Visible status ist Sache der View
+ maComponentInfos.bVisible = bVisible;
+ xWindow = xWindow.query( getPeer() );
+ }
+ if ( xWindow.is() )
+ xWindow->setVisible( bVisible );
+}
+
+void UnoControl::setEnable( sal_Bool bEnable ) throw(RuntimeException)
+{
+ Reference< XWindow > xWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ // Enable status ist Sache der View
+ maComponentInfos.bEnable = bEnable;
+ xWindow = xWindow.query( getPeer() );
+ }
+ if ( xWindow.is() )
+ xWindow->setEnable( bEnable );
+}
+
+void UnoControl::setFocus( ) throw(RuntimeException)
+{
+ Reference< XWindow > xWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xWindow = xWindow.query( getPeer() );
+ }
+ if ( xWindow.is() )
+ xWindow->setFocus();
+}
+
+void UnoControl::addWindowListener( const Reference< XWindowListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maWindowListeners.addInterface( rxListener );
+ if ( maWindowListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->addWindowListener( &maWindowListeners );
+}
+
+void UnoControl::removeWindowListener( const Reference< XWindowListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( maWindowListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ maWindowListeners.removeInterface( rxListener );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->removeWindowListener( &maWindowListeners );
+}
+
+void UnoControl::addFocusListener( const Reference< XFocusListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maFocusListeners.addInterface( rxListener );
+ if ( maFocusListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->addFocusListener( &maFocusListeners );
+}
+
+void UnoControl::removeFocusListener( const Reference< XFocusListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( maFocusListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ maFocusListeners.removeInterface( rxListener );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->removeFocusListener( &maFocusListeners );
+}
+
+void UnoControl::addKeyListener( const Reference< XKeyListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maKeyListeners.addInterface( rxListener );
+ if ( maKeyListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->addKeyListener( &maKeyListeners);
+}
+
+void UnoControl::removeKeyListener( const Reference< XKeyListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( maKeyListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ maKeyListeners.removeInterface( rxListener );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->removeKeyListener( &maKeyListeners);
+}
+
+void UnoControl::addMouseListener( const Reference< XMouseListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maMouseListeners.addInterface( rxListener );
+ if ( maMouseListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->addMouseListener( &maMouseListeners);
+}
+
+void UnoControl::removeMouseListener( const Reference< XMouseListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( maMouseListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ maMouseListeners.removeInterface( rxListener );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->removeMouseListener( &maMouseListeners );
+}
+
+void UnoControl::addMouseMotionListener( const Reference< XMouseMotionListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maMouseMotionListeners.addInterface( rxListener );
+ if ( maMouseMotionListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->addMouseMotionListener( &maMouseMotionListeners);
+}
+
+void UnoControl::removeMouseMotionListener( const Reference< XMouseMotionListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( maMouseMotionListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ maMouseMotionListeners.removeInterface( rxListener );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->removeMouseMotionListener( &maMouseMotionListeners );
+}
+
+void UnoControl::addPaintListener( const Reference< XPaintListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maPaintListeners.addInterface( rxListener );
+ if ( maPaintListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->addPaintListener( &maPaintListeners);
+}
+
+void UnoControl::removePaintListener( const Reference< XPaintListener >& rxListener ) throw(RuntimeException)
+{
+ Reference< XWindow > xPeerWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( maPaintListeners.getLength() == 1 )
+ xPeerWindow = xPeerWindow.query( getPeer() );
+ maPaintListeners.removeInterface( rxListener );
+ }
+ if ( xPeerWindow.is() )
+ xPeerWindow->removePaintListener( &maPaintListeners );
+}
+
+// XView
+sal_Bool UnoControl::setGraphics( const Reference< XGraphics >& rDevice ) throw(RuntimeException)
+{
+ Reference< XView > xView;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ mxGraphics = rDevice;
+ xView = xView.query( getPeer() );
+ }
+ return xView.is() ? xView->setGraphics( rDevice ) : sal_True;
+}
+
+Reference< XGraphics > UnoControl::getGraphics( ) throw(RuntimeException)
+{
+ return mxGraphics;
+}
+
+awt::Size UnoControl::getSize( ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return awt::Size( maComponentInfos.nWidth, maComponentInfos.nHeight );
+}
+
+void UnoControl::draw( sal_Int32 x, sal_Int32 y ) throw(RuntimeException)
+{
+ Reference< XWindowPeer > xDrawPeer;
+ Reference< XView > xDrawPeerView;
+
+ bool bDisposeDrawPeer( false );
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ xDrawPeer = ImplGetCompatiblePeer( sal_True );
+ bDisposeDrawPeer = xDrawPeer.is() && ( xDrawPeer != getPeer() );
+
+ xDrawPeerView.set( xDrawPeer, UNO_QUERY );
+ DBG_ASSERT( xDrawPeerView.is(), "UnoControl::draw: no peer!" );
+ }
+
+ if ( xDrawPeerView.is() )
+ {
+ Reference< XVclWindowPeer > xWindowPeer;
+ xWindowPeer.set( xDrawPeer, UNO_QUERY );
+ if ( xWindowPeer.is() )
+ xWindowPeer->setDesignMode( mbDesignMode );
+ xDrawPeerView->draw( x, y );
+ }
+
+ if ( bDisposeDrawPeer )
+ xDrawPeer->dispose();
+}
+
+void UnoControl::setZoom( float fZoomX, float fZoomY ) throw(RuntimeException)
+{
+ Reference< XView > xView;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ maComponentInfos.nZoomX = fZoomX;
+ maComponentInfos.nZoomY = fZoomY;
+
+ xView = xView.query( getPeer() );
+ }
+ if ( xView.is() )
+ xView->setZoom( fZoomX, fZoomY );
+}
+
+// XControl
+void UnoControl::setContext( const Reference< XInterface >& rxContext ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ mxContext = rxContext;
+}
+
+Reference< XInterface > UnoControl::getContext( ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ return mxContext;
+}
+
+void UnoControl::peerCreated()
+{
+ Reference< XWindow > xWindow( getPeer(), UNO_QUERY );
+ if ( !xWindow.is() )
+ return;
+
+ if ( maWindowListeners.getLength() )
+ xWindow->addWindowListener( &maWindowListeners );
+
+ if ( maFocusListeners.getLength() )
+ xWindow->addFocusListener( &maFocusListeners );
+
+ if ( maKeyListeners.getLength() )
+ xWindow->addKeyListener( &maKeyListeners );
+
+ if ( maMouseListeners.getLength() )
+ xWindow->addMouseListener( &maMouseListeners );
+
+ if ( maMouseMotionListeners.getLength() )
+ xWindow->addMouseMotionListener( &maMouseMotionListeners );
+
+ if ( maPaintListeners.getLength() )
+ xWindow->addPaintListener( &maPaintListeners );
+}
+
+void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Reference< XWindowPeer >& rParentPeer ) throw(RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+
+ if ( !mxModel.is() )
+ {
+ RuntimeException aException;
+ aException.Message = ::rtl::OUString::createFromAscii( "createPeer: no model!" );
+ aException.Context = (XAggregation*)(::cppu::OWeakAggObject*)this;
+ throw( aException );
+ }
+
+ if( !getPeer().is() )
+ {
+ mbCreatingPeer = sal_True;
+
+ WindowClass eType;
+ Reference< XToolkit > xToolkit = rxToolkit;
+ if( rParentPeer.is() && mxContext.is() )
+ {
+ // kein TopWindow
+ if ( !xToolkit.is() )
+ xToolkit = rParentPeer->getToolkit();
+ Any aAny = OWeakAggObject::queryInterface( ::getCppuType((const Reference< XControlContainer>*)0) );
+ Reference< XControlContainer > xC;
+ aAny >>= xC;
+ if( xC.is() )
+ // Es ist ein Container
+ eType = WindowClass_CONTAINER;
+ else
+ eType = WindowClass_SIMPLE;
+ }
+ else
+ { // Nur richtig, wenn es sich um ein Top Window handelt
+ if( rParentPeer.is() )
+ {
+ if ( !xToolkit.is() )
+ xToolkit = rParentPeer->getToolkit();
+ eType = WindowClass_CONTAINER;
+ }
+ else
+ {
+ if ( !xToolkit.is() )
+ xToolkit = VCLUnoHelper::CreateToolkit();
+ eType = WindowClass_TOP;
+ }
+ }
+ WindowDescriptor aDescr;
+ aDescr.Type = eType;
+ aDescr.WindowServiceName = GetComponentServiceName();
+ aDescr.Parent = rParentPeer;
+ aDescr.Bounds = getPosSize();
+ aDescr.WindowAttributes = 0;
+
+ // Border
+ Reference< XPropertySet > xPSet( mxModel, UNO_QUERY );
+ Reference< XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
+
+ Any aVal;
+ ::rtl::OUString aPropName = GetPropertyName( BASEPROPERTY_BORDER );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Int16 n = sal_Int16();
+ if ( aVal >>= n )
+ {
+ if ( n )
+ aDescr.WindowAttributes |= WindowAttribute::BORDER;
+ else
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::NOBORDER;
+ }
+ }
+
+ // DESKTOP_AS_PARENT
+ if ( aDescr.Type == WindowClass_TOP )
+ {
+ aPropName = GetPropertyName( BASEPROPERTY_DESKTOP_AS_PARENT );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.ParentIndex = -1;
+ }
+ }
+ // Moveable
+ aPropName = GetPropertyName( BASEPROPERTY_MOVEABLE );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= WindowAttribute::MOVEABLE;
+ }
+
+ // Closeable
+ aPropName = GetPropertyName( BASEPROPERTY_CLOSEABLE );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= WindowAttribute::CLOSEABLE;
+ }
+
+ // Dropdown
+ aPropName = GetPropertyName( BASEPROPERTY_DROPDOWN );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::DROPDOWN;
+ }
+
+ // Spin
+ aPropName = GetPropertyName( BASEPROPERTY_SPIN );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::SPIN;
+ }
+
+ // HScroll
+ aPropName = GetPropertyName( BASEPROPERTY_HSCROLL );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::HSCROLL;
+ }
+
+ // VScroll
+ aPropName = GetPropertyName( BASEPROPERTY_VSCROLL );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::VSCROLL;
+ }
+
+ // AutoHScroll
+ aPropName = GetPropertyName( BASEPROPERTY_AUTOHSCROLL );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOHSCROLL;
+ }
+
+ // AutoVScroll
+ aPropName = GetPropertyName( BASEPROPERTY_AUTOVSCROLL );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b)
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::AUTOVSCROLL;
+ }
+
+ //added for issue79712
+ //NoLabel
+ aPropName = GetPropertyName( BASEPROPERTY_NOLABEL );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>=b ) && b )
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::NOLABEL;
+ }
+ //issue79712 ends
+
+ // Align
+ aPropName = GetPropertyName( BASEPROPERTY_ALIGN );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ aVal = xPSet->getPropertyValue( aPropName );
+ sal_Int16 n = sal_Int16();
+ if ( aVal >>= n )
+ {
+ if ( n == PROPERTY_ALIGN_LEFT )
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::LEFT;
+ else if ( n == PROPERTY_ALIGN_CENTER )
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::CENTER;
+ else
+ aDescr.WindowAttributes |= VclWindowPeerAttribute::RIGHT;
+ }
+ }
+
+ // Ableitungen die Moeglichkeit geben die Attribute zu manipulieren
+ PrepareWindowDescriptor(aDescr);
+
+ // create the peer
+ setPeer( xToolkit->createWindow( aDescr ) );
+
+ // release the mutex guard (and work with copies of our members)
+ // this is necessary as our peer may lock the SolarMutex (actually, all currently known peers do), so calling
+ // into the peer with our own mutex locked may cause deadlocks
+ // (We _really_ need peers which do not use the SolarMutex. It's really pissing me off that from time to
+ // time deadlocks pop up because the low-level components like our peers use a mutex which ususally
+ // is locked at the top of the stack (it protects the global message looping). This is always dangerous, and
+ // can not always be solved by tampering with other mutexes.
+ // Unfortunately, the VCL used in the peers is not threadsafe, and by definition needs a locked SolarMutex.)
+ // 82300 - 12/21/00 - FS
+ UnoControlComponentInfos aComponentInfos(maComponentInfos);
+ sal_Bool bDesignMode(mbDesignMode);
+
+ Reference< XGraphics > xGraphics( mxGraphics );
+ Reference< XView > xView ( getPeer(), UNO_QUERY );
+ Reference< XWindow > xWindow ( getPeer(), UNO_QUERY );
+
+ aGuard.clear();
+
+ // the updateFromModel is done without a locked mutex, too.
+ // The reason is that the only thing this method does is firing property changes, and this in general has
+ // to be done without locked mutexes (as every notification to external listeners).
+ // 82300 - 12/21/00 - FS
+ updateFromModel();
+
+ xView->setZoom( aComponentInfos.nZoomX, aComponentInfos.nZoomY );
+
+ setPosSize( aComponentInfos.nX, aComponentInfos.nY, aComponentInfos.nWidth, aComponentInfos.nHeight, aComponentInfos.nFlags );
+
+ if( aComponentInfos.bVisible && !bDesignMode )
+ // Erst nach dem setzen der Daten anzeigen
+ xWindow->setVisible( aComponentInfos.bVisible );
+
+ if( !aComponentInfos.bEnable )
+ xWindow->setEnable( aComponentInfos.bEnable );
+
+ xView->setGraphics( xGraphics );
+
+ peerCreated();
+
+ mbCreatingPeer = sal_False;
+ }
+}
+
+Reference< XWindowPeer > UnoControl::getPeer() throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return mxPeer;
+}
+
+sal_Bool UnoControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ Reference< XMultiPropertySet > xPropSet( mxModel, UNO_QUERY );
+
+ // query for the XPropertiesChangeListener - our delegator is allowed to overwrite this interface
+ Reference< XPropertiesChangeListener > xListener;
+ queryInterface( ::getCppuType( &xListener ) ) >>= xListener;
+
+ if( xPropSet.is() )
+ xPropSet->removePropertiesChangeListener( xListener );
+
+ mpData->bLocalizationSupport = false;
+ mxModel = rxModel;
+
+ if( mxModel.is() )
+ {
+ try
+ {
+ xPropSet.set( mxModel, UNO_QUERY_THROW );
+ Reference< XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), UNO_SET_THROW );
+
+ Sequence< ::rtl::OUString> aNames = lcl_ImplGetPropertyNames( xPropSet );
+ xPropSet->addPropertiesChangeListener( aNames, xListener );
+
+ mpData->bLocalizationSupport = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ mxModel.clear();
+ }
+ }
+
+ return mxModel.is();
+}
+
+Reference< XControlModel > UnoControl::getModel( ) throw(RuntimeException)
+{
+ return mxModel;
+}
+
+Reference< XView > UnoControl::getView( ) throw(RuntimeException)
+{
+ return static_cast< XView* >( this );
+}
+
+void UnoControl::setDesignMode( sal_Bool bOn ) throw(RuntimeException)
+{
+ ModeChangeEvent aModeChangeEvent;
+
+ Reference< XWindow > xWindow;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if ( bOn == mbDesignMode )
+ return;
+
+ // remember this
+ mbDesignMode = bOn;
+ xWindow = xWindow.query( getPeer() );
+ // dispose our current AccessibleContext, if we have one
+ // (changing the design mode implies having a new implementation for this context,
+ // so the old one must be declared DEFUNC)
+ disposeAccessibleContext();
+
+ aModeChangeEvent.Source = *this;
+ aModeChangeEvent.NewMode = ::rtl::OUString::createFromAscii( mbDesignMode ? "design" : "alive" );
+ }
+
+ // ajust the visibility of our window
+ if ( xWindow.is() )
+ xWindow->setVisible( !bOn );
+
+ // and notify our mode listeners
+ maModeChangeListeners.notifyEach( &XModeChangeListener::modeChanged, aModeChangeEvent );
+}
+
+sal_Bool UnoControl::isDesignMode( ) throw(RuntimeException)
+{
+ return mbDesignMode;
+}
+
+sal_Bool UnoControl::isTransparent( ) throw(RuntimeException)
+{
+ return sal_False;
+}
+
+// XServiceInfo
+::rtl::OUString UnoControl::getImplementationName( ) throw(RuntimeException)
+{
+ DBG_ERROR( "This method should be overloaded!" );
+ return ::rtl::OUString();
+}
+
+sal_Bool UnoControl::supportsService( const ::rtl::OUString& rServiceName ) throw(RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString* pArray = aSNL.getConstArray();
+ const ::rtl::OUString* pArrayEnd = aSNL.getConstArray();
+ for (; pArray != pArrayEnd; ++pArray )
+ if( *pArray == rServiceName )
+ break;
+
+ return pArray != pArrayEnd;
+}
+
+Sequence< ::rtl::OUString > UnoControl::getSupportedServiceNames( ) throw(RuntimeException)
+{
+ ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControl" ) );
+ return Sequence< ::rtl::OUString >( &sName, 1 );
+}
+
+// ------------------------------------------------------------------------
+Reference< XAccessibleContext > SAL_CALL UnoControl::getAccessibleContext( ) throw (RuntimeException)
+{
+ // creation of the context will certainly require the SolarMutex ...
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ Reference< XAccessibleContext > xCurrentContext( maAccessibleContext.get(), UNO_QUERY );
+ if ( !xCurrentContext.is() )
+ {
+ if ( !mbDesignMode )
+ { // in alive mode, use the AccessibleContext of the peer
+ Reference< XAccessible > xPeerAcc( getPeer(), UNO_QUERY );
+ if ( xPeerAcc.is() )
+ xCurrentContext = xPeerAcc->getAccessibleContext( );
+ }
+ else
+ // in design mode, use a fallback
+ xCurrentContext = ::toolkit::OAccessibleControlContext::create( this );
+
+ DBG_ASSERT( xCurrentContext.is(), "UnoControl::getAccessibleContext: invalid context (invalid peer?)!" );
+ maAccessibleContext = xCurrentContext;
+
+ // get notified when the context is disposed
+ Reference< XComponent > xContextComp( xCurrentContext, UNO_QUERY );
+ if ( xContextComp.is() )
+ xContextComp->addEventListener( this );
+ // In an ideal world, this is not necessary - there the object would be released as soon as it has been
+ // disposed, and thus our weak reference would be empty, too.
+ // But 'til this ideal world comes (means 'til we do never have any refcount/lifetime bugs anymore), we
+ // need to listen for disposal and reset our weak reference then.
+ }
+
+ return xCurrentContext;
+}
+
+void SAL_CALL UnoControl::addModeChangeListener( const Reference< XModeChangeListener >& _rxListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maModeChangeListeners.addInterface( _rxListener );
+}
+
+void SAL_CALL UnoControl::removeModeChangeListener( const Reference< XModeChangeListener >& _rxListener ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ maModeChangeListeners.removeInterface( _rxListener );
+}
+
+void SAL_CALL UnoControl::addModeChangeApproveListener( const Reference< XModeChangeApproveListener >& ) throw (NoSupportException, RuntimeException)
+{
+ throw NoSupportException( );
+}
+
+void SAL_CALL UnoControl::removeModeChangeApproveListener( const Reference< XModeChangeApproveListener >& ) throw (NoSupportException, RuntimeException)
+{
+ throw NoSupportException( );
+}
+
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
new file mode 100644
index 000000000000..bbd0fc507e80
--- /dev/null
+++ b/toolkit/source/controls/unocontrolbase.cxx
@@ -0,0 +1,285 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/property.hxx>
+
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class UnoControlBase
+// ----------------------------------------------------
+
+sal_Bool UnoControlBase::ImplHasProperty( sal_uInt16 nPropId )
+{
+ ::rtl::OUString aPropName( GetPropertyName( nPropId ) );
+ return ImplHasProperty( aPropName );
+}
+
+sal_Bool UnoControlBase::ImplHasProperty( const ::rtl::OUString& aPropertyName )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ if ( !xPSet.is() )
+ return sal_False;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo = xPSet->getPropertySetInfo();
+ if ( !xInfo.is() )
+ return sal_False;
+
+ return xInfo->hasPropertyByName( aPropertyName );
+}
+
+void UnoControlBase::ImplSetPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Bool bUpdateThis )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > xMPS( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ if ( !mxModel.is() )
+ return;
+
+ DBG_ASSERT( xMPS.is(), "UnoControlBase::ImplSetPropertyValues: no multi property set interface!" );
+ if ( xMPS.is() )
+ {
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotifications( aPropertyNames, true );
+
+ try
+ {
+ xMPS->setPropertyValues( aPropertyNames, aValues );
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotifications( aPropertyNames, false );
+ }
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotifications( aPropertyNames, false );
+ }
+ else
+ {
+ int dummy = 0;
+ (void)dummy;
+ }
+}
+
+void UnoControlBase::ImplSetPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Bool bUpdateThis )
+{
+ // Model ggf. schon abgemeldet, aber ein Event schlaegt noch zu...
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotification( aPropertyName, true );
+
+ try
+ {
+ xPSet->setPropertyValue( aPropertyName, aValue );
+ }
+ catch( const com::sun::star::uno::Exception& )
+ {
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotification( aPropertyName, false );
+ throw;
+ }
+ if ( !bUpdateThis )
+ ImplLockPropertyChangeNotification( aPropertyName, false );
+ }
+}
+
+::com::sun::star::uno::Any UnoControlBase::ImplGetPropertyValue( const ::rtl::OUString& aPropertyName )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPSet( mxModel, ::com::sun::star::uno::UNO_QUERY );
+ if ( xPSet.is() )
+ return xPSet->getPropertyValue( aPropertyName );
+ else
+ return ::com::sun::star::uno::Any();
+}
+
+sal_Bool UnoControlBase::ImplGetPropertyValue_BOOL( sal_uInt16 nProp )
+{
+ sal_Bool b = sal_False;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= b;
+ }
+ return b;
+}
+
+sal_Int16 UnoControlBase::ImplGetPropertyValue_INT16( sal_uInt16 nProp )
+{
+ sal_Int16 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+sal_uInt16 UnoControlBase::ImplGetPropertyValue_UINT16( sal_uInt16 nProp )
+{
+ sal_uInt16 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+sal_Int32 UnoControlBase::ImplGetPropertyValue_INT32( sal_uInt16 nProp )
+{
+ sal_Int32 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+sal_uInt32 UnoControlBase::ImplGetPropertyValue_UINT32( sal_uInt16 nProp )
+{
+ sal_uInt32 n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+double UnoControlBase::ImplGetPropertyValue_DOUBLE( sal_uInt16 nProp )
+{
+ double n = 0;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= n;
+ }
+ return n;
+}
+
+::rtl::OUString UnoControlBase::ImplGetPropertyValue_UString( sal_uInt16 nProp )
+{
+ ::rtl::OUString aStr;
+ if ( mxModel.is() )
+ {
+ ::com::sun::star::uno::Any aVal = ImplGetPropertyValue( GetPropertyName( nProp ) );
+ aVal >>= aStr;
+ }
+ return aStr;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize()
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->getMinimumSize();
+
+ if ( !getPeer().is() || ( getPeer() != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_getPreferredSize()
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->getPreferredSize();
+
+ if ( !getPeer().is() || ( getPeer() != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_calcAdjustedSize( const ::com::sun::star::awt::Size& rNewSize )
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->calcAdjustedSize( rNewSize );
+
+ if ( !getPeer().is() || ( getPeer() != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+::com::sun::star::awt::Size UnoControlBase::Impl_getMinimumSize( sal_Int16 nCols, sal_Int16 nLines )
+{
+ ::com::sun::star::awt::Size aSz;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ aSz = xL->getMinimumSize( nCols, nLines );
+
+ if ( !getPeer().is() || ( getPeer() != xP ) )
+ xP->dispose();
+ }
+ return aSz;
+}
+
+void UnoControlBase::Impl_getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xP = ImplGetCompatiblePeer( sal_True );
+ DBG_ASSERT( xP.is(), "Layout: No Peer!" );
+ if ( xP.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextLayoutConstrains > xL( xP, ::com::sun::star::uno::UNO_QUERY );
+ if ( xL.is() )
+ xL->getColumnsAndLines( nCols, nLines );
+
+ if ( !getPeer().is() || ( getPeer() != xP ) )
+ xP->dispose();
+ }
+}
+
+
+
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
new file mode 100644
index 000000000000..c3149a8cc869
--- /dev/null
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -0,0 +1,834 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <com/sun/star/awt/XVclContainerPeer.hpp>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <comphelper/sequence.hxx>
+
+#include <tools/debug.hxx>
+#include <tools/list.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+
+#include <limits>
+#include <map>
+#include <boost/shared_ptr.hpp>
+
+using namespace ::com::sun::star;
+
+extern WorkWindow* lcl_GetDefaultWindow();
+
+// ----------------------------------------------------
+// class UnoControlHolder
+// ----------------------------------------------------
+struct UnoControlHolder
+{
+ uno::Reference< awt::XControl > mxControl;
+ ::rtl::OUString msName;
+
+public:
+ UnoControlHolder( const ::rtl::OUString& rName, const uno::Reference< awt::XControl > & rControl )
+ : mxControl( rControl ),
+ msName( rName )
+ {
+ }
+
+ inline const ::rtl::OUString& getName() const { return msName; }
+ inline const uno::Reference< awt::XControl >& getControl() const { return mxControl; }
+};
+
+//DECLARE_LIST( UnoControlHolderList, UnoControlHolder* );
+
+class UnoControlHolderList
+{
+public:
+ typedef sal_Int32 ControlIdentifier;
+private:
+ typedef ::boost::shared_ptr< UnoControlHolder > ControlInfo;
+ typedef ::std::map< ControlIdentifier, ControlInfo > ControlMap;
+
+private:
+ ControlMap maControls;
+
+public:
+ UnoControlHolderList();
+ ~UnoControlHolderList();
+
+ /** adds a control with the given name to the list
+ @param _rxControl
+ the control to add. Must not be <NULL/>
+ @param _pBName
+ the name of the control, or <NULL/> if an automatic name should be generated
+ @return
+ the identifier of the newly added control
+ */
+ ControlIdentifier addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName );
+
+ /** returns the number of controls in the list
+ */
+ inline size_t size() const { return maControls.size(); }
+
+ /** determines whether or not the list is empty
+ */
+ inline bool empty() const { return maControls.empty(); }
+
+ /** retrieves all controls currently in the list
+ @return
+ the number of controls in the list
+ */
+ size_t getControls( uno::Sequence< uno::Reference< awt::XControl > >& _out_rControls ) const;
+
+ /** retrieves all identifiers of all controls currently in the list
+ @return
+ the number of controls in the list
+ */
+ size_t getIdentifiers( uno::Sequence< sal_Int32 >& _out_rIdentifiers ) const;
+
+ /** returns the first control which is registered under the given name
+ */
+ uno::Reference< awt::XControl >
+ getControlForName( const ::rtl::OUString& _rName ) const;
+
+ /** returns the identifier which a control is registered for, or -1 if the control
+ isn't registered
+ */
+ ControlIdentifier
+ getControlIdentifier( const uno::Reference< awt::XControl >& _rxControl );
+
+ /** retrieves the control for a given id
+ @param _nIdentifier
+ the identifier for the control
+ @param _out_rxControl
+ takes the XControl upon successful return
+ @return
+ <TRUE/> if and only if a control with the given id is part of the list
+ */
+ bool getControlForIdentifier( ControlIdentifier _nIdentifier, uno::Reference< awt::XControl >& _out_rxControl ) const;
+
+ /** removes a control from the list, given by id
+ @param _nId
+ The identifier of the control to remove.
+ */
+ void removeControlById( ControlIdentifier _nId );
+
+ /** replaces a control from the list with another one
+ @param _nId
+ The identifier of the control to replace
+ @param _rxNewControl
+ the new control to put into the list
+ */
+ void replaceControlById( ControlIdentifier _nId, const uno::Reference< awt::XControl >& _rxNewControl );
+
+private:
+ /** adds a control
+ @param _rxControl
+ the control to add to the container
+ @param _pName
+ pointer to the name of the control. Might be <NULL/>, in this case, a name is generated.
+ @return
+ the identifier of the newly inserted control
+ */
+ ControlIdentifier impl_addControl(
+ const uno::Reference< awt::XControl >& _rxControl,
+ const ::rtl::OUString* _pName
+ );
+
+ /** finds a free identifier
+ @throw uno::RuntimeException
+ if no free identifier can be found
+ */
+ ControlIdentifier impl_getFreeIdentifier_throw();
+
+ /** finds a free name
+ @throw uno::RuntimeException
+ if no free name can be found
+ */
+ ::rtl::OUString impl_getFreeName_throw();
+};
+
+//------------------------------------------------------------------------
+UnoControlHolderList::UnoControlHolderList()
+{
+}
+
+//------------------------------------------------------------------------
+UnoControlHolderList::~UnoControlHolderList()
+{
+}
+
+//------------------------------------------------------------------------
+UnoControlHolderList::ControlIdentifier UnoControlHolderList::addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName )
+{
+ return impl_addControl( _rxControl, _pName );
+}
+
+//------------------------------------------------------------------------
+size_t UnoControlHolderList::getControls( uno::Sequence< uno::Reference< awt::XControl > >& _out_rControls ) const
+{
+ _out_rControls.realloc( maControls.size() );
+ uno::Reference< awt::XControl >* pControls = _out_rControls.getArray();
+ for ( ControlMap::const_iterator loop = maControls.begin();
+ loop != maControls.end();
+ ++loop, ++pControls
+ )
+ *pControls = loop->second->getControl();
+ return maControls.size();
+}
+
+//------------------------------------------------------------------------
+size_t UnoControlHolderList::getIdentifiers( uno::Sequence< sal_Int32 >& _out_rIdentifiers ) const
+{
+ _out_rIdentifiers.realloc( maControls.size() );
+ sal_Int32* pIndentifiers = _out_rIdentifiers.getArray();
+ for ( ControlMap::const_iterator loop = maControls.begin();
+ loop != maControls.end();
+ ++loop, ++pIndentifiers
+ )
+ *pIndentifiers = loop->first;
+ return maControls.size();
+}
+
+//------------------------------------------------------------------------
+uno::Reference< awt::XControl > UnoControlHolderList::getControlForName( const ::rtl::OUString& _rName ) const
+{
+ for ( ControlMap::const_iterator loop = maControls.begin();
+ loop != maControls.end();
+ ++loop
+ )
+ if ( loop->second->getName() == _rName )
+ return loop->second->getControl();
+ return uno::Reference< awt::XControl >();
+}
+
+//------------------------------------------------------------------------
+UnoControlHolderList::ControlIdentifier UnoControlHolderList::getControlIdentifier( const uno::Reference< awt::XControl >& _rxControl )
+{
+ for ( ControlMap::iterator loop = maControls.begin();
+ loop != maControls.end();
+ ++loop
+ )
+ {
+ if ( loop->second->getControl().get() == _rxControl.get() )
+ return loop->first;
+ }
+ return -1;
+}
+
+//------------------------------------------------------------------------
+bool UnoControlHolderList::getControlForIdentifier( UnoControlHolderList::ControlIdentifier _nIdentifier, uno::Reference< awt::XControl >& _out_rxControl ) const
+{
+ ControlMap::const_iterator pos = maControls.find( _nIdentifier );
+ if ( pos == maControls.end() )
+ return false;
+ _out_rxControl = pos->second->getControl();
+ return true;
+}
+
+//------------------------------------------------------------------------
+void UnoControlHolderList::removeControlById( UnoControlHolderList::ControlIdentifier _nId )
+{
+ ControlMap::iterator pos = maControls.find( _nId );
+ DBG_ASSERT( pos != maControls.end(), "UnoControlHolderList::removeControlById: invalid id!" );
+ if ( pos == maControls.end() )
+ return;
+
+ maControls.erase( pos );
+}
+
+//------------------------------------------------------------------------
+void UnoControlHolderList::replaceControlById( ControlIdentifier _nId, const uno::Reference< awt::XControl >& _rxNewControl )
+{
+ DBG_ASSERT( _rxNewControl.is(), "UnoControlHolderList::replaceControlById: invalid new control!" );
+
+ ControlMap::iterator pos = maControls.find( _nId );
+ DBG_ASSERT( pos != maControls.end(), "UnoControlHolderList::replaceControlById: invalid id!" );
+ if ( pos == maControls.end() )
+ return;
+
+ pos->second.reset( new UnoControlHolder( pos->second->getName(), _rxNewControl ) );
+}
+
+//------------------------------------------------------------------------
+UnoControlHolderList::ControlIdentifier UnoControlHolderList::impl_addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName )
+{
+ DBG_ASSERT( _rxControl.is(), "UnoControlHolderList::impl_addControl: invalid control!" );
+
+ ::rtl::OUString sName = _pName ? *_pName : impl_getFreeName_throw();
+ sal_Int32 nId = impl_getFreeIdentifier_throw();
+
+ maControls[ nId ] = ControlInfo( new UnoControlHolder( sName, _rxControl ) );
+ return nId;
+}
+
+//------------------------------------------------------------------------
+UnoControlHolderList::ControlIdentifier UnoControlHolderList::impl_getFreeIdentifier_throw()
+{
+ for ( ControlIdentifier candidateId = 0; candidateId < ::std::numeric_limits< ControlIdentifier >::max(); ++candidateId )
+ {
+ ControlMap::const_iterator existent = maControls.find( candidateId );
+ if ( existent == maControls.end() )
+ return candidateId;
+ }
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "out of identifiers" ) ), NULL );
+}
+
+//------------------------------------------------------------------------
+::rtl::OUString UnoControlHolderList::impl_getFreeName_throw()
+{
+ ::rtl::OUString name( RTL_CONSTASCII_USTRINGPARAM( "control_" ) );
+ for ( ControlIdentifier candidateId = 0; candidateId < ::std::numeric_limits< ControlIdentifier >::max(); ++candidateId )
+ {
+ ::rtl::OUString candidateName( name + ::rtl::OUString::valueOf( candidateId ) );
+ ControlMap::const_iterator loop = maControls.begin();
+ for ( ; loop != maControls.end(); ++loop )
+ {
+ if ( loop->second->getName() == candidateName )
+ break;
+ }
+ if ( loop == maControls.end() )
+ return candidateName;
+ }
+ throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "out of identifiers" ) ), NULL );
+}
+// ----------------------------------------------------
+// Function to set the controls' visibility according
+// to the dialog's "Step" property
+// ----------------------------------------------------
+void implUpdateVisibility
+(
+ sal_Int32 nDialogStep,
+ uno::Reference< awt::XControlContainer > xControlContainer
+)
+{
+ uno::Sequence< uno::Reference< awt::XControl > >
+ aCtrls = xControlContainer->getControls();
+ const uno::Reference< awt::XControl >* pCtrls = aCtrls.getConstArray();
+ sal_uInt32 nCtrls = aCtrls.getLength();
+ sal_Bool bCompleteVisible = (nDialogStep == 0);
+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ {
+ uno::Reference< awt::XControl > xControl = pCtrls[ n ];
+
+ sal_Bool bVisible = bCompleteVisible;
+ if( !bVisible )
+ {
+ uno::Reference< awt::XControlModel > xModel( xControl->getModel() );
+ uno::Reference< beans::XPropertySet > xPSet
+ ( xModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySetInfo >
+ xInfo = xPSet->getPropertySetInfo();
+ ::rtl::OUString aPropName(RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
+ sal_Int32 nControlStep = 0;
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ uno::Any aVal = xPSet->getPropertyValue( aPropName );
+ aVal >>= nControlStep;
+ }
+ bVisible = (nControlStep == 0) || (nControlStep == nDialogStep);
+ }
+
+ uno::Reference< awt::XWindow> xWindow
+ ( xControl, uno::UNO_QUERY );
+ if( xWindow.is() )
+ xWindow->setVisible( bVisible );
+ }
+}
+
+
+// ----------------------------------------------------
+// class DialogStepChangedListener
+// ----------------------------------------------------
+typedef ::cppu::WeakImplHelper1< beans::XPropertyChangeListener > PropertyChangeListenerHelper;
+
+class DialogStepChangedListener: public PropertyChangeListenerHelper
+{
+private:
+ uno::Reference< awt::XControlContainer > mxControlContainer;
+
+public:
+ DialogStepChangedListener( uno::Reference< awt::XControlContainer > xControlContainer )
+ : mxControlContainer( xControlContainer ) {}
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw( uno::RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& evt ) throw( uno::RuntimeException);
+
+};
+
+void SAL_CALL DialogStepChangedListener::disposing( const lang::EventObject& /*_rSource*/)
+ throw( uno::RuntimeException)
+{
+ mxControlContainer.clear();
+}
+
+void SAL_CALL DialogStepChangedListener::propertyChange( const beans::PropertyChangeEvent& evt )
+ throw( uno::RuntimeException)
+{
+ // evt.PropertyName HAS to be "Step" because we only use the listener for that
+ sal_Int32 nDialogStep = 0;
+ evt.NewValue >>= nDialogStep;
+ implUpdateVisibility( nDialogStep, mxControlContainer );
+}
+
+// ----------------------------------------------------
+// class UnoControlContainer
+// ----------------------------------------------------
+UnoControlContainer::UnoControlContainer() : maCListeners( *this )
+{
+ mpControls = new UnoControlHolderList;
+}
+
+UnoControlContainer::UnoControlContainer( uno::Reference< awt::XWindowPeer > xP )
+ : maCListeners( *this )
+{
+ setPeer( xP );
+ mbDisposePeer = sal_False;
+ mpControls = new UnoControlHolderList;
+}
+
+UnoControlContainer::~UnoControlContainer()
+{
+ DELETEZ( mpControls );
+}
+
+void UnoControlContainer::ImplActivateTabControllers()
+{
+ sal_uInt32 nCount = maTabControllers.getLength();
+ for ( sal_uInt32 n = 0; n < nCount; n++ )
+ {
+ maTabControllers.getArray()[n]->setContainer( this );
+ maTabControllers.getArray()[n]->activateTabOrder();
+ }
+}
+
+// lang::XComponent
+void UnoControlContainer::dispose( ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ lang::EventObject aDisposeEvent;
+ aDisposeEvent.Source = static_cast< uno::XAggregation* >( this );
+
+ // DG: zuerst der Welt mitteilen, dass der Container wegfliegt. Dieses ist um einiges
+ // schneller wenn die Welt sowohl an den Controls als auch am Container horcht
+ maDisposeListeners.disposeAndClear( aDisposeEvent );
+ maCListeners.disposeAndClear( aDisposeEvent );
+
+
+ uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
+ uno::Reference< awt::XControl >* pCtrls = aCtrls.getArray();
+ uno::Reference< awt::XControl >* pCtrlsEnd = pCtrls + aCtrls.getLength();
+
+ for( ; pCtrls < pCtrlsEnd; ++pCtrls )
+ {
+ removingControl( *pCtrls );
+ // Control wegwerfen
+ (*pCtrls)->dispose();
+ }
+
+
+ // alle Strukturen entfernen
+ DELETEZ( mpControls );
+ mpControls = new UnoControlHolderList;
+
+ UnoControlBase::dispose();
+}
+
+// lang::XEventListener
+void UnoControlContainer::disposing( const lang::EventObject& _rEvt ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ uno::Reference< awt::XControl > xControl( _rEvt.Source, uno::UNO_QUERY );
+ if ( xControl.is() )
+ removeControl( xControl );
+
+ UnoControlBase::disposing( _rEvt );
+}
+
+// container::XContainer
+void UnoControlContainer::addContainerListener( const uno::Reference< container::XContainerListener >& rxListener ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maCListeners.addInterface( rxListener );
+}
+
+void UnoControlContainer::removeContainerListener( const uno::Reference< container::XContainerListener >& rxListener ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maCListeners.removeInterface( rxListener );
+}
+
+
+::sal_Int32 SAL_CALL UnoControlContainer::insert( const uno::Any& _rElement ) throw (lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ uno::Reference< awt::XControl > xControl;
+ if ( !( _rElement >>= xControl ) || !xControl.is() )
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Elements must support the XControl interface." ) ),
+ *this,
+ 1
+ );
+
+ return impl_addControl( xControl, NULL );
+}
+
+void SAL_CALL UnoControlContainer::removeByIdentifier( ::sal_Int32 _nIdentifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ uno::Reference< awt::XControl > xControl;
+ if ( !mpControls->getControlForIdentifier( _nIdentifier, xControl ) )
+ throw container::NoSuchElementException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "There is no element with the given identifier." ) ),
+ *this
+ );
+
+ impl_removeControl( _nIdentifier, xControl, NULL );
+}
+
+void SAL_CALL UnoControlContainer::replaceByIdentifer( ::sal_Int32 _nIdentifier, const uno::Any& _rElement ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ uno::Reference< awt::XControl > xExistentControl;
+ if ( !mpControls->getControlForIdentifier( _nIdentifier, xExistentControl ) )
+ throw container::NoSuchElementException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "There is no element with the given identifier." ) ),
+ *this
+ );
+
+ uno::Reference< awt::XControl > xNewControl;
+ if ( !( _rElement >>= xNewControl ) )
+ throw lang::IllegalArgumentException(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Elements must support the XControl interface." ) ),
+ *this,
+ 1
+ );
+
+ removingControl( xExistentControl );
+
+ mpControls->replaceControlById( _nIdentifier, xNewControl );
+
+ addingControl( xNewControl );
+
+ impl_createControlPeerIfNecessary( xNewControl );
+
+ if ( maCListeners.getLength() )
+ {
+ container::ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= _nIdentifier;
+ aEvent.Element <<= xNewControl;
+ aEvent.ReplacedElement <<= xExistentControl;
+ maCListeners.elementReplaced( aEvent );
+ }
+}
+
+uno::Any SAL_CALL UnoControlContainer::getByIdentifier( ::sal_Int32 _nIdentifier ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ uno::Reference< awt::XControl > xControl;
+ if ( !mpControls->getControlForIdentifier( _nIdentifier, xControl ) )
+ throw container::NoSuchElementException();
+ return uno::makeAny( xControl );
+}
+
+uno::Sequence< ::sal_Int32 > SAL_CALL UnoControlContainer::getIdentifiers( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ uno::Sequence< ::sal_Int32 > aIdentifiers;
+ mpControls->getIdentifiers( aIdentifiers );
+ return aIdentifiers;
+}
+
+// container::XElementAccess
+uno::Type SAL_CALL UnoControlContainer::getElementType( ) throw (uno::RuntimeException)
+{
+ return awt::XControlModel::static_type();
+}
+
+::sal_Bool SAL_CALL UnoControlContainer::hasElements( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return !mpControls->empty();
+}
+
+// awt::XControlContainer
+void UnoControlContainer::setStatusText( const ::rtl::OUString& rStatusText ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // In der Parenthierarchie nach unten gehen
+ uno::Reference< awt::XControlContainer > xContainer( mxContext, uno::UNO_QUERY );
+ if( xContainer.is() )
+ xContainer->setStatusText( rStatusText );
+}
+
+uno::Sequence< uno::Reference< awt::XControl > > UnoControlContainer::getControls( ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ uno::Sequence< uno::Reference< awt::XControl > > aControls;
+ mpControls->getControls( aControls );
+ return aControls;
+}
+
+uno::Reference< awt::XControl > UnoControlContainer::getControl( const ::rtl::OUString& rName ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return mpControls->getControlForName( rName );
+}
+
+void UnoControlContainer::addingControl( const uno::Reference< awt::XControl >& _rxControl )
+{
+ if ( _rxControl.is() )
+ {
+ uno::Reference< uno::XInterface > xThis;
+ OWeakAggObject::queryInterface( ::getCppuType( static_cast< uno::Reference< uno::XInterface >* >( NULL ) ) ) >>= xThis;
+
+ _rxControl->setContext( xThis );
+ _rxControl->addEventListener( this );
+ }
+}
+
+void UnoControlContainer::impl_createControlPeerIfNecessary( const uno::Reference< awt::XControl >& _rxControl )
+{
+ OSL_PRECOND( _rxControl.is(), "UnoControlContainer::impl_createControlPeerIfNecessary: invalid control, this will crash!" );
+
+ // if the container already has a peer, then also create a peer for the control
+ uno::Reference< awt::XWindowPeer > xMyPeer( getPeer() );
+
+ if( xMyPeer.is() )
+ {
+ _rxControl->createPeer( NULL, xMyPeer );
+ ImplActivateTabControllers();
+ }
+
+}
+
+sal_Int32 UnoControlContainer::impl_addControl( const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pName )
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ UnoControlHolderList::ControlIdentifier id = mpControls->addControl( _rxControl, _pName );
+
+ addingControl( _rxControl );
+
+ impl_createControlPeerIfNecessary( _rxControl );
+
+ if ( maCListeners.getLength() )
+ {
+ container::ContainerEvent aEvent;
+ aEvent.Source = *this;
+ _pName ? ( aEvent.Accessor <<= *_pName ) : ( aEvent.Accessor <<= (sal_Int32)id );
+ aEvent.Element <<= _rxControl;
+ maCListeners.elementInserted( aEvent );
+ }
+
+ return id;
+}
+
+void UnoControlContainer::addControl( const ::rtl::OUString& rName, const uno::Reference< awt::XControl >& rControl ) throw(uno::RuntimeException)
+{
+ if ( rControl.is() )
+ impl_addControl( rControl, &rName );
+}
+
+void UnoControlContainer::removingControl( const uno::Reference< awt::XControl >& _rxControl )
+{
+ if ( _rxControl.is() )
+ {
+ _rxControl->removeEventListener( this );
+ _rxControl->setContext( NULL );
+ }
+}
+
+void UnoControlContainer::impl_removeControl( sal_Int32 _nId, const uno::Reference< awt::XControl >& _rxControl, const ::rtl::OUString* _pNameAccessor )
+{
+#ifdef DBG_UTIL
+ {
+ uno::Reference< awt::XControl > xControl;
+ bool bHas = mpControls->getControlForIdentifier( _nId, xControl );
+ DBG_ASSERT( bHas && xControl == _rxControl, "UnoControlContainer::impl_removeControl: inconsistency in the parameters!" );
+ }
+#endif
+ removingControl( _rxControl );
+
+ mpControls->removeControlById( _nId );
+
+ if ( maCListeners.getLength() )
+ {
+ container::ContainerEvent aEvent;
+ aEvent.Source = *this;
+ _pNameAccessor ? ( aEvent.Accessor <<= *_pNameAccessor ) : ( aEvent.Accessor <<= _nId );
+ aEvent.Element <<= _rxControl;
+ maCListeners.elementRemoved( aEvent );
+ }
+}
+
+void UnoControlContainer::removeControl( const uno::Reference< awt::XControl >& _rxControl ) throw(uno::RuntimeException)
+{
+ if ( _rxControl.is() )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ UnoControlHolderList::ControlIdentifier id = mpControls->getControlIdentifier( _rxControl );
+ if ( id != -1 )
+ impl_removeControl( id, _rxControl, NULL );
+ }
+}
+
+
+
+// awt::XUnoControlContainer
+void UnoControlContainer::setTabControllers( const uno::Sequence< uno::Reference< awt::XTabController > >& TabControllers ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maTabControllers = TabControllers;
+}
+
+uno::Sequence< uno::Reference< awt::XTabController > > UnoControlContainer::getTabControllers( ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return maTabControllers;
+}
+
+void UnoControlContainer::addTabController( const uno::Reference< awt::XTabController >& TabController ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nCount = maTabControllers.getLength();
+ maTabControllers.realloc( nCount + 1 );
+ maTabControllers[ nCount ] = TabController;
+}
+
+void UnoControlContainer::removeTabController( const uno::Reference< awt::XTabController >& TabController ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nCount = maTabControllers.getLength();
+ const uno::Reference< awt::XTabController >* pLoop = maTabControllers.getConstArray();
+ for ( sal_uInt32 n = 0; n < nCount; ++n, ++pLoop )
+ {
+ if( pLoop->get() == TabController.get() )
+ {
+ ::comphelper::removeElementAt( maTabControllers, n );
+ break;
+ }
+ }
+}
+
+// awt::XControl
+void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxToolkit, const uno::Reference< awt::XWindowPeer >& rParent ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if( !getPeer().is() )
+ {
+ sal_Bool bVis = maComponentInfos.bVisible;
+ if( bVis )
+ UnoControl::setVisible( sal_False );
+ // eigenes Peer erzeugen
+ UnoControl::createPeer( rxToolkit, rParent );
+
+ // alle Peers der Childs erzeugen
+ if ( !mbCreatingCompatiblePeer )
+ {
+ // Evaluate "Step" property
+ uno::Reference< awt::XControlModel > xModel( getModel() );
+ uno::Reference< beans::XPropertySet > xPSet
+ ( xModel, uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySetInfo >
+ xInfo = xPSet->getPropertySetInfo();
+ ::rtl::OUString aPropName(RTL_CONSTASCII_USTRINGPARAM( "Step" ) );
+ if ( xInfo->hasPropertyByName( aPropName ) )
+ {
+ ::com::sun::star::uno::Any aVal = xPSet->getPropertyValue( aPropName );
+ sal_Int32 nDialogStep = 0;
+ aVal >>= nDialogStep;
+ uno::Reference< awt::XControlContainer > xContainer =
+ SAL_STATIC_CAST( awt::XControlContainer*, this );
+ implUpdateVisibility( nDialogStep, xContainer );
+
+ uno::Reference< beans::XPropertyChangeListener > xListener =
+ SAL_STATIC_CAST( beans::XPropertyChangeListener*,
+ new DialogStepChangedListener( xContainer ) );
+ xPSet->addPropertyChangeListener( aPropName, xListener );
+ }
+
+ uno::Sequence< uno::Reference< awt::XControl > > aCtrls = getControls();
+ sal_uInt32 nCtrls = aCtrls.getLength();
+ for( sal_uInt32 n = 0; n < nCtrls; n++ )
+ aCtrls.getArray()[n]->createPeer( rxToolkit, getPeer() );
+
+ uno::Reference< awt::XVclContainerPeer > xC( getPeer(), uno::UNO_QUERY );
+
+ xC->enableDialogControl( sal_True );
+ ImplActivateTabControllers();
+ }
+
+ if( bVis && !isDesignMode() )
+ UnoControl::setVisible( sal_True );
+ }
+}
+
+
+// awt::XWindow
+void UnoControlContainer::setVisible( sal_Bool bVisible ) throw(uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ UnoControl::setVisible( bVisible );
+ if( !mxContext.is() && bVisible )
+ // Es ist ein TopWindow, also automatisch anzeigen
+ createPeer( uno::Reference< awt::XToolkit > (), uno::Reference< awt::XWindowPeer > () );
+}
+
+
+
diff --git a/toolkit/source/controls/unocontrolcontainermodel.cxx b/toolkit/source/controls/unocontrolcontainermodel.cxx
new file mode 100644
index 000000000000..7630971d8a57
--- /dev/null
+++ b/toolkit/source/controls/unocontrolcontainermodel.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+
+// ----------------------------------------------------
+// class UnoControlContainerModel
+// ----------------------------------------------------
+UnoControlContainerModel::UnoControlContainerModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+}
+
+::rtl::OUString UnoControlContainerModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlContainerModel );
+}
+
+::com::sun::star::uno::Any UnoControlContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ ::com::sun::star::uno::Any aDefault;
+ if ( nPropId == BASEPROPERTY_BORDER )
+ aDefault <<= (sal_Int16) 0;
+ else
+ aDefault <<= UnoControlModel::ImplGetDefaultValue( nPropId );
+ return aDefault;
+}
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlContainerModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlContainerModel::getInfoHelper()
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlContainerModel*)this)->GetMutex() );
+
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+
+
+
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
new file mode 100644
index 000000000000..29b683a5ed40
--- /dev/null
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -0,0 +1,1495 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/MouseWheelBehavior.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/extract.hxx>
+#include <rtl/memory.h>
+#include <rtl/uuid.h>
+#include <tools/diagnose_ex.h>
+#include <tools/string.hxx>
+#include <tools/table.hxx>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+#include <tools/urlobj.hxx>
+#include <tools/debug.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/emptyfontdescriptor.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <unotools/localedatawrapper.hxx>
+#include <unotools/configmgr.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <uno/data.h>
+
+#include <memory>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::i18n;
+using ::com::sun::star::awt::FontDescriptor;
+
+struct ImplControlProperty
+{
+private:
+ sal_uInt16 nId;
+ ::com::sun::star::uno::Any aValue;
+
+public:
+ ImplControlProperty( const ImplControlProperty& rProp ) : aValue( rProp.aValue )
+ {
+ nId = rProp.nId;
+ }
+
+ ImplControlProperty( sal_uInt16 nT )
+ {
+ nId = nT;
+ }
+
+ ImplControlProperty( sal_uInt16 nT, const ::com::sun::star::uno::Any& rValue ) : aValue( rValue )
+ {
+ nId = nT;
+ }
+
+ sal_uInt16 GetId() const { return nId; }
+ const ::com::sun::star::uno::Any& GetValue() const { return aValue; }
+ void SetValue( const ::com::sun::star::uno::Any& rValue ) { aValue = rValue; }
+};
+
+DECLARE_TABLE( ImplPropertyTable, ImplControlProperty* )
+
+#define UNOCONTROL_STREAMVERSION (short)2
+
+static void lcl_ImplMergeFontProperty( FontDescriptor& rFD, sal_uInt16 nPropId, const Any& rValue )
+{
+ // some props are defined with other types than the matching FontDescriptor members have
+ // (e.g. FontWidth, FontSlant)
+ // 78474 - 09/19/2000 - FS
+ float nExtractFloat = 0;
+ sal_Int16 nExtractShort = 0;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue >>= rFD.Name;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue >>= rFD.StyleName;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue >>= rFD.Family;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue >>= rFD.CharSet;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue >>= nExtractFloat; rFD.Height = (sal_Int16)nExtractFloat;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue >>= rFD.Weight;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: if ( rValue >>= nExtractShort )
+ rFD.Slant = (::com::sun::star::awt::FontSlant)nExtractShort;
+ else
+ rValue >>= rFD.Slant;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue >>= rFD.Underline;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue >>= rFD.Strikeout;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue >>= rFD.Width;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue >>= rFD.Pitch;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue >>= rFD.CharacterWidth;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue >>= rFD.Orientation;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue >>= rFD.Kerning;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue >>= rFD.WordLineMode;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue >>= rFD.Type;
+ break;
+ default: DBG_ERROR( "FontProperty?!" );
+ }
+}
+
+// ----------------------------------------------------
+// class UnoControlModel
+// ----------------------------------------------------
+UnoControlModel::UnoControlModel()
+ : OPropertySetHelper( BrdcstHelper ), maDisposeListeners( *this )
+{
+ // Die Properties muessen vom Model in die Tabelle gestopft werden,
+ // nur vorhandene Properties sind gueltige Properties, auch wenn VOID.
+ mpData = new ImplPropertyTable;
+}
+
+UnoControlModel::UnoControlModel( const UnoControlModel& rModel )
+ : XControlModel()
+ , XPropertyState()
+ , XPersistObject()
+ , XComponent()
+ , XServiceInfo()
+ , XTypeProvider()
+ , XUnoTunnel()
+ , XCloneable()
+ , MutexAndBroadcastHelper()
+ , OPropertySetHelper( BrdcstHelper )
+ , OWeakAggObject()
+ , maDisposeListeners( *this )
+{
+ mpData = new ImplPropertyTable;
+
+ for ( sal_uInt32 n = rModel.mpData->Count(); n; )
+ {
+ ImplControlProperty* pProp = rModel.mpData->GetObject( --n );
+ ImplControlProperty* pNew = new ImplControlProperty( *pProp );
+ mpData->Insert( pNew->GetId(), pNew );
+ }
+}
+
+UnoControlModel::~UnoControlModel()
+{
+ for ( sal_uInt32 n = mpData->Count(); n; )
+ delete mpData->GetObject( --n );
+ delete mpData;
+}
+
+UnoControlModel* UnoControlModel::Clone() const
+{
+ DBG_ERROR( "UnoControlModel::Clone() ?!" );
+ return NULL;
+}
+
+::com::sun::star::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const
+{
+ sal_uInt32 nIDs = mpData->Count();
+ ::com::sun::star::uno::Sequence<sal_Int32> aIDs( nIDs );
+ sal_Int32* pIDs = aIDs.getArray();
+ for ( sal_uInt32 n = 0; n < nIDs; n++ )
+ pIDs[n] = mpData->GetObjectKey( n );
+ return aIDs;
+}
+
+sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
+{
+ if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ nPropId = BASEPROPERTY_FONTDESCRIPTOR;
+
+ return mpData->Get( nPropId ) ? sal_True : sal_False;
+}
+
+void UnoControlModel::ImplPropertyChanged( sal_uInt16 )
+{
+}
+
+::com::sun::star::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ ::com::sun::star::uno::Any aDefault;
+
+ if (
+ (nPropId == BASEPROPERTY_FONTDESCRIPTOR) ||
+ (
+ (nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START) &&
+ (nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END)
+ )
+ )
+ {
+ EmptyFontDescriptor aFD;
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_FONTDESCRIPTOR: aDefault <<= aFD; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_NAME: aDefault <<= aFD.Name; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: aDefault <<= aFD.StyleName; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: aDefault <<= aFD.Family; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: aDefault <<= aFD.CharSet; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: aDefault <<= (float)aFD.Height; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: aDefault <<= aFD.Weight; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: aDefault <<= (sal_Int16)aFD.Slant; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: aDefault <<= aFD.Underline; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: aDefault <<= aFD.Strikeout; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: aDefault <<= aFD.Width; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: aDefault <<= aFD.Pitch; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: aDefault <<= aFD.CharacterWidth; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: aDefault <<= aFD.Orientation; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: aDefault <<= aFD.Kerning; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: aDefault <<= aFD.WordLineMode; break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: aDefault <<= aFD.Type; break;
+ default: DBG_ERROR( "FontProperty?!" );
+ }
+ }
+ else
+ {
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_GRAPHIC:
+ aDefault <<= Reference< graphic::XGraphic >();
+ break;
+
+ case BASEPROPERTY_REFERENCE_DEVICE:
+ aDefault <<= Reference< awt::XDevice >();
+ break;
+
+ case BASEPROPERTY_VERTICALALIGN:
+ case BASEPROPERTY_BORDERCOLOR:
+ case BASEPROPERTY_SYMBOL_COLOR:
+ case BASEPROPERTY_TABSTOP:
+ case BASEPROPERTY_TEXTCOLOR:
+ case BASEPROPERTY_TEXTLINECOLOR:
+ case BASEPROPERTY_DATE:
+ case BASEPROPERTY_DATESHOWCENTURY:
+ case BASEPROPERTY_TIME:
+ case BASEPROPERTY_VALUE_DOUBLE:
+ case BASEPROPERTY_PROGRESSVALUE:
+ case BASEPROPERTY_SCROLLVALUE:
+ case BASEPROPERTY_VISIBLESIZE:
+ case BASEPROPERTY_BACKGROUNDCOLOR:
+ case BASEPROPERTY_FILLCOLOR: break; // Void
+
+ case BASEPROPERTY_FONTRELIEF:
+ case BASEPROPERTY_FONTEMPHASISMARK:
+ case BASEPROPERTY_MAXTEXTLEN:
+ case BASEPROPERTY_STATE:
+ case BASEPROPERTY_EXTDATEFORMAT:
+ case BASEPROPERTY_EXTTIMEFORMAT:
+ case BASEPROPERTY_ECHOCHAR: aDefault <<= (sal_Int16) 0; break;
+ case BASEPROPERTY_BORDER: aDefault <<= (sal_Int16) 1; break;
+ case BASEPROPERTY_DECIMALACCURACY: aDefault <<= (sal_Int16) 2; break;
+ case BASEPROPERTY_LINECOUNT: aDefault <<= (sal_Int16) 5; break;
+ case BASEPROPERTY_ALIGN: aDefault <<= (sal_Int16) PROPERTY_ALIGN_LEFT; break;
+ case BASEPROPERTY_IMAGEALIGN: aDefault <<= (sal_Int16) 1 /*ImageAlign::TOP*/; break;
+ case BASEPROPERTY_IMAGEPOSITION: aDefault <<= (sal_Int16) 12 /*ImagePosition::Centered*/; break;
+ case BASEPROPERTY_PUSHBUTTONTYPE: aDefault <<= (sal_Int16) 0 /*PushButtonType::STANDARD*/; break;
+ case BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR:aDefault <<= (sal_Int16) awt::MouseWheelBehavior::SCROLL_FOCUS_ONLY; break;
+
+ case BASEPROPERTY_DATEMAX: aDefault <<= (sal_Int32) Date( 31, 12, 2200 ).GetDate(); break;
+ case BASEPROPERTY_DATEMIN: aDefault <<= (sal_Int32) Date( 1, 1, 1900 ).GetDate(); break;
+ case BASEPROPERTY_TIMEMAX: aDefault <<= (sal_Int32) Time( 23, 59 ).GetTime(); break;
+ case BASEPROPERTY_TIMEMIN: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_VALUEMAX_DOUBLE: aDefault <<= (double) 1000000; break;
+ case BASEPROPERTY_VALUEMIN_DOUBLE: aDefault <<= (double) -1000000; break;
+ case BASEPROPERTY_VALUESTEP_DOUBLE: aDefault <<= (double ) 1; break;
+ case BASEPROPERTY_PROGRESSVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
+ case BASEPROPERTY_PROGRESSVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_SCROLLVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
+ case BASEPROPERTY_SCROLLVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_LINEINCREMENT: aDefault <<= (sal_Int32) 1; break;
+ case BASEPROPERTY_BLOCKINCREMENT: aDefault <<= (sal_Int32) 10; break;
+ case BASEPROPERTY_ORIENTATION: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_SPINVALUE: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_SPININCREMENT: aDefault <<= (sal_Int32) 1; break;
+ case BASEPROPERTY_SPINVALUE_MIN: aDefault <<= (sal_Int32) 0; break;
+ case BASEPROPERTY_SPINVALUE_MAX: aDefault <<= (sal_Int32) 100; break;
+ case BASEPROPERTY_REPEAT_DELAY: aDefault <<= (sal_Int32) 50; break; // 50 milliseconds
+ case BASEPROPERTY_DEFAULTCONTROL: aDefault <<= ((UnoControlModel*)this)->getServiceName(); break;
+
+ case BASEPROPERTY_AUTOHSCROLL:
+ case BASEPROPERTY_AUTOVSCROLL:
+ case BASEPROPERTY_MOVEABLE:
+ case BASEPROPERTY_CLOSEABLE:
+ case BASEPROPERTY_SIZEABLE:
+ case BASEPROPERTY_HSCROLL:
+ case BASEPROPERTY_DEFAULTBUTTON:
+ case BASEPROPERTY_MULTILINE:
+ case BASEPROPERTY_MULTISELECTION:
+ case BASEPROPERTY_TRISTATE:
+ case BASEPROPERTY_DROPDOWN:
+ case BASEPROPERTY_SPIN:
+ case BASEPROPERTY_READONLY:
+ case BASEPROPERTY_VSCROLL:
+ case BASEPROPERTY_NUMSHOWTHOUSANDSEP:
+ case BASEPROPERTY_STRICTFORMAT:
+ case BASEPROPERTY_REPEAT:
+ case BASEPROPERTY_PAINTTRANSPARENT:
+ case BASEPROPERTY_DESKTOP_AS_PARENT:
+ case BASEPROPERTY_HARDLINEBREAKS:
+ case BASEPROPERTY_NOLABEL: aDefault <<= (sal_Bool) sal_False; break;
+
+ case BASEPROPERTY_HIDEINACTIVESELECTION:
+ case BASEPROPERTY_ENFORCE_FORMAT:
+ case BASEPROPERTY_AUTOCOMPLETE:
+ case BASEPROPERTY_SCALEIMAGE:
+ case BASEPROPERTY_ENABLED:
+ case BASEPROPERTY_PRINTABLE:
+ case BASEPROPERTY_ENABLEVISIBLE:
+ case BASEPROPERTY_DECORATION: aDefault <<= (sal_Bool) sal_True; break;
+
+ case BASEPROPERTY_HELPTEXT:
+ case BASEPROPERTY_HELPURL:
+ case BASEPROPERTY_IMAGEURL:
+ case BASEPROPERTY_DIALOGSOURCEURL:
+ case BASEPROPERTY_EDITMASK:
+ case BASEPROPERTY_LITERALMASK:
+ case BASEPROPERTY_LABEL:
+ case BASEPROPERTY_TITLE:
+ case BASEPROPERTY_TEXT: aDefault <<= ::rtl::OUString(); break;
+
+ case BASEPROPERTY_WRITING_MODE:
+ case BASEPROPERTY_CONTEXT_WRITING_MODE:
+ aDefault <<= text::WritingMode2::CONTEXT;
+ break;
+
+ case BASEPROPERTY_STRINGITEMLIST:
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aStringSeq;
+ aDefault <<= aStringSeq;
+
+ }
+ break;
+ case BASEPROPERTY_SELECTEDITEMS:
+ {
+ ::com::sun::star::uno::Sequence<sal_Int16> aINT16Seq;
+ aDefault <<= aINT16Seq;
+ }
+ break;
+ case BASEPROPERTY_CURRENCYSYMBOL:
+ {
+ Any aDefaultCurrency = ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::DEFAULTCURRENCY);
+ DBG_ASSERT( TypeClass_STRING == aDefaultCurrency.getValueTypeClass(), "UnoControlModel::ImplGetDefaultValue: invalid currency config value!" );
+
+ ::rtl::OUString sDefaultCurrency;
+ aDefaultCurrency >>= sDefaultCurrency;
+
+ // extract the bank symbol
+ sal_Int32 nSepPos = sDefaultCurrency.indexOf( '-' );
+ ::rtl::OUString sBankSymbol;
+ if ( nSepPos >= 0 )
+ {
+ sBankSymbol = sDefaultCurrency.copy( 0, nSepPos );
+ sDefaultCurrency = sDefaultCurrency.copy( nSepPos + 1 );
+ }
+
+ // the remaming is the locale
+ Locale aLocale;
+ nSepPos = sDefaultCurrency.indexOf( '-' );
+ if ( nSepPos >= 0 )
+ {
+ aLocale.Language = sDefaultCurrency.copy( 0, nSepPos );
+ aLocale.Country = sDefaultCurrency.copy( nSepPos + 1 );
+ }
+
+ LocaleDataWrapper aLocaleInfo( ::comphelper::getProcessServiceFactory(), aLocale );
+ if ( !sBankSymbol.getLength() )
+ sBankSymbol = aLocaleInfo.getCurrBankSymbol();
+
+ // look for the currency entry (for this language) which has the given bank symbol
+ Sequence< Currency2 > aAllCurrencies = aLocaleInfo.getAllCurrencies();
+ const Currency2* pAllCurrencies = aAllCurrencies.getConstArray();
+ const Currency2* pAllCurrenciesEnd = pAllCurrencies + aAllCurrencies.getLength();
+
+ ::rtl::OUString sCurrencySymbol = aLocaleInfo.getCurrSymbol();
+ if ( !sBankSymbol.getLength() )
+ {
+ DBG_ASSERT( pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: no currencies at all!" );
+ if ( pAllCurrencies != pAllCurrenciesEnd )
+ {
+ sBankSymbol = pAllCurrencies->BankSymbol;
+ sCurrencySymbol = pAllCurrencies->Symbol;
+ }
+ }
+
+ if ( sBankSymbol.getLength() )
+ {
+ bool bLegacy = false;
+ for ( ;pAllCurrencies != pAllCurrenciesEnd; ++pAllCurrencies )
+ if ( pAllCurrencies->BankSymbol == sBankSymbol )
+ {
+ sCurrencySymbol = pAllCurrencies->Symbol;
+ if ( pAllCurrencies->LegacyOnly )
+ bLegacy = true;
+ else
+ break;
+ }
+ DBG_ASSERT( bLegacy || pAllCurrencies != pAllCurrenciesEnd, "UnoControlModel::ImplGetDefaultValue: did not find the given bank symbol!" );
+ }
+
+ aDefault <<= sCurrencySymbol;
+ }
+ break;
+
+ default: DBG_ERROR( "ImplGetDefaultValue - unknown Property" );
+ }
+ }
+
+ return aDefault;
+}
+
+void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId, const ::com::sun::star::uno::Any& rDefault )
+{
+ ImplControlProperty* pProp = new ImplControlProperty( nPropId, rDefault );
+ mpData->Insert( nPropId, pProp );
+}
+
+void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
+{
+ ImplRegisterProperty( nPropId, ImplGetDefaultValue( nPropId ) );
+
+ if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
+ {
+ // some properties are not included in the FontDescriptor, but everytime
+ // when we have a FontDescriptor we want to have these properties too.
+ // => Easier to register the here, istead everywhere where I register the FontDescriptor...
+
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
+ ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
+ ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
+ }
+}
+
+void UnoControlModel::ImplRegisterProperties( const std::list< sal_uInt16 > &rIds )
+{
+ std::list< sal_uInt16 >::const_iterator iter;
+ for( iter = rIds.begin(); iter != rIds.end(); iter++) {
+ if( !ImplHasProperty( *iter ) )
+ ImplRegisterProperty( *iter, ImplGetDefaultValue( *iter ) );
+ }
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoControlModel::queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::awt::XControlModel*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::io::XPersistObject*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XComponent*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XServiceInfo*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::util::XCloneable*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XPropertyState*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XMultiPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XFastPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::beans::XPropertySet*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XTypeProvider*, this ),
+ SAL_STATIC_CAST( ::com::sun::star::lang::XUnoTunnel*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakAggObject::queryAggregation( rType ));
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( UnoControlModel )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoControlModel )
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>* ) NULL )
+IMPL_XTYPEPROVIDER_END
+
+
+uno::Reference< util::XCloneable > UnoControlModel::createClone() throw(::com::sun::star::uno::RuntimeException)
+{
+ UnoControlModel* pClone = Clone();
+ uno::Reference< util::XCloneable > xClone( (::cppu::OWeakObject*) pClone, uno::UNO_QUERY );
+ return xClone;
+}
+
+// ::com::sun::star::lang::XComponent
+void UnoControlModel::dispose( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::lang::EventObject aEvt;
+ aEvt.Source = (::com::sun::star::uno::XAggregation*)(::cppu::OWeakAggObject*)this;
+ maDisposeListeners.disposeAndClear( aEvt );
+
+ // let the property set helper notify our property listeners
+ OPropertySetHelper::disposing();
+}
+
+void UnoControlModel::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maDisposeListeners.addInterface( rxListener );
+}
+
+void UnoControlModel::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& rxListener ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ maDisposeListeners.removeInterface( rxListener );
+}
+
+
+// ::com::sun::star::beans::XPropertyState
+::com::sun::star::beans::PropertyState UnoControlModel::getPropertyState( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt16 nPropId = GetPropertyId( PropertyName );
+
+ ::com::sun::star::uno::Any aValue = getPropertyValue( PropertyName );
+ ::com::sun::star::uno::Any aDefault = ImplGetDefaultValue( nPropId );
+
+ return CompareProperties( aValue, aDefault ) ? ::com::sun::star::beans::PropertyState_DEFAULT_VALUE : ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > UnoControlModel::getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nNames = PropertyNames.getLength();
+ const ::rtl::OUString* pNames = PropertyNames.getConstArray();
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > aStates( nNames );
+ ::com::sun::star::beans::PropertyState* pStates = aStates.getArray();
+
+ for ( sal_uInt32 n = 0; n < nNames; n++ )
+ pStates[n] = getPropertyState( pNames[n] );
+
+ return aStates;
+}
+
+void UnoControlModel::setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ Any aDefaultValue;
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ aDefaultValue = ImplGetDefaultValue( GetPropertyId( PropertyName ) );
+ }
+ setPropertyValue( PropertyName, aDefaultValue );
+}
+
+::com::sun::star::uno::Any UnoControlModel::getPropertyDefault( const ::rtl::OUString& rPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return ImplGetDefaultValue( GetPropertyId( rPropertyName ) );
+}
+
+
+// ::com::sun::star::io::XPersistObjec
+::rtl::OUString UnoControlModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ DBG_ERROR( "ServiceName von UnoControlModel ?!" );
+ return ::rtl::OUString();
+}
+
+void UnoControlModel::write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( OutStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "write: no ::com::sun::star::io::XMarkableStream!" );
+
+ OutStream->writeShort( UNOCONTROL_STREAMVERSION );
+
+ ImplPropertyTable aProps;
+ sal_uInt32 i;
+ for ( i = mpData->Count(); i; )
+ {
+ ImplControlProperty* pProp = mpData->GetObject( --i );
+ if ( ( ( GetPropertyAttribs( pProp->GetId() ) & ::com::sun::star::beans::PropertyAttribute::TRANSIENT ) == 0 )
+ && ( getPropertyState( GetPropertyName( pProp->GetId() ) ) != ::com::sun::star::beans::PropertyState_DEFAULT_VALUE ) )
+ {
+ aProps.Insert( pProp->GetId(), pProp );
+ }
+ }
+
+ sal_uInt32 nProps = aProps.Count();
+
+ // FontProperty wegen fehlender Unterscheidung zwischen 5.0 / 5.1
+ // immer im alten Format mitspeichern.
+ OutStream->writeLong( (long) aProps.IsKeyValid( BASEPROPERTY_FONTDESCRIPTOR ) ? ( nProps + 3 ) : nProps );
+ for ( i = 0; i < nProps; i++ )
+ {
+ sal_Int32 nPropDataBeginMark = xMark->createMark();
+ OutStream->writeLong( 0L ); // DataLen
+
+ ImplControlProperty* pProp = aProps.GetObject( i );
+ OutStream->writeShort( pProp->GetId() );
+
+ sal_Bool bVoid = pProp->GetValue().getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+
+ OutStream->writeBoolean( bVoid );
+
+ if ( !bVoid )
+ {
+ const ::com::sun::star::uno::Any& rValue = pProp->GetValue();
+ const ::com::sun::star::uno::Type& rType = rValue.getValueType();
+
+ if ( rType == ::getBooleanCppuType() )
+ {
+ sal_Bool b = false;
+ rValue >>= b;
+ OutStream->writeBoolean( b );
+ }
+ else if ( rType == ::getCppuType((const ::rtl::OUString*)0) )
+ {
+ ::rtl::OUString aUString;
+ rValue >>= aUString;
+ OutStream->writeUTF( aUString );
+ }
+ else if ( rType == ::getCppuType((const sal_uInt16*)0) )
+ {
+ sal_uInt16 n = 0;
+ rValue >>= n;
+ OutStream->writeShort( n );
+ }
+ else if ( rType == ::getCppuType((const sal_Int16*)0) )
+ {
+ sal_Int16 n = 0;
+ rValue >>= n;
+ OutStream->writeShort( n );
+ }
+ else if ( rType == ::getCppuType((const sal_uInt32*)0) )
+ {
+ sal_uInt32 n = 0;
+ rValue >>= n;
+ OutStream->writeLong( n );
+ }
+ else if ( rType == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 n = 0;
+ rValue >>= n;
+ OutStream->writeLong( n );
+ }
+ else if ( rType == ::getCppuType((const double*)0) )
+ {
+ double n = 0;
+ rValue >>= n;
+ OutStream->writeDouble( n );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
+ {
+ ::com::sun::star::awt::FontDescriptor aFD;
+ rValue >>= aFD;
+ OutStream->writeUTF( aFD.Name );
+ OutStream->writeShort( aFD.Height );
+ OutStream->writeShort( aFD.Width );
+ OutStream->writeUTF( aFD.StyleName );
+ OutStream->writeShort( aFD.Family );
+ OutStream->writeShort( aFD.CharSet );
+ OutStream->writeShort( aFD.Pitch );
+ OutStream->writeDouble( aFD.CharacterWidth );
+ OutStream->writeDouble( aFD.Weight );
+ OutStream->writeShort(
+ sal::static_int_cast< sal_Int16 >(aFD.Slant) );
+ OutStream->writeShort( aFD.Underline );
+ OutStream->writeShort( aFD.Strikeout );
+ OutStream->writeDouble( aFD.Orientation );
+ OutStream->writeBoolean( aFD.Kerning );
+ OutStream->writeBoolean( aFD.WordLineMode );
+ OutStream->writeShort( aFD.Type );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
+ {
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq;
+ rValue >>= aSeq;
+ long nEntries = aSeq.getLength();
+ OutStream->writeLong( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ OutStream->writeUTF( aSeq.getConstArray()[n] );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
+ {
+ ::com::sun::star::uno::Sequence<sal_uInt16> aSeq;
+ rValue >>= aSeq;
+ long nEntries = aSeq.getLength();
+ OutStream->writeLong( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ OutStream->writeShort( aSeq.getConstArray()[n] );
+ }
+ else if ( rType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
+ {
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq;
+ rValue >>= aSeq;
+ long nEntries = aSeq.getLength();
+ OutStream->writeLong( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ OutStream->writeShort( aSeq.getConstArray()[n] );
+ }
+ else if ( rType.getTypeClass() == TypeClass_ENUM )
+ {
+ sal_Int32 nAsInt = 0;
+ ::cppu::enum2int( nAsInt, rValue );
+ OutStream->writeLong( nAsInt );
+ }
+#if OSL_DEBUG_LEVEL > 0
+ else
+ {
+ ::rtl::OString sMessage( "UnoControlModel::write: don't know how to handle a property of type '" );
+ ::rtl::OUString sTypeName( rType.getTypeName() );
+ sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
+ sMessage += "'.\n(Currently handling property '";
+ ::rtl::OUString sPropertyName( GetPropertyName( pProp->GetId() ) );
+ sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
+ sMessage += "'.)";
+ DBG_ERROR( sMessage );
+ }
+#endif
+ }
+
+ sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
+ xMark->jumpToMark( nPropDataBeginMark );
+ OutStream->writeLong( nPropDataLen );
+ xMark->jumpToFurthest();
+ xMark->deleteMark(nPropDataBeginMark);
+ }
+
+ ImplControlProperty* pProp = aProps.Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp )
+ {
+ // Solange wir keinen 5.0-Export haben, muss das alte
+ // Format mit rausgeschrieben werden...
+ ::com::sun::star::awt::FontDescriptor aFD;
+ pProp->GetValue() >>= aFD;
+
+ for ( sal_uInt16 n = BASEPROPERTY_FONT_TYPE; n <= BASEPROPERTY_FONT_ATTRIBS; n++ )
+ {
+ sal_Int32 nPropDataBeginMark = xMark->createMark();
+ OutStream->writeLong( 0L ); // DataLen
+ OutStream->writeShort( n ); // PropId
+ OutStream->writeBoolean( sal_False ); // Void
+
+ if ( n == BASEPROPERTY_FONT_TYPE )
+ {
+ OutStream->writeUTF( aFD.Name );
+ OutStream->writeUTF( aFD.StyleName );
+ OutStream->writeShort( aFD.Family );
+ OutStream->writeShort( aFD.CharSet );
+ OutStream->writeShort( aFD.Pitch );
+ }
+ else if ( n == BASEPROPERTY_FONT_SIZE )
+ {
+ OutStream->writeLong( aFD.Width );
+ OutStream->writeLong( aFD.Height );
+ OutStream->writeShort(
+ sal::static_int_cast< sal_Int16 >(
+ VCLUnoHelper::ConvertFontWidth( aFD.CharacterWidth )) );
+ }
+ else if ( n == BASEPROPERTY_FONT_ATTRIBS )
+ {
+ OutStream->writeShort(
+ sal::static_int_cast< sal_Int16 >(
+ VCLUnoHelper::ConvertFontWeight( aFD.Weight )) );
+ OutStream->writeShort(
+ sal::static_int_cast< sal_Int16 >(aFD.Slant) );
+ OutStream->writeShort( aFD.Underline );
+ OutStream->writeShort( aFD.Strikeout );
+ OutStream->writeShort( (short)(aFD.Orientation * 10) );
+ OutStream->writeBoolean( aFD.Kerning );
+ OutStream->writeBoolean( aFD.WordLineMode );
+ }
+ else
+ {
+ DBG_ERROR( "Property?!" );
+ }
+
+ sal_Int32 nPropDataLen = xMark->offsetToMark( nPropDataBeginMark );
+ xMark->jumpToMark( nPropDataBeginMark );
+ OutStream->writeLong( nPropDataLen );
+ xMark->jumpToFurthest();
+ xMark->deleteMark(nPropDataBeginMark);
+ }
+ }
+}
+
+void UnoControlModel::read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XMarkableStream > xMark( InStream, ::com::sun::star::uno::UNO_QUERY );
+ DBG_ASSERT( xMark.is(), "read: no ::com::sun::star::io::XMarkableStream!" );
+
+ short nVersion = InStream->readShort();
+ sal_uInt32 nProps = (sal_uInt32)InStream->readLong();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aProps( nProps );
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> aValues( nProps );
+ sal_Bool bInvalidEntries = sal_False;
+
+ // Dummerweise kein Mark fuer den gesamten Block, es koennen also
+ // nur Properties geaendert werden, es koennen aber nicht spaeter mal Daten
+ // fuer das Model hinter den Properties geschrieben werden.
+
+ // Fuer den Import der alten ::com::sun::star::awt::FontDescriptor-Teile
+ ::com::sun::star::awt::FontDescriptor* pFD = NULL;
+
+ sal_uInt32 i;
+ for ( i = 0; i < nProps; i++ )
+ {
+ sal_Int32 nPropDataBeginMark = xMark->createMark();
+ sal_Int32 nPropDataLen = InStream->readLong();
+
+ sal_uInt16 nPropId = (sal_uInt16)InStream->readShort();
+
+ ::com::sun::star::uno::Any aValue;
+ sal_Bool bIsVoid = InStream->readBoolean();
+ if ( !bIsVoid )
+ {
+ const ::com::sun::star::uno::Type* pType = mpData->Get( nPropId ) ? GetPropertyType( nPropId ) : NULL;
+ if ( pType )
+ {
+ if ( *pType == ::getBooleanCppuType() )
+ {
+ sal_Bool b = InStream->readBoolean();
+ aValue <<= b;
+ }
+ else if ( *pType == ::getCppuType((const ::rtl::OUString*)0) )
+ {
+ ::rtl::OUString aUTF = InStream->readUTF();
+ aValue <<= aUTF;
+ }
+ else if ( *pType == ::getCppuType((const sal_uInt16*)0) )
+ {
+ sal_uInt16 n = InStream->readShort();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const sal_Int16*)0) )
+ {
+ sal_Int16 n = InStream->readShort();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const sal_uInt32*)0) )
+ {
+ sal_uInt32 n = InStream->readLong();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const sal_Int32*)0) )
+ {
+ sal_Int32 n = InStream->readLong();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const double*)0) )
+ {
+ double n = InStream->readDouble();
+ aValue <<= n;
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0) )
+ {
+ ::com::sun::star::awt::FontDescriptor aFD;
+ aFD.Name = InStream->readUTF();
+ aFD.Height = InStream->readShort();
+ aFD.Width = InStream->readShort();
+ aFD.StyleName = InStream->readUTF();
+ aFD.Family = InStream->readShort();
+ aFD.CharSet = InStream->readShort();
+ aFD.Pitch = InStream->readShort();
+ aFD.CharacterWidth = (float)InStream->readDouble();
+ aFD.Weight = (float)InStream->readDouble();
+ aFD.Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
+ aFD.Underline = InStream->readShort();
+ aFD.Strikeout = InStream->readShort();
+ aFD.Orientation = (float)InStream->readDouble();
+ aFD.Kerning = InStream->readBoolean();
+ aFD.WordLineMode = InStream->readBoolean();
+ aFD.Type = InStream->readShort();
+ aValue <<= aFD;
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence< ::rtl::OUString>*)0 ) )
+ {
+ long nEntries = InStream->readLong();
+ ::com::sun::star::uno::Sequence< ::rtl::OUString> aSeq( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ aSeq.getArray()[n] = InStream->readUTF();
+ aValue <<= aSeq;
+
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_uInt16>*)0 ) )
+
+ {
+ long nEntries = InStream->readLong();
+ ::com::sun::star::uno::Sequence<sal_uInt16> aSeq( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ aSeq.getArray()[n] = (sal_uInt16)InStream->readShort();
+ aValue <<= aSeq;
+ }
+ else if ( *pType == ::getCppuType((const ::com::sun::star::uno::Sequence<sal_Int16>*)0 ) )
+ {
+ long nEntries = InStream->readLong();
+ ::com::sun::star::uno::Sequence<sal_Int16> aSeq( nEntries );
+ for ( long n = 0; n < nEntries; n++ )
+ aSeq.getArray()[n] = (sal_Int16)InStream->readShort();
+ aValue <<= aSeq;
+ }
+ else if ( pType->getTypeClass() == TypeClass_ENUM )
+ {
+ sal_Int32 nAsInt = InStream->readLong();
+ aValue = ::cppu::int2enum( nAsInt, *pType );
+ }
+ else
+ {
+ ::rtl::OString sMessage( "UnoControlModel::read: don't know how to handle a property of type '" );
+ ::rtl::OUString sTypeName( pType->getTypeName() );
+ sMessage += ::rtl::OString( sTypeName.getStr(), sTypeName.getLength(), RTL_TEXTENCODING_ASCII_US );
+ sMessage += "'.\n(Currently handling property '";
+ ::rtl::OUString sPropertyName( GetPropertyName( nPropId ) );
+ sMessage += ::rtl::OString( sPropertyName.getStr(), sPropertyName.getLength(), osl_getThreadTextEncoding() );
+ sMessage += "'.)";
+ DBG_ERROR( sMessage );
+ }
+ }
+ else
+ {
+ // Altes Geraffel aus 5.0
+ if ( nPropId == BASEPROPERTY_FONT_TYPE )
+ {
+ // Sonst ist es nur die redundante Info fuer alte Versionen
+ // Daten werden durch MarkableStream geskippt.
+ if ( nVersion < 2 )
+ {
+ if ( !pFD )
+ {
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp ) // wegen den Defaults...
+ pProp->GetValue() >>= *pFD;
+ }
+ pFD->Name = InStream->readUTF();
+ pFD->StyleName = InStream->readUTF();
+ pFD->Family = InStream->readShort();
+ pFD->CharSet = InStream->readShort();
+ pFD->Pitch = InStream->readShort();
+ }
+ }
+ else if ( nPropId == BASEPROPERTY_FONT_SIZE )
+ {
+ if ( nVersion < 2 )
+ {
+ if ( !pFD )
+ {
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp ) // wegen den Defaults...
+ pProp->GetValue() >>= *pFD;
+ }
+ pFD->Width = (sal_Int16)InStream->readLong();
+ pFD->Height = (sal_Int16)InStream->readLong();
+ InStream->readShort(); // ::com::sun::star::awt::FontWidth ignorieren - wurde mal falsch geschrieben und wird nicht gebraucht.
+ pFD->CharacterWidth = ::com::sun::star::awt::FontWidth::DONTKNOW;
+ }
+ }
+ else if ( nPropId == BASEPROPERTY_FONT_ATTRIBS )
+ {
+ if ( nVersion < 2 )
+ {
+ if ( !pFD )
+ {
+ pFD = new ::com::sun::star::awt::FontDescriptor;
+ ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ if ( pProp ) // wegen den Defaults...
+ pProp->GetValue() >>= *pFD;
+ }
+ pFD->Weight = VCLUnoHelper::ConvertFontWeight( (FontWeight) InStream->readShort() );
+ pFD->Slant = (::com::sun::star::awt::FontSlant)InStream->readShort();
+ pFD->Underline = InStream->readShort();
+ pFD->Strikeout = InStream->readShort();
+ pFD->Orientation = ( (float)(double)InStream->readShort() ) / 10;
+ pFD->Kerning = InStream->readBoolean();
+ pFD->WordLineMode = InStream->readBoolean();
+ }
+ }
+ else
+ {
+ DBG_ERROR( "read: unknown Property!" );
+ }
+ }
+ }
+ else // bVoid
+ {
+ if ( nPropId == BASEPROPERTY_FONTDESCRIPTOR )
+ {
+ EmptyFontDescriptor aFD;
+ aValue <<= aFD;
+ }
+ }
+
+ if ( mpData->Get( nPropId ) )
+ {
+ aProps.getArray()[i] = GetPropertyName( nPropId );
+ aValues.getArray()[i] = aValue;
+ }
+ else
+ {
+ bInvalidEntries = sal_True;
+ }
+
+ // Falls bereits mehr drinsteht als diese Version kennt:
+ xMark->jumpToMark( nPropDataBeginMark );
+ InStream->skipBytes( nPropDataLen );
+ xMark->deleteMark(nPropDataBeginMark);
+ }
+ if ( bInvalidEntries )
+ {
+ for ( i = 0; i < (sal_uInt32)aProps.getLength(); i++ )
+ {
+ if ( !aProps.getConstArray()[i].getLength() )
+ {
+ ::comphelper::removeElementAt( aProps, i );
+ ::comphelper::removeElementAt( aValues, i );
+ i--;
+ }
+ }
+ }
+
+ try
+ {
+ setPropertyValues( aProps, aValues );
+ }
+ catch ( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ if ( pFD )
+ {
+ ::com::sun::star::uno::Any aValue;
+ aValue <<= *pFD;
+ setPropertyValue( GetPropertyName( BASEPROPERTY_FONTDESCRIPTOR ), aValue );
+ delete pFD;
+ }
+}
+
+
+// ::com::sun::star::lang::XServiceInfo
+::rtl::OUString UnoControlModel::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_ERROR( "This method should be overloaded!" );
+ return ::rtl::OUString();
+
+}
+
+sal_Bool UnoControlModel::supportsService( const ::rtl::OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
+ const ::rtl::OUString * pArray = aSNL.getConstArray();
+ for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
+ if( pArray[i] == rServiceName )
+ return sal_True;
+ return sal_False;
+}
+
+::com::sun::star::uno::Sequence< ::rtl::OUString > UnoControlModel::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::rtl::OUString sName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlModel" ) );
+ return Sequence< ::rtl::OUString >( &sName, 1 );
+}
+
+// ::cppu::OPropertySetHelper
+::cppu::IPropertyArrayHelper& UnoControlModel::getInfoHelper()
+{
+ DBG_ERROR( "UnoControlModel::getInfoHelper() not possible!" );
+ return *(::cppu::IPropertyArrayHelper*) NULL;
+}
+
+// ------------------------------------------------------------------
+template <class TYPE>
+sal_Bool convertType(Any& _rConvertedValue, const Any& _rNewValueTest, const TYPE* /* _pTypeDisambiguation */)
+{
+ TYPE tValue;
+ if (_rNewValueTest >>= tValue)
+ {
+ _rConvertedValue <<= tValue;
+ return sal_True;
+ }
+}
+
+// ..................................................................
+sal_Bool UnoControlModel::convertFastPropertyValue( Any & rConvertedValue, Any & rOldValue, sal_Int32 nPropId, const Any& rValue ) throw (IllegalArgumentException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Bool bVoid = rValue.getValueType().getTypeClass() == ::com::sun::star::uno::TypeClass_VOID;
+ if ( bVoid )
+ {
+ rConvertedValue.clear();
+ }
+ else
+ {
+ const ::com::sun::star::uno::Type* pDestType = GetPropertyType( (sal_uInt16)nPropId );
+ if ( pDestType->getTypeClass() == TypeClass_ANY )
+ {
+ rConvertedValue = rValue;
+ }
+ else
+ {
+ if ( pDestType->equals( rValue.getValueType() ) )
+ {
+ rConvertedValue = rValue;
+ }
+ else
+ {
+ BOOL bConverted = FALSE;
+ // 13.03.2001 - 84923 - frank.schoenheit@germany.sun.com
+
+ switch (pDestType->getTypeClass())
+ {
+ case TypeClass_DOUBLE:
+ {
+ // try as double
+ double nAsDouble = 0;
+ bConverted = ( rValue >>= nAsDouble );
+ if ( bConverted )
+ rConvertedValue <<= nAsDouble;
+ else
+ { // try as integer - 96136 - 2002-10-08 - fs@openoffice.org
+ sal_Int32 nAsInteger = 0;
+ bConverted = ( rValue >>= nAsInteger );
+ if ( bConverted )
+ rConvertedValue <<= (double)nAsInteger;
+ }
+ }
+ break;
+ case TypeClass_SHORT:
+ {
+ sal_Int16 n;
+ bConverted = ( rValue >>= n );
+ if ( bConverted )
+ rConvertedValue <<= n;
+ }
+ break;
+ case TypeClass_UNSIGNED_SHORT:
+ {
+ sal_uInt16 n;
+ bConverted = ( rValue >>= n );
+ if ( bConverted )
+ rConvertedValue <<= n;
+ }
+ break;
+ case TypeClass_LONG:
+ {
+ sal_Int32 n;
+ bConverted = ( rValue >>= n );
+ if ( bConverted )
+ rConvertedValue <<= n;
+ }
+ break;
+ case TypeClass_UNSIGNED_LONG:
+ {
+ sal_uInt32 n;
+ bConverted = ( rValue >>= n );
+ if ( bConverted )
+ rConvertedValue <<= n;
+ }
+ break;
+ case TypeClass_INTERFACE:
+ {
+ if ( rValue.getValueType().getTypeClass() == TypeClass_INTERFACE )
+ {
+ Reference< XInterface > xPure( rValue, UNO_QUERY );
+ if ( xPure.is() )
+ rConvertedValue = xPure->queryInterface( *pDestType );
+ else
+ rConvertedValue.setValue( NULL, *pDestType );
+ bConverted = sal_True;
+ }
+ }
+ break;
+ case TypeClass_ENUM:
+ {
+ sal_Int32 nValue = 0;
+ bConverted = ( rValue >>= nValue );
+ if ( bConverted )
+ rConvertedValue = ::cppu::int2enum( nValue, *pDestType );
+ }
+ break;
+ default: ; // avoid compiler warning
+ }
+
+ if (!bConverted)
+ {
+ ::rtl::OUStringBuffer aErrorMessage;
+ aErrorMessage.appendAscii( "Unable to convert the given value for the property " );
+ aErrorMessage.append ( GetPropertyName( (sal_uInt16)nPropId ) );
+ aErrorMessage.appendAscii( ".\n" );
+ aErrorMessage.appendAscii( "Expected type: " );
+ aErrorMessage.append ( pDestType->getTypeName() );
+ aErrorMessage.appendAscii( "\n" );
+ aErrorMessage.appendAscii( "Found type: " );
+ aErrorMessage.append ( rValue.getValueType().getTypeName() );
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ aErrorMessage.makeStringAndClear(),
+ static_cast< ::com::sun::star::beans::XPropertySet* >(this),
+ 1);
+ }
+ }
+ }
+ }
+
+ // the current value
+ getFastPropertyValue( rOldValue, nPropId );
+ return !CompareProperties( rConvertedValue, rOldValue );
+}
+
+void UnoControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ // Fehlt: Die gefakten Einzelproperties des FontDescriptors...
+
+ ImplControlProperty* pProp = mpData->Get( nPropId );
+ if ( pProp )
+ {
+ DBG_ASSERT( ( rValue.getValueType().getTypeClass() != ::com::sun::star::uno::TypeClass_VOID ) || ( GetPropertyAttribs( (sal_uInt16)nPropId ) & ::com::sun::star::beans::PropertyAttribute::MAYBEVOID ), "Property darf nicht VOID sein!" );
+ ImplPropertyChanged( (sal_uInt16)nPropId );
+ pProp->SetValue( rValue );
+ }
+ else
+ {
+ // exception...
+ DBG_ERROR( "SetPropertyValues: Invalid Property!" );
+ }
+}
+
+void UnoControlModel::getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nPropId ) const
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( ((UnoControlModel*)this)->GetMutex() );
+
+ ImplControlProperty* pProp = mpData->Get( nPropId );
+
+ if ( pProp )
+ rValue = pProp->GetValue();
+ else if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ {
+ pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ ::com::sun::star::awt::FontDescriptor aFD;
+ pProp->GetValue() >>= aFD;
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_FONTDESCRIPTORPART_NAME: rValue <<= aFD.Name;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME: rValue <<= aFD.StyleName;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_FAMILY: rValue <<= aFD.Family;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: rValue <<= aFD.CharSet;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: rValue <<= (float)aFD.Height;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue <<= aFD.Weight;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue <<= (sal_Int16)aFD.Slant;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue <<= aFD.Underline;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: rValue <<= aFD.Strikeout;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: rValue <<= aFD.Width;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_PITCH: rValue <<= aFD.Pitch;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH: rValue <<= aFD.CharacterWidth;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION: rValue <<= aFD.Orientation;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_KERNING: rValue <<= aFD.Kerning;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE: rValue <<= aFD.WordLineMode;
+ break;
+ case BASEPROPERTY_FONTDESCRIPTORPART_TYPE: rValue <<= aFD.Type;
+ break;
+ default: DBG_ERROR( "FontProperty?!" );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "getFastPropertyValue - invalid Property!" );
+ }
+}
+
+// ::com::sun::star::beans::XPropertySet
+void UnoControlModel::setPropertyValue( const ::rtl::OUString& rPropertyName, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nPropId = 0;
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ nPropId = (sal_Int32) GetPropertyId( rPropertyName );
+ DBG_ASSERT( nPropId, "Invalid ID in UnoControlModel::setPropertyValue" );
+ }
+ if( nPropId )
+ setFastPropertyValue( nPropId, rValue );
+ else
+ throw ::com::sun::star::beans::UnknownPropertyException();
+}
+
+// ::com::sun::star::beans::XFastPropertySet
+void UnoControlModel::setFastPropertyValue( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+
+ Any aOldSingleValue;
+ getFastPropertyValue( aOldSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
+
+ ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ FontDescriptor aOldFontDescriptor;
+ pProp->GetValue() >>= aOldFontDescriptor;
+
+ FontDescriptor aNewFontDescriptor( aOldFontDescriptor );
+ lcl_ImplMergeFontProperty( aNewFontDescriptor, (sal_uInt16)nPropId, rValue );
+
+ Any aNewValue;
+ aNewValue <<= aNewFontDescriptor;
+ sal_Int32 nDescriptorId( BASEPROPERTY_FONTDESCRIPTOR );
+ nDescriptorId = BASEPROPERTY_FONTDESCRIPTOR;
+
+ // also, we need fire a propertyChange event for the single property, since with
+ // the above line, only an event for the FontDescriptor property will be fired
+ Any aNewSingleValue;
+ getFastPropertyValue( aNewSingleValue, BASEPROPERTY_FONTDESCRIPTORPART_START );
+
+ aGuard.clear();
+ setFastPropertyValues( 1, &nDescriptorId, &aNewValue, 1 );
+ fire( &nPropId, &aNewSingleValue, &aOldSingleValue, 1, sal_False );
+ }
+ else
+ setFastPropertyValues( 1, &nPropId, &rValue, 1 );
+}
+
+// ::com::sun::star::beans::XMultiPropertySet
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ DBG_ERROR( "UnoControlModel::getPropertySetInfo() not possible!" );
+ return ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >();
+}
+
+void UnoControlModel::setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+
+ sal_Int32 nProps = rPropertyNames.getLength();
+
+// sal_Int32* pHandles = new sal_Int32[nProps];
+ // don't do this - it leaks in case of an exception
+ Sequence< sal_Int32 > aHandles( nProps );
+ sal_Int32* pHandles = aHandles.getArray();
+
+ // may need to change the order in the sequence, for this we need a non-const value sequence
+ // 15.05.2002 - 99314 - fs@openoffice.org
+ uno::Sequence< uno::Any > aValues( Values );
+ uno::Any* pValues = aValues.getArray();
+
+ sal_Int32 nValidHandles = getInfoHelper().fillHandles( pHandles, rPropertyNames );
+
+ if ( nValidHandles )
+ {
+ // if somebody sets properties which are single aspects of a font descriptor,
+ // remove them, and build a font descriptor instead
+ ::std::auto_ptr< awt::FontDescriptor > pFD;
+ for ( sal_uInt16 n = 0; n < nProps; ++n )
+ {
+ if ( ( pHandles[n] >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( pHandles[n] <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ {
+ if ( !pFD.get() )
+ {
+ ImplControlProperty* pProp = mpData->Get( BASEPROPERTY_FONTDESCRIPTOR );
+ pFD.reset( new awt::FontDescriptor );
+ pProp->GetValue() >>= *pFD;
+ }
+ lcl_ImplMergeFontProperty( *pFD, (sal_uInt16)pHandles[n], pValues[n] );
+ pHandles[n] = -1;
+ nValidHandles--;
+ }
+ }
+
+ if ( nValidHandles )
+ {
+ ImplNormalizePropertySequence( nProps, pHandles, pValues, &nValidHandles );
+ aGuard.clear();
+ // clear our guard before calling into setFastPropertyValues - this method
+ // will implicitly call property listeners, and this should not happen with
+ // our mutex locked
+ // #i23451# - 2004-03-18 - fs@openoffice.org
+ setFastPropertyValues( nProps, pHandles, pValues, nValidHandles );
+ }
+ else
+ aGuard.clear();
+ // same as a few lines above
+
+ // FD-Propertie nicht in das Array mergen, weil sortiert...
+ if ( pFD.get() )
+ {
+ ::com::sun::star::uno::Any aValue;
+ aValue <<= *pFD;
+ sal_Int32 nHandle = BASEPROPERTY_FONTDESCRIPTOR;
+ setFastPropertyValues( 1, &nHandle, &aValue, 1 );
+ }
+ }
+}
+
+
+
+void UnoControlModel::ImplNormalizePropertySequence( const sal_Int32, sal_Int32*,
+ uno::Any*, sal_Int32* ) const SAL_THROW(())
+{
+ // nothing to do here
+}
+
+void UnoControlModel::ImplEnsureHandleOrder( const sal_Int32 _nCount, sal_Int32* _pHandles,
+ uno::Any* _pValues, sal_Int32 _nFirstHandle, sal_Int32 _nSecondHandle ) const
+{
+ for ( sal_Int32 i=0; i < _nCount; ++_pHandles, ++_pValues, ++i )
+ {
+ if ( _nSecondHandle == *_pHandles )
+ {
+ sal_Int32* pLaterHandles = _pHandles + 1;
+ uno::Any* pLaterValues = _pValues + 1;
+ for ( sal_Int32 j = i + 1; j < _nCount; ++j, ++pLaterHandles, ++pLaterValues )
+ {
+ if ( _nFirstHandle == *pLaterHandles )
+ {
+ // indeed it is -> exchange the both places in the sequences
+ sal_Int32 nHandle( *_pHandles );
+ *_pHandles = *pLaterHandles;
+ *pLaterHandles = nHandle;
+
+ uno::Any aValue( *_pValues );
+ *_pValues = *pLaterValues;
+ *pLaterValues = aValue;
+
+ break;
+ // this will leave the inner loop, and continue with the outer loop.
+ // Note that this means we will encounter the _nSecondHandle handle, again, once we reached
+ // (in the outer loop) the place where we just put it.
+ }
+ }
+ }
+ }
+}
diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx
new file mode 100644
index 000000000000..ae9e59d045e7
--- /dev/null
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -0,0 +1,3788 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/XTextArea.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/awt/LineEndFormat.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/graphic/GraphicObject.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+
+
+#include <toolkit/controls/formattedcontrol.hxx>
+#include <toolkit/controls/roadmapcontrol.hxx>
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/unomemorystream.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/helper/imagealign.hxx>
+
+// for introspection
+#include <toolkit/awt/vclxwindows.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/extract.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/edit.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <vcl/group.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl/combobox.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/date.hxx>
+#include <tools/time.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::toolkit;
+
+
+// ----------------------------------------------------
+// helper
+// ----------------------------------------------------
+
+static void lcl_knitImageComponents( const uno::Reference< awt::XControlModel >& _rxModel,
+ const uno::Reference< awt::XWindowPeer >& _rxPeer,
+ bool _bAdd )
+{
+ uno::Reference< awt::XImageProducer > xProducer( _rxModel, uno::UNO_QUERY );
+ if ( xProducer.is() )
+ {
+ uno::Reference< awt::XImageConsumer > xConsumer( _rxPeer, uno::UNO_QUERY );
+ if ( xConsumer.is() )
+ {
+ if ( _bAdd )
+ {
+ xProducer->addConsumer( xConsumer );
+ xProducer->startProduction();
+ }
+ else
+ xProducer->removeConsumer( xConsumer );
+ }
+ }
+}
+
+// ----------------------------------------------------
+// class UnoControlEditModel
+// ----------------------------------------------------
+UnoControlEditModel::UnoControlEditModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXEdit );
+}
+
+::rtl::OUString UnoControlEditModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlEditModel );
+}
+
+uno::Any UnoControlEditModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ uno::Any aReturn;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_LINE_END_FORMAT:
+ aReturn <<= (sal_Int16)awt::LineEndFormat::LINE_FEED; // LF
+ break;
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aReturn <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlEdit );
+ break;
+ default:
+ aReturn = UnoControlModel::ImplGetDefaultValue( nPropId );
+ break;
+ }
+ return aReturn;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlEditModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlEditModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoEditControl
+// ----------------------------------------------------
+UnoEditControl::UnoEditControl()
+ :maTextListeners( *this )
+ ,mnMaxTextLen( 0 )
+ ,mbSetTextInPeer( sal_False )
+ ,mbSetMaxTextLenInPeer( sal_False )
+ ,mbHasTextProperty( sal_False )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+ mnMaxTextLen = 0;
+ mbSetMaxTextLenInPeer = FALSE;
+}
+
+uno::Any SAL_CALL UnoEditControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aReturn = UnoControlBase::queryAggregation( rType );
+ if ( !aReturn.hasValue() )
+ aReturn = UnoEditControl_Base::queryInterface( rType );
+ return aReturn;
+}
+
+uno::Any SAL_CALL UnoEditControl::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ return UnoControlBase::queryInterface( rType );
+}
+
+void SAL_CALL UnoEditControl::acquire( ) throw ()
+{
+ UnoControlBase::acquire();
+}
+
+void SAL_CALL UnoEditControl::release( ) throw ()
+{
+ UnoControlBase::release();
+}
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoEditControl, UnoControlBase, UnoEditControl_Base )
+
+::rtl::OUString UnoEditControl::GetComponentServiceName()
+{
+ // by default, we want a simple edit field
+ ::rtl::OUString sName( ::rtl::OUString::createFromAscii( "Edit" ) );
+
+ // but maybe we are to display multi-line text?
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_MULTILINE ) );
+ sal_Bool b = sal_Bool();
+ if ( ( aVal >>= b ) && b )
+ sName= ::rtl::OUString::createFromAscii( "MultiLineEdit" );
+
+ return sName;
+}
+
+sal_Bool SAL_CALL UnoEditControl::setModel(const uno::Reference< awt::XControlModel >& _rModel) throw ( uno::RuntimeException )
+{
+ sal_Bool bReturn = UnoControlBase::setModel( _rModel );
+ mbHasTextProperty = ImplHasProperty( BASEPROPERTY_TEXT );
+ return bReturn;
+}
+
+void UnoEditControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
+ sal_Bool bDone = sal_False;
+ if ( GetPropertyId( rPropName ) == BASEPROPERTY_TEXT )
+ {
+ // #96986# use setText(), or text listener will not be called.
+ uno::Reference < awt::XTextComponent > xTextComponent( getPeer(), uno::UNO_QUERY );
+ if ( xTextComponent.is() )
+ {
+ ::rtl::OUString sText;
+ rVal >>= sText;
+ ImplCheckLocalize( sText );
+ xTextComponent->setText( sText );
+ bDone = sal_True;
+ }
+ }
+
+ if ( !bDone )
+ UnoControlBase::ImplSetPeerProperty( rPropName, rVal );
+}
+
+void UnoEditControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt( *this );
+ maTextListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoEditControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+ if ( xText.is() )
+ {
+ xText->addTextListener( this );
+
+ if ( mbSetMaxTextLenInPeer )
+ xText->setMaxTextLen( mnMaxTextLen );
+ if ( mbSetTextInPeer )
+ xText->setText( maText );
+ }
+}
+
+void UnoEditControl::textChanged(const awt::TextEvent& e) throw(uno::RuntimeException)
+{
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+
+ if ( mbHasTextProperty )
+ {
+ uno::Any aAny;
+ aAny <<= xText->getText();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_False );
+ }
+ else
+ {
+ maText = xText->getText();
+ }
+
+ if ( maTextListeners.getLength() )
+ maTextListeners.textChanged( e );
+}
+
+void UnoEditControl::addTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException)
+{
+ maTextListeners.addInterface( l );
+}
+
+void UnoEditControl::removeTextListener(const uno::Reference< awt::XTextListener > & l) throw(uno::RuntimeException)
+{
+ maTextListeners.removeInterface( l );
+}
+
+void UnoEditControl::setText( const ::rtl::OUString& aText ) throw(uno::RuntimeException)
+{
+ if ( mbHasTextProperty )
+ {
+ uno::Any aAny;
+ aAny <<= aText;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TEXT ), aAny, sal_True );
+ }
+ else
+ {
+ maText = aText;
+ mbSetTextInPeer = sal_True;
+ uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+ if ( xText.is() )
+ xText->setText( maText );
+ }
+
+ // Setting the property to the VCLXWindow doesn't call textChanged
+ if ( maTextListeners.getLength() )
+ {
+ awt::TextEvent aEvent;
+ aEvent.Source = *this;
+ maTextListeners.textChanged( aEvent );
+ }
+}
+
+namespace
+{
+ static void lcl_normalize( awt::Selection& _rSel )
+ {
+ if ( _rSel.Min > _rSel.Max )
+ ::std::swap( _rSel.Min, _rSel.Max );
+ }
+
+/*
+ static bool lcl_intersect( const awt::Selection& _rLHS, const awt::Selection& _rRHS )
+ {
+ OSL_PRECOND( _rLHS.Min <= _rLHS.Max, "lcl_intersect: LHS to be normalized!" );
+ OSL_PRECOND( _rRHS.Min <= _rRHS.Max, "lcl_intersect: RHS to be normalized!" );
+ return !( ( _rLHS.Max < _rRHS.Min ) || ( _rLHS.Min > _rRHS.Max ) );
+ }
+*/
+}
+
+void UnoEditControl::insertText( const awt::Selection& rSel, const ::rtl::OUString& rNewText ) throw(uno::RuntimeException)
+{
+ // normalize the selection - OUString::replaceAt has a strange behaviour if the min is greater than the max
+ awt::Selection aSelection( rSel );
+ lcl_normalize( aSelection );
+
+ // preserve the selection resp. cursor position
+ awt::Selection aNewSelection( getSelection() );
+#ifdef ALSO_PRESERVE_COMPLETE_SELECTION
+ // (not sure - looks uglier ...)
+ sal_Int32 nDeletedCharacters = ( aSelection.Max - aSelection.Min ) - rNewText.getLength();
+ if ( aNewSelection.Min > aSelection.Min )
+ aNewSelection.Min -= nDeletedCharacters;
+ if ( aNewSelection.Max > aSelection.Max )
+ aNewSelection.Max -= nDeletedCharacters;
+#else
+ aNewSelection.Max = ::std::min( aNewSelection.Min, aNewSelection.Max ) + rNewText.getLength();
+ aNewSelection.Min = aNewSelection.Max;
+#endif
+
+ ::rtl::OUString aOldText = getText();
+ ::rtl::OUString aNewText = aOldText.replaceAt( aSelection.Min, aSelection.Max - aSelection.Min, rNewText );
+ setText( aNewText );
+
+ setSelection( aNewSelection );
+}
+
+::rtl::OUString UnoEditControl::getText() throw(uno::RuntimeException)
+{
+ ::rtl::OUString aText = maText;
+
+ if ( mbHasTextProperty )
+ aText = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
+ else
+ {
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+ if ( xText.is() )
+ aText = xText->getText();
+ }
+
+ return aText;
+}
+
+::rtl::OUString UnoEditControl::getSelectedText( void ) throw(uno::RuntimeException)
+{
+ ::rtl::OUString sSelected;
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+ if ( xText.is() )
+ sSelected = xText->getSelectedText();
+
+ return sSelected;
+}
+
+void UnoEditControl::setSelection( const awt::Selection& aSelection ) throw(uno::RuntimeException)
+{
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+ if ( xText.is() )
+ xText->setSelection( aSelection );
+}
+
+awt::Selection UnoEditControl::getSelection( void ) throw(uno::RuntimeException)
+{
+ awt::Selection aSel;
+ uno::Reference< awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+ if ( xText.is() )
+ aSel = xText->getSelection();
+ return aSel;
+}
+
+sal_Bool UnoEditControl::isEditable( void ) throw(uno::RuntimeException)
+{
+ return !ImplGetPropertyValue_BOOL( BASEPROPERTY_READONLY );
+}
+
+void UnoEditControl::setEditable( sal_Bool bEditable ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= (sal_Bool)!bEditable;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_READONLY ), aAny, sal_True );
+}
+
+sal_Int16 UnoEditControl::getMaxTextLen() throw(uno::RuntimeException)
+{
+ sal_Int16 nMaxLen = mnMaxTextLen;
+
+ if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN ) )
+ nMaxLen = ImplGetPropertyValue_INT16( BASEPROPERTY_MAXTEXTLEN );
+
+ return nMaxLen;
+}
+
+void UnoEditControl::setMaxTextLen( sal_Int16 nLen ) throw(uno::RuntimeException)
+{
+ if ( ImplHasProperty( BASEPROPERTY_MAXTEXTLEN) )
+ {
+ uno::Any aAny;
+ aAny <<= (sal_Int16)nLen;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MAXTEXTLEN ), aAny, sal_True );
+ }
+ else
+ {
+ mnMaxTextLen = nLen;
+ mbSetMaxTextLenInPeer = sal_True;
+ uno::Reference < awt::XTextComponent > xText( getPeer(), uno::UNO_QUERY );
+ if ( xText.is() )
+ xText->setMaxTextLen( mnMaxTextLen );
+ }
+}
+
+awt::Size UnoEditControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoEditControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoEditControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+awt::Size UnoEditControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize( nCols, nLines );
+}
+
+void UnoEditControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException)
+{
+ Impl_getColumnsAndLines( nCols, nLines );
+}
+
+
+// ----------------------------------------------------
+// class UnoControlFileControlModel
+// ----------------------------------------------------
+UnoControlFileControlModel::UnoControlFileControlModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_ALIGN );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_READONLY );
+ ImplRegisterProperty( BASEPROPERTY_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_TEXT );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
+ ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
+}
+
+::rtl::OUString UnoControlFileControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControlModel );
+}
+
+uno::Any UnoControlFileControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFileControl );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlFileControlModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlFileControlModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoFileControl
+// ----------------------------------------------------
+UnoFileControl::UnoFileControl()
+{
+}
+
+::rtl::OUString UnoFileControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "filecontrol" );
+}
+
+// ----------------------------------------------------
+// class ImageProducerControlModel
+// ----------------------------------------------------
+uno::Any SAL_CALL ImageProducerControlModel::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ return UnoControlModel::queryInterface( rType );
+}
+
+uno::Any SAL_CALL ImageProducerControlModel::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XImageProducer*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlModel::queryAggregation( rType ));
+}
+
+void SAL_CALL ImageProducerControlModel::acquire() throw()
+{
+ UnoControlModel::acquire();
+}
+
+void SAL_CALL ImageProducerControlModel::release() throw()
+{
+ UnoControlModel::release();
+}
+
+uno::Any ImageProducerControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_GRAPHIC )
+ return uno::makeAny( uno::Reference< graphic::XGraphic >() );
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+ uno::Reference< graphic::XGraphic > ImageProducerControlModel::getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
+ {
+ uno::Reference< graphic::XGraphic > xGraphic;
+
+ if( ( _rURL.compareToAscii( UNO_NAME_GRAPHOBJ_URLPREFIX, RTL_CONSTASCII_LENGTH( UNO_NAME_GRAPHOBJ_URLPREFIX ) ) == 0 ) )
+ {
+ // graphic manager uniqueid
+ rtl::OUString sID = _rURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 );
+ // get the DefaultContext
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ mxGrfObj = graphic::GraphicObject::createWithId( aContext.getUNOContext(), sID );
+ }
+ else // linked
+ mxGrfObj = NULL; // release the GraphicObject
+
+ if ( !_rURL.getLength() )
+ return xGraphic;
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< graphic::XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ uno::Sequence< beans::PropertyValue > aMediaProperties(1);
+ aMediaProperties[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
+ aMediaProperties[0].Value <<= _rURL;
+ xGraphic = xProvider->queryGraphic( aMediaProperties );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ return xGraphic;
+ }
+
+void SAL_CALL ImageProducerControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception)
+{
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ // - ImageAlign and ImagePosition need to correspond to each other
+ // - Graphic and ImageURL need to correspond to each other
+ try
+ {
+ switch ( nHandle )
+ {
+ case BASEPROPERTY_IMAGEURL:
+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_GRAPHIC ) )
+ {
+ mbAdjustingGraphic = true;
+ ::rtl::OUString sImageURL;
+ OSL_VERIFY( rValue >>= sImageURL );
+ setPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC ), uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
+ mbAdjustingGraphic = false;
+ }
+ break;
+
+ case BASEPROPERTY_GRAPHIC:
+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
+ {
+ mbAdjustingGraphic = true;
+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ), uno::makeAny( ::rtl::OUString() ) );
+ mbAdjustingGraphic = false;
+ }
+ break;
+
+ case BASEPROPERTY_IMAGEALIGN:
+ if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEPOSITION ) )
+ {
+ mbAdjustingImagePosition = true;
+ sal_Int16 nUNOValue = 0;
+ OSL_VERIFY( rValue >>= nUNOValue );
+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEPOSITION ), uno::makeAny( getExtendedImagePosition( nUNOValue ) ) );
+ mbAdjustingImagePosition = false;
+ }
+ break;
+ case BASEPROPERTY_IMAGEPOSITION:
+ if ( !mbAdjustingImagePosition && ImplHasProperty( BASEPROPERTY_IMAGEALIGN ) )
+ {
+ mbAdjustingImagePosition = true;
+ sal_Int16 nUNOValue = 0;
+ OSL_VERIFY( rValue >>= nUNOValue );
+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEALIGN ), uno::makeAny( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) );
+ mbAdjustingImagePosition = false;
+ }
+ break;
+ }
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "ImageProducerControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" );
+ mbAdjustingImagePosition = sal_False;
+ }
+}
+
+void ImageProducerControlModel::addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException)
+{
+ maListeners.push_back( xConsumer );
+}
+
+void ImageProducerControlModel::removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException)
+{
+ maListeners.remove( xConsumer );
+}
+
+void ImageProducerControlModel::startProduction( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ uno::Sequence<uno::Any> aArgs(1);
+ aArgs.getArray()[0] = getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGEURL ) );
+ uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ uno::Reference< awt::XImageProducer > xImageProducer( xMSF->createInstanceWithArguments( ::rtl::OUString::createFromAscii( "com.sun.star.awt.ImageProducer" ), aArgs ), uno::UNO_QUERY );
+ if ( xImageProducer.is() )
+ {
+ std::list< uno::Reference< awt::XImageConsumer > >::iterator aIter( maListeners.begin() );
+ while ( aIter != maListeners.end() )
+ {
+ xImageProducer->addConsumer( *aIter );
+ aIter++;
+ }
+ xImageProducer->startProduction();
+ }
+}
+
+// ----------------------------------------------------
+// class ImageConsumerControl
+// ----------------------------------------------------
+
+sal_Bool SAL_CALL ImageConsumerControl::setModel(const uno::Reference< awt::XControlModel >& _rModel) throw ( uno::RuntimeException )
+{
+ // remove the peer as image consumer from the model
+ lcl_knitImageComponents( getModel(), getPeer(), false );
+
+ sal_Bool bReturn = UnoControlBase::setModel( _rModel );
+
+ // add the peer as image consumer to the model
+ lcl_knitImageComponents( getModel(), getPeer(), true );
+
+ return bReturn;
+}
+
+void SAL_CALL ImageConsumerControl::createPeer( const uno::Reference< awt::XToolkit >& rxToolkit, const uno::Reference< awt::XWindowPeer >& rParentPeer ) throw(uno::RuntimeException)
+{
+ // remove the peer as image consumer from the model
+ lcl_knitImageComponents( getModel(), getPeer(), false );
+
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ // add the peer as image consumer to the model
+ lcl_knitImageComponents( getModel(), getPeer(), true );
+}
+
+void SAL_CALL ImageConsumerControl::dispose( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ // remove the peer as image consumer from the model
+ lcl_knitImageComponents( getModel(), getPeer(), false );
+
+ UnoControlBase::dispose();
+}
+
+void ImageConsumerControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
+ sal_uInt16 nType = GetPropertyId( rPropName );
+ if ( nType == BASEPROPERTY_IMAGEURL )
+ {
+ uno::Reference < awt::XImageProducer > xImgProd( getModel(), uno::UNO_QUERY );
+ uno::Reference < awt::XImageConsumer > xImgCons( getPeer(), uno::UNO_QUERY );
+
+ if ( xImgProd.is() && xImgCons.is() )
+ xImgProd->startProduction();
+ }
+ else
+ UnoControlBase::ImplSetPeerProperty( rPropName, rVal );
+}
+
+// ----------------------------------------------------
+// class UnoControlButtonModel
+// ----------------------------------------------------
+UnoControlButtonModel::UnoControlButtonModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXButton );
+
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ setFastPropertyValue_NoBroadcast( BASEPROPERTY_IMAGEPOSITION, ImplGetDefaultValue( BASEPROPERTY_IMAGEPOSITION ) );
+ // this ensures that our ImagePosition is consistent with our ImageAlign property (since both
+ // defaults are not per se consistent), since both are coupled in setFastPropertyValue_NoBroadcast
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+::rtl::OUString UnoControlButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlButtonModel );
+}
+
+uno::Any UnoControlButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlButton ) );
+ case BASEPROPERTY_TOGGLE:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_ALIGN:
+ return uno::makeAny( (sal_Int16)PROPERTY_ALIGN_CENTER );
+ case BASEPROPERTY_FOCUSONCLICK:
+ return uno::makeAny( (sal_Bool)sal_True );
+ }
+
+ return ImageProducerControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlButtonModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlButtonModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoButtonControl
+// ----------------------------------------------------
+UnoButtonControl::UnoButtonControl()
+ : maActionListeners( *this )
+ , maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 50;
+ maComponentInfos.nHeight = 14;
+}
+
+::rtl::OUString UnoButtonControl::GetComponentServiceName()
+{
+ ::rtl::OUString aName( ::rtl::OUString::createFromAscii( "pushbutton" ) );
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_PUSHBUTTONTYPE ) );
+ sal_Int16 n = sal_Int16();
+ if ( ( aVal >>= n ) && n )
+ {
+ // Use PushButtonType later when available...
+ switch ( n )
+ {
+ case 1 /*PushButtonType::OK*/: aName= ::rtl::OUString::createFromAscii( "okbutton" );
+ break;
+ case 2 /*PushButtonType::CANCEL*/: aName= ::rtl::OUString::createFromAscii( "cancelbutton" );
+ break;
+ case 3 /*PushButtonType::HELP*/: aName= ::rtl::OUString::createFromAscii( "helpbutton" );
+ break;
+ default:
+ {
+ DBG_ERROR( "Unknown Button Type!" );
+ }
+ }
+ }
+ return aName;
+}
+
+void UnoButtonControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ maItemListeners.disposeAndClear( aEvt );
+ ImageConsumerControl::dispose();
+}
+
+void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ ImageConsumerControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->setActionCommand( maActionCommand );
+ if ( maActionListeners.getLength() )
+ xButton->addActionListener( &maActionListeners );
+
+ uno::Reference< XToggleButton > xPushButton( getPeer(), uno::UNO_QUERY );
+ if ( xPushButton.is() )
+ xPushButton->addItemListener( this );
+}
+
+void UnoButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoButtonControl::addItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+}
+
+void UnoButtonControl::removeItemListener(const uno::Reference< awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.removeInterface( l );
+}
+
+void SAL_CALL UnoButtonControl::disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
+{
+ ImageConsumerControl::disposing( Source );
+}
+
+void SAL_CALL UnoButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw (uno::RuntimeException)
+{
+ // forward to model
+ uno::Any aAny;
+ aAny <<= (sal_Int16)rEvent.Selected;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
+
+ // multiplex
+ ItemEvent aEvent( rEvent );
+ aEvent.Source = *this;
+ maItemListeners.itemStateChanged( aEvent );
+}
+
+void UnoButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= rLabel;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+void UnoButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
+{
+ maActionCommand = rCommand;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->setActionCommand( rCommand );
+ }
+}
+
+awt::Size UnoButtonControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoButtonControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlImageControlModel
+// ----------------------------------------------------
+UnoControlImageControlModel::UnoControlImageControlModel()
+ :mbAdjustingImageScaleMode( false )
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXImageControl );
+}
+
+::rtl::OUString UnoControlImageControlModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControlModel );
+}
+
+uno::Any UnoControlImageControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlImageControl ) );
+
+ if ( nPropId == BASEPROPERTY_IMAGE_SCALE_MODE )
+ return makeAny( awt::ImageScaleMode::Anisotropic );
+
+ return ImageProducerControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlImageControlModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlImageControlModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+void SAL_CALL UnoControlImageControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::uno::Exception)
+{
+ ImageProducerControlModel::setFastPropertyValue_NoBroadcast( _nHandle, _rValue );
+
+ // ScaleImage is an older (and less powerful) version of ScaleMode, but keep both in sync as far as possible
+ try
+ {
+ switch ( _nHandle )
+ {
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_SCALEIMAGE ) )
+ {
+ mbAdjustingImageScaleMode = true;
+ sal_Int16 nScaleMode( awt::ImageScaleMode::Anisotropic );
+ OSL_VERIFY( _rValue >>= nScaleMode );
+ setPropertyValue( GetPropertyName( BASEPROPERTY_SCALEIMAGE ), uno::makeAny( sal_Bool( nScaleMode != awt::ImageScaleMode::None ) ) );
+ mbAdjustingImageScaleMode = false;
+ }
+ break;
+ case BASEPROPERTY_SCALEIMAGE:
+ if ( !mbAdjustingImageScaleMode && ImplHasProperty( BASEPROPERTY_IMAGE_SCALE_MODE ) )
+ {
+ mbAdjustingImageScaleMode = true;
+ sal_Bool bScale = sal_True;
+ OSL_VERIFY( _rValue >>= bScale );
+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ), uno::makeAny( bScale ? awt::ImageScaleMode::Anisotropic : awt::ImageScaleMode::None ) );
+ mbAdjustingImageScaleMode = false;
+ }
+ break;
+ }
+ }
+ catch( const Exception& )
+ {
+ mbAdjustingImageScaleMode = false;
+ throw;
+ }
+}
+
+// ----------------------------------------------------
+// class UnoImageControlControl
+// ----------------------------------------------------
+UnoImageControlControl::UnoImageControlControl()
+ : maActionListeners( *this )
+{
+ // Woher die Defaults nehmen?
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 100;
+}
+
+::rtl::OUString UnoImageControlControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "fixedimage" );
+}
+
+void UnoImageControlControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+sal_Bool UnoImageControlControl::isTransparent() throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+awt::Size UnoImageControlControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoImageControlControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoImageControlControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlRadioButtonModel
+// ----------------------------------------------------
+UnoControlRadioButtonModel::UnoControlRadioButtonModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXRadioButton );
+}
+
+::rtl::OUString UnoControlRadioButtonModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButtonModel );
+}
+
+uno::Any UnoControlRadioButtonModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlRadioButton ) );
+
+ case BASEPROPERTY_VISUALEFFECT:
+ return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
+ }
+
+ return ImageProducerControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlRadioButtonModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlRadioButtonModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoRadioButtonControl
+// ----------------------------------------------------
+UnoRadioButtonControl::UnoRadioButtonControl()
+ : maItemListeners( *this ), maActionListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoRadioButtonControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "radiobutton" );
+}
+
+void UnoRadioButtonControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aEvt );
+ ImageConsumerControl::dispose();
+}
+
+
+sal_Bool UnoRadioButtonControl::isTransparent() throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void UnoRadioButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ ImageConsumerControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XRadioButton > xRadioButton( getPeer(), uno::UNO_QUERY );
+ xRadioButton->addItemListener( this );
+
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->setActionCommand( maActionCommand );
+ if ( maActionListeners.getLength() )
+ xButton->addActionListener( &maActionListeners );
+
+ // as default, set the "AutoToggle" to true
+ // (it is set to false in VCLXToolkit::ImplCreateWindow because of #87254#, but we want to
+ // have it enabled by default because of 85071)
+ uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( getPeer(), uno::UNO_QUERY );
+ if ( xVclWindowPeer.is() )
+ xVclWindowPeer->setProperty( GetPropertyName( BASEPROPERTY_AUTOTOGGLE ), ::cppu::bool2any( sal_True ) );
+}
+
+void UnoRadioButtonControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+}
+
+void UnoRadioButtonControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.removeInterface( l );
+}
+
+void UnoRadioButtonControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoRadioButtonControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoRadioButtonControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= rLabel;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+void UnoRadioButtonControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
+{
+ maActionCommand = rCommand;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->setActionCommand( rCommand );
+ }
+}
+
+void UnoRadioButtonControl::setState( sal_Bool bOn ) throw(uno::RuntimeException)
+{
+ sal_Int16 nState = bOn ? 1 : 0;
+ uno::Any aAny;
+ aAny <<= nState;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
+}
+
+sal_Bool UnoRadioButtonControl::getState() throw(uno::RuntimeException)
+{
+ sal_Int16 nState = 0;
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
+ aVal >>= nState;
+ return nState ? sal_True : sal_False;
+}
+
+void UnoRadioButtonControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int16)rEvent.Selected;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
+
+ // compatibility:
+ // in OOo 1.0.x, when the user clicked a radio button in a group of buttons, this resulted
+ // in _one_ itemStateChanged call for exactly the radio button which's state changed from
+ // "0" to "1".
+ // Nowadays, since the listener handling changed a lot towards 1.1 (the VCLXWindow reacts on more
+ // basic events from the VCL-windows, not anymore on the Link-based events like in 1.0.x), this
+ // isn't the case anymore: For instance, this method here gets called for the radio button
+ // which is being implicitily _de_selected, too. This is pretty bad for compatibility.
+ // Thus, we suppress all events with a new state other than "1". This is unlogical, and weird, when looking
+ // from a pure API perspective, but it's _compatible_ with older product versions, and this is
+ // all which matters here.
+ // #i14703# - 2003-05-23 - fs@openoffice.org
+ if ( 1 == rEvent.Selected )
+ {
+ if ( maItemListeners.getLength() )
+ maItemListeners.itemStateChanged( rEvent );
+ }
+ // note that speaking stricly, this is wrong: When in 1.0.x, the user would have de-selected
+ // a radio button _without_ selecing another one, this would have caused a notification.
+ // With the change done here, this today won't cause a notification anymore.
+ //
+ // Fortunately, it's not possible for the user to de-select a radio button without selecting another on,
+ // at least not via the regular UI. It _would_ be possible via the Accessibility API, which
+ // counts as "user input", too. But in 1.0.x, there was no Accessibility API, so there is nothing
+ // to be inconsistent with.
+}
+
+awt::Size UnoRadioButtonControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoRadioButtonControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoRadioButtonControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlCheckBoxModel
+// ----------------------------------------------------
+UnoControlCheckBoxModel::UnoControlCheckBoxModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCheckBox );
+}
+
+::rtl::OUString UnoControlCheckBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBoxModel );
+}
+
+uno::Any UnoControlCheckBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlCheckBox ) );
+
+ case BASEPROPERTY_VISUALEFFECT:
+ return uno::makeAny( (sal_Int16)awt::VisualEffect::LOOK3D );
+ }
+
+ return ImageProducerControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlCheckBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlCheckBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoCheckBoxControl
+// ----------------------------------------------------
+UnoCheckBoxControl::UnoCheckBoxControl()
+ : maItemListeners( *this ), maActionListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoCheckBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "checkbox" );
+}
+
+void UnoCheckBoxControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aEvt );
+ ImageConsumerControl::dispose();
+}
+
+sal_Bool UnoCheckBoxControl::isTransparent() throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void UnoCheckBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ ImageConsumerControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XCheckBox > xCheckBox( getPeer(), uno::UNO_QUERY );
+ xCheckBox->addItemListener( this );
+
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->setActionCommand( maActionCommand );
+ if ( maActionListeners.getLength() )
+ xButton->addActionListener( &maActionListeners );
+}
+
+void UnoCheckBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+}
+
+void UnoCheckBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.removeInterface( l );
+}
+
+void UnoCheckBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoCheckBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoCheckBoxControl::setActionCommand( const ::rtl::OUString& rCommand ) throw(uno::RuntimeException)
+{
+ maActionCommand = rCommand;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XButton > xButton( getPeer(), uno::UNO_QUERY );
+ xButton->setActionCommand( rCommand );
+ }
+}
+
+
+void UnoCheckBoxControl::setLabel( const ::rtl::OUString& rLabel ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= rLabel;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+void UnoCheckBoxControl::setState( short n ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int16)n;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_True );
+}
+
+short UnoCheckBoxControl::getState() throw(uno::RuntimeException)
+{
+ short nState = 0;
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ) );
+ aVal >>= nState;
+ return nState;
+}
+
+void UnoCheckBoxControl::enableTriState( sal_Bool b ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= b;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TRISTATE ), aAny, sal_True );
+}
+
+void UnoCheckBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int16)rEvent.Selected;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STATE ), aAny, sal_False );
+
+ if ( maItemListeners.getLength() )
+ maItemListeners.itemStateChanged( rEvent );
+}
+
+awt::Size UnoCheckBoxControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoCheckBoxControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoCheckBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlFixedHyperlinkModel
+// ----------------------------------------------------
+UnoControlFixedHyperlinkModel::UnoControlFixedHyperlinkModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedHyperlink );
+}
+
+::rtl::OUString UnoControlFixedHyperlinkModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedHyperlinkModel );
+}
+
+uno::Any UnoControlFixedHyperlinkModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedHyperlink );
+ return aAny;
+ }
+ else if ( nPropId == BASEPROPERTY_BORDER )
+ {
+ uno::Any aAny;
+ aAny <<= (sal_Int16)0;
+ return aAny;
+ }
+ else if ( nPropId == BASEPROPERTY_URL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString();
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlFixedHyperlinkModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlFixedHyperlinkModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoFixedHyperlinkControl
+// ----------------------------------------------------
+UnoFixedHyperlinkControl::UnoFixedHyperlinkControl()
+ : maActionListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoFixedHyperlinkControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "fixedhyperlink" );
+}
+
+// uno::XInterface
+uno::Any UnoFixedHyperlinkControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XFixedHyperlink*, this ),
+ SAL_STATIC_CAST( awt::XLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoFixedHyperlinkControl )
+ getCppuType( ( uno::Reference< awt::XFixedHyperlink>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+sal_Bool UnoFixedHyperlinkControl::isTransparent() throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void UnoFixedHyperlinkControl::setText( const ::rtl::OUString& Text ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Text;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+::rtl::OUString UnoFixedHyperlinkControl::getText() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
+}
+
+void UnoFixedHyperlinkControl::setURL( const ::rtl::OUString& URL ) throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= URL;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_URL ), aAny, sal_True );
+}
+
+::rtl::OUString UnoFixedHyperlinkControl::getURL( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_UString( BASEPROPERTY_URL );
+}
+
+void UnoFixedHyperlinkControl::setAlignment( short nAlign ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int16)nAlign;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, sal_True );
+}
+
+short UnoFixedHyperlinkControl::getAlignment() throw(uno::RuntimeException)
+{
+ short nAlign = 0;
+ if ( mxModel.is() )
+ {
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
+ aVal >>= nAlign;
+ }
+ return nAlign;
+}
+
+awt::Size UnoFixedHyperlinkControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoFixedHyperlinkControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoFixedHyperlinkControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+void UnoFixedHyperlinkControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ UnoControlBase::dispose();
+}
+
+void UnoFixedHyperlinkControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
+ if ( maActionListeners.getLength() )
+ xFixedHyperlink->addActionListener( &maActionListeners );
+}
+
+void UnoFixedHyperlinkControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
+ xFixedHyperlink->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoFixedHyperlinkControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XFixedHyperlink > xFixedHyperlink( getPeer(), uno::UNO_QUERY );
+ xFixedHyperlink->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+// ----------------------------------------------------
+// class UnoControlFixedTextModel
+// ----------------------------------------------------
+UnoControlFixedTextModel::UnoControlFixedTextModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXFixedText );
+}
+
+::rtl::OUString UnoControlFixedTextModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedTextModel );
+}
+
+uno::Any UnoControlFixedTextModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedText );
+ return aAny;
+ }
+ else if ( nPropId == BASEPROPERTY_BORDER )
+ {
+ uno::Any aAny;
+ aAny <<= (sal_Int16)0;
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlFixedTextModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlFixedTextModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoFixedTextControl
+// ----------------------------------------------------
+UnoFixedTextControl::UnoFixedTextControl()
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoFixedTextControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "fixedtext" );
+}
+
+// uno::XInterface
+uno::Any UnoFixedTextControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XFixedText*, this ),
+ SAL_STATIC_CAST( awt::XLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoFixedTextControl )
+ getCppuType( ( uno::Reference< awt::XFixedText>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+sal_Bool UnoFixedTextControl::isTransparent() throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void UnoFixedTextControl::setText( const ::rtl::OUString& Text ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Text;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LABEL ), aAny, sal_True );
+}
+
+::rtl::OUString UnoFixedTextControl::getText() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_UString( BASEPROPERTY_LABEL );
+}
+
+void UnoFixedTextControl::setAlignment( short nAlign ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int16)nAlign;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ), aAny, sal_True );
+}
+
+short UnoFixedTextControl::getAlignment() throw(uno::RuntimeException)
+{
+ short nAlign = 0;
+ if ( mxModel.is() )
+ {
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_ALIGN ) );
+ aVal >>= nAlign;
+ }
+ return nAlign;
+}
+
+awt::Size UnoFixedTextControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoFixedTextControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoFixedTextControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+// ----------------------------------------------------
+// class UnoControlGroupBoxModel
+// ----------------------------------------------------
+UnoControlGroupBoxModel::UnoControlGroupBoxModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_WRITING_MODE );
+ ImplRegisterProperty( BASEPROPERTY_CONTEXT_WRITING_MODE );
+}
+
+::rtl::OUString UnoControlGroupBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBoxModel );
+}
+
+uno::Any UnoControlGroupBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlGroupBox );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlGroupBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlGroupBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoGroupBoxControl
+// ----------------------------------------------------
+UnoGroupBoxControl::UnoGroupBoxControl()
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 100;
+}
+
+::rtl::OUString UnoGroupBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "groupbox" );
+}
+
+sal_Bool UnoGroupBoxControl::isTransparent() throw(uno::RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------
+// class UnoControlListBoxModel
+// ----------------------------------------------------
+UnoControlListBoxModel::UnoControlListBoxModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
+}
+
+::rtl::OUString UnoControlListBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBoxModel );
+}
+
+uno::Any UnoControlListBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlListBox );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlListBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlListBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+void UnoControlListBoxModel::ImplPropertyChanged( sal_uInt16 nPropId )
+{
+ if ( nPropId == BASEPROPERTY_STRINGITEMLIST )
+ {
+ uno::Sequence<sal_Int16> aSeq;
+ uno::Any aAny;
+ aAny <<= aSeq;
+ setPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny );
+ }
+
+ UnoControlModel::ImplPropertyChanged( nPropId );
+}
+
+void UnoControlListBoxModel::ImplNormalizePropertySequence( const sal_Int32 _nCount, sal_Int32* _pHandles,
+ uno::Any* _pValues, sal_Int32* _pValidHandles ) const SAL_THROW(())
+{
+ // dependencies we know:
+ // BASEPROPERTY_STRINGITEMLIST->BASEPROPERTY_SELECTEDITEMS
+ ImplEnsureHandleOrder( _nCount, _pHandles, _pValues, BASEPROPERTY_STRINGITEMLIST, BASEPROPERTY_SELECTEDITEMS );
+
+ UnoControlModel::ImplNormalizePropertySequence( _nCount, _pHandles, _pValues, _pValidHandles );
+}
+
+// ----------------------------------------------------
+// class UnoListBoxControl
+// ----------------------------------------------------
+UnoListBoxControl::UnoListBoxControl()
+ : maActionListeners( *this ),
+ maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoListBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "listbox" );
+}
+
+// uno::XInterface
+uno::Any UnoListBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XListBox*, this ),
+ SAL_STATIC_CAST( awt::XItemListener*, this ),
+ SAL_STATIC_CAST( lang::XEventListener*, SAL_STATIC_CAST( awt::XItemListener*, this ) ),
+ SAL_STATIC_CAST( awt::XLayoutConstrains*, this ),
+ SAL_STATIC_CAST( awt::XTextLayoutConstrains*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoListBoxControl )
+ getCppuType( ( uno::Reference< awt::XListBox>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XLayoutConstrains>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XTextLayoutConstrains>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoListBoxControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoListBoxControl::ImplUpdateSelectedItemsProperty()
+{
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ DBG_ASSERT( xListBox.is(), "XListBox?" );
+
+ uno::Sequence<sal_Int16> aSeq = xListBox->getSelectedItemsPos();
+ uno::Any aAny;
+ aAny <<= aSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ), aAny, sal_False );
+ }
+}
+
+void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
+ UnoControl::ImplSetPeerProperty( rPropName, rVal );
+
+ // Wenn die SelectedItems vor der StringItemList gesetzt werden,
+ // hat das keine Auswirkung...
+ if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
+ {
+ ::rtl::OUString aSelPropName = GetPropertyName( BASEPROPERTY_SELECTEDITEMS );
+ uno::Any aVal = ImplGetPropertyValue( aSelPropName );
+ if ( !( aVal.getValueType().getTypeClass() == uno::TypeClass_VOID ) )
+ {
+ uno::Reference< awt::XVclWindowPeer > xW( getPeer(), uno::UNO_QUERY );
+ if (xW.is())
+ // same comment as in UnoControl::ImplSetPeerProperty - see there
+ xW->setProperty( aSelPropName, aVal );
+ }
+ }
+}
+
+void UnoListBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ xListBox->addItemListener( this );
+
+ if ( maActionListeners.getLength() )
+ xListBox->addActionListener( &maActionListeners );
+}
+
+void UnoListBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ xListBox->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoListBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ xListBox->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoListBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+}
+
+void UnoListBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.removeInterface( l );
+}
+
+void UnoListBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString> aSeq( 1 );
+ aSeq.getArray()[0] = aItem;
+ addItems( aSeq, nPos );
+}
+
+void UnoListBoxControl::addItems( const uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ sal_uInt16 nNewLen = nOldLen + nNewItems;
+
+ uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ ::rtl::OUString* pOldData = aSeq.getArray();
+
+ if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
+ nPos = (sal_uInt16) nOldLen;
+
+ sal_uInt16 n;
+ // Items vor der Einfuege-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Neue Items
+ for ( n = 0; n < nNewItems; n++ )
+ pNewData[nPos+n] = aItems.getConstArray()[n];
+
+ // Rest der alten Items
+ for ( n = nPos; n < nOldLen; n++ )
+ pNewData[nNewItems+n] = pOldData[n];
+
+ uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+}
+
+void UnoListBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ if ( nOldLen && ( nPos < nOldLen ) )
+ {
+ if ( nCount > ( nOldLen-nPos ) )
+ nCount = nOldLen-nPos;
+
+ sal_uInt16 nNewLen = nOldLen - nCount;
+
+ uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ ::rtl::OUString* pOldData = aSeq.getArray();
+
+ sal_uInt16 n;
+ // Items vor der Entfern-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Rest der Items
+ for ( n = nPos; n < (nOldLen-nCount); n++ )
+ pNewData[n] = pOldData[n+nCount];
+
+ uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+ }
+}
+
+sal_Int16 UnoListBoxControl::getItemCount() throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return (sal_Int16)aSeq.getLength();
+}
+
+::rtl::OUString UnoListBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException)
+{
+ ::rtl::OUString aItem;
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ if ( nPos < aSeq.getLength() )
+ aItem = aSeq.getConstArray()[nPos];
+ return aItem;
+}
+
+uno::Sequence< ::rtl::OUString> UnoListBoxControl::getItems() throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return aSeq;
+}
+
+sal_Int16 UnoListBoxControl::getSelectedItemPos() throw(uno::RuntimeException)
+{
+ sal_Int16 n = -1;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ n = xListBox->getSelectedItemPos();
+ }
+ return n;
+}
+
+uno::Sequence<sal_Int16> UnoListBoxControl::getSelectedItemsPos() throw(uno::RuntimeException)
+{
+ uno::Sequence<sal_Int16> aSeq;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ aSeq = xListBox->getSelectedItemsPos();
+ }
+ return aSeq;
+}
+
+::rtl::OUString UnoListBoxControl::getSelectedItem() throw(uno::RuntimeException)
+{
+ ::rtl::OUString aItem;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ aItem = xListBox->getSelectedItem();
+ }
+ return aItem;
+}
+
+uno::Sequence< ::rtl::OUString> UnoListBoxControl::getSelectedItems() throw(uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString> aSeq;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ aSeq = xListBox->getSelectedItems();
+ }
+ return aSeq;
+}
+
+void UnoListBoxControl::selectItemPos( sal_Int16 nPos, sal_Bool bSelect ) throw(uno::RuntimeException)
+{
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ xListBox->selectItemPos( nPos, bSelect );
+ }
+ ImplUpdateSelectedItemsProperty();
+}
+
+void UnoListBoxControl::selectItemsPos( const uno::Sequence<sal_Int16>& aPositions, sal_Bool bSelect ) throw(uno::RuntimeException)
+{
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ xListBox->selectItemsPos( aPositions, bSelect );
+ }
+ ImplUpdateSelectedItemsProperty();
+}
+
+void UnoListBoxControl::selectItem( const ::rtl::OUString& aItem, sal_Bool bSelect ) throw(uno::RuntimeException)
+{
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ xListBox->selectItem( aItem, bSelect );
+ }
+ ImplUpdateSelectedItemsProperty();
+}
+
+void UnoListBoxControl::makeVisible( sal_Int16 nEntry ) throw(uno::RuntimeException)
+{
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XListBox > xListBox( getPeer(), uno::UNO_QUERY );
+ xListBox->makeVisible( nEntry );
+ }
+}
+
+void UnoListBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= (sal_Int16)nLines;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
+}
+
+sal_Int16 UnoListBoxControl::getDropDownLineCount() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
+}
+
+sal_Bool UnoListBoxControl::isMutipleMode() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_MULTISELECTION );
+}
+
+void UnoListBoxControl::setMultipleMode( sal_Bool bMulti ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= bMulti;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_MULTISELECTION ), aAny, sal_True );
+}
+
+void UnoListBoxControl::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
+{
+ ImplUpdateSelectedItemsProperty();
+ if ( maItemListeners.getLength() )
+ {
+ try
+ {
+ maItemListeners.itemStateChanged( rEvent );
+ }
+ catch( const Exception& e )
+ {
+#if OSL_DEBUG_LEVEL == 0
+ (void) e; // suppress warning
+#else
+ ::rtl::OString sMessage( "UnoListBoxControl::itemStateChanged: caught an exception:\n" );
+ sMessage += ::rtl::OString( e.Message.getStr(), e.Message.getLength(), RTL_TEXTENCODING_ASCII_US );
+ OSL_ENSURE( sal_False, sMessage.getStr() );
+#endif
+ }
+ }
+}
+
+awt::Size UnoListBoxControl::getMinimumSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize();
+}
+
+awt::Size UnoListBoxControl::getPreferredSize( ) throw(uno::RuntimeException)
+{
+ return Impl_getPreferredSize();
+}
+
+awt::Size UnoListBoxControl::calcAdjustedSize( const awt::Size& rNewSize ) throw(uno::RuntimeException)
+{
+ return Impl_calcAdjustedSize( rNewSize );
+}
+
+awt::Size UnoListBoxControl::getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) throw(uno::RuntimeException)
+{
+ return Impl_getMinimumSize( nCols, nLines );
+}
+
+void UnoListBoxControl::getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) throw(uno::RuntimeException)
+{
+ Impl_getColumnsAndLines( nCols, nLines );
+}
+
+// ----------------------------------------------------
+// class UnoControlComboBoxModel
+// ----------------------------------------------------
+UnoControlComboBoxModel::UnoControlComboBoxModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXComboBox );
+}
+
+::rtl::OUString UnoControlComboBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel );
+}
+
+uno::Any UnoControlComboBoxModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBox );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoComboBoxControl
+// ----------------------------------------------------
+UnoComboBoxControl::UnoComboBoxControl()
+ : maActionListeners( *this ),
+ maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoComboBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "combobox" );
+}
+
+// uno::XInterface
+uno::Any UnoComboBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XComboBox*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoComboBoxControl )
+ getCppuType( ( uno::Reference< awt::XComboBox>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoComboBoxControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoComboBoxControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoEditControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
+ if ( maActionListeners.getLength() )
+ xComboBox->addActionListener( &maActionListeners );
+ if ( maItemListeners.getLength() )
+ xComboBox->addItemListener( &maItemListeners );
+}
+
+void UnoComboBoxControl::addActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ maActionListeners.addInterface( l );
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
+ xComboBox->addActionListener( &maActionListeners );
+ }
+}
+
+void UnoComboBoxControl::removeActionListener(const uno::Reference< awt::XActionListener > & l) throw(uno::RuntimeException)
+{
+ if( getPeer().is() && maActionListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
+ xComboBox->removeActionListener( &maActionListeners );
+ }
+ maActionListeners.removeInterface( l );
+}
+
+void UnoComboBoxControl::addItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ maItemListeners.addInterface( l );
+ if( getPeer().is() && maItemListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY );
+ xComboBox->addItemListener( &maItemListeners );
+ }
+}
+
+void UnoComboBoxControl::removeItemListener(const uno::Reference < awt::XItemListener > & l) throw(uno::RuntimeException)
+{
+ if( getPeer().is() && maItemListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XComboBox > xComboBox( getPeer(), uno::UNO_QUERY ); // MT: Mal alles so umstellen, schoener als Ref anlegen und query rufen
+ xComboBox->removeItemListener( &maItemListeners );
+ }
+ maItemListeners.removeInterface( l );
+}
+
+void UnoComboBoxControl::addItem( const ::rtl::OUString& aItem, sal_Int16 nPos ) throw(uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString> aSeq( 1 );
+ aSeq.getArray()[0] = aItem;
+ addItems( aSeq, nPos );
+}
+
+void UnoComboBoxControl::addItems( const uno::Sequence< ::rtl::OUString>& aItems, sal_Int16 nPos ) throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nNewItems = (sal_uInt16)aItems.getLength();
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ sal_uInt16 nNewLen = nOldLen + nNewItems;
+
+ uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ const ::rtl::OUString* pOldData = aSeq.getConstArray();
+
+ if ( ( nPos < 0 ) || ( nPos > nOldLen ) )
+ nPos = (sal_uInt16) nOldLen;
+
+ sal_uInt16 n;
+ // Items vor der Einfuege-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Neue Items
+ for ( n = 0; n < nNewItems; n++ )
+ pNewData[nPos+n] = aItems.getConstArray()[n];
+
+ // Rest der alten Items
+ for ( n = nPos; n < nOldLen; n++ )
+ pNewData[nNewItems+n] = pOldData[n];
+
+ uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+}
+
+void UnoComboBoxControl::removeItems( sal_Int16 nPos, sal_Int16 nCount ) throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ sal_uInt16 nOldLen = (sal_uInt16)aSeq.getLength();
+ if ( nOldLen && ( nPos < nOldLen ) )
+ {
+ if ( nCount > ( nOldLen-nPos ) )
+ nCount = nOldLen-nPos;
+
+ sal_uInt16 nNewLen = nOldLen - nCount;
+
+ uno::Sequence< ::rtl::OUString> aNewSeq( nNewLen );
+ ::rtl::OUString* pNewData = aNewSeq.getArray();
+ ::rtl::OUString* pOldData = aSeq.getArray();
+
+ sal_uInt16 n;
+ // Items vor der Entfern-Position
+ for ( n = 0; n < nPos; n++ )
+ pNewData[n] = pOldData[n];
+
+ // Rest der Items
+ for ( n = nPos; n < (nOldLen-nCount); n++ )
+ pNewData[n] = pOldData[n+nCount];
+
+ uno::Any aAny;
+ aAny <<= aNewSeq;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ), aAny, sal_True );
+ }
+}
+
+sal_Int16 UnoComboBoxControl::getItemCount() throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return (sal_Int16)aSeq.getLength();
+}
+
+::rtl::OUString UnoComboBoxControl::getItem( sal_Int16 nPos ) throw(uno::RuntimeException)
+{
+ ::rtl::OUString aItem;
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ if ( nPos < aSeq.getLength() )
+ aItem = aSeq.getConstArray()[nPos];
+ return aItem;
+}
+
+uno::Sequence< ::rtl::OUString> UnoComboBoxControl::getItems() throw(uno::RuntimeException)
+{
+ uno::Any aVal = ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) );
+ uno::Sequence< ::rtl::OUString> aSeq;
+ aVal >>= aSeq;
+ return aSeq;
+}
+
+void UnoComboBoxControl::setDropDownLineCount( sal_Int16 nLines ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= nLines;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LINECOUNT ), aAny, sal_True );
+}
+
+sal_Int16 UnoComboBoxControl::getDropDownLineCount() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT16( BASEPROPERTY_LINECOUNT );
+}
+
+
+// ----------------------------------------------------
+// UnoSpinFieldControl
+// ----------------------------------------------------
+UnoSpinFieldControl::UnoSpinFieldControl() : maSpinListeners( *this )
+{
+ mbRepeat = sal_False;
+}
+
+// uno::XInterface
+uno::Any UnoSpinFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XSpinField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoSpinFieldControl )
+ getCppuType( ( uno::Reference< awt::XSpinField>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoSpinFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoEditControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ xField->enableRepeat( mbRepeat );
+ if ( maSpinListeners.getLength() )
+ xField->addSpinListener( &maSpinListeners );
+}
+
+ // ::com::sun::star::awt::XSpinField
+void UnoSpinFieldControl::addSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ maSpinListeners.addInterface( l );
+ if( getPeer().is() && maSpinListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ xField->addSpinListener( &maSpinListeners );
+ }
+}
+
+void UnoSpinFieldControl::removeSpinListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XSpinListener >& l ) throw(::com::sun::star::uno::RuntimeException)
+{
+ if( getPeer().is() && maSpinListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ xField->removeSpinListener( &maSpinListeners );
+ }
+ maSpinListeners.removeInterface( l );
+}
+
+void UnoSpinFieldControl::up() throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ if ( xField.is() )
+ xField->up();
+}
+
+void UnoSpinFieldControl::down() throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ if ( xField.is() )
+ xField->down();
+}
+
+void UnoSpinFieldControl::first() throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ if ( xField.is() )
+ xField->first();
+}
+
+void UnoSpinFieldControl::last() throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ if ( xField.is() )
+ xField->last();
+}
+
+void UnoSpinFieldControl::enableRepeat( sal_Bool bRepeat ) throw(::com::sun::star::uno::RuntimeException)
+{
+ mbRepeat = bRepeat;
+
+ uno::Reference < awt::XSpinField > xField( getPeer(), uno::UNO_QUERY );
+ if ( xField.is() )
+ xField->enableRepeat( bRepeat );
+}
+
+// ----------------------------------------------------
+// class UnoControlDateFieldModel
+// ----------------------------------------------------
+UnoControlDateFieldModel::UnoControlDateFieldModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXDateField );
+}
+
+::rtl::OUString UnoControlDateFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateFieldModel );
+}
+
+uno::Any UnoControlDateFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlDateField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlDateFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlDateFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoDateFieldControl
+// ----------------------------------------------------
+UnoDateFieldControl::UnoDateFieldControl()
+{
+ mnFirst = Date( 1, 1, 1900 ).GetDate();
+ mnLast = Date( 31, 12, 2200 ).GetDate();
+ mbLongFormat = 2;
+}
+
+::rtl::OUString UnoDateFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "datefield" );
+}
+
+// uno::XInterface
+uno::Any UnoDateFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XDateField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoDateFieldControl )
+ getCppuType( ( uno::Reference< awt::XDateField>* ) NULL ),
+ UnoSpinFieldControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoDateFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnFirst );
+ xField->setLast( mnLast );
+ if ( mbLongFormat != 2 ) // not set
+ xField->setLongFormat( mbLongFormat );
+}
+
+
+void UnoDateFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
+{
+ uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
+
+ // also change the text property (#i25106#)
+ if ( xPeer.is() )
+ {
+ ::rtl::OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
+ ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), sal_False );
+ }
+
+ // re-calc the Date property
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
+ uno::Any aValue;
+ if ( xField->isEmpty() )
+ {
+ // the field says it's empty
+ sal_Bool bEnforceFormat = sal_True;
+ if ( xPeer.is() )
+ xPeer->getProperty( GetPropertyName( BASEPROPERTY_ENFORCE_FORMAT ) ) >>= bEnforceFormat;
+ if ( !bEnforceFormat )
+ {
+ // and it also says that it is currently accepting invalid inputs, without
+ // forcing it to a valid date
+ uno::Reference< awt::XTextComponent > xText( xPeer, uno::UNO_QUERY );
+ if ( xText.is() && xText->getText().getLength() )
+ // and in real, the text of the peer is *not* empty
+ // -> simulate an invalid date, which is different from "no date"
+ aValue <<= util::Date( 0, 0, 0 );
+ }
+ }
+ else
+ aValue <<= xField->getDate();
+
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aValue, sal_False );
+
+ // multiplex the event
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoDateFieldControl::setDate( sal_Int32 Date ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Date;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATE ), aAny, sal_True );
+}
+
+sal_Int32 UnoDateFieldControl::getDate() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_DATE );
+}
+
+void UnoDateFieldControl::setMin( sal_Int32 Date ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Date;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMIN ), aAny, sal_True );
+}
+
+sal_Int32 UnoDateFieldControl::getMin() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMIN );
+}
+
+void UnoDateFieldControl::setMax( sal_Int32 Date ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Date;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DATEMAX ), aAny, sal_True );
+}
+
+sal_Int32 UnoDateFieldControl::getMax() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_DATEMAX );
+}
+
+void UnoDateFieldControl::setFirst( sal_Int32 Date ) throw(uno::RuntimeException)
+{
+ mnFirst = Date;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( Date );
+ }
+}
+
+sal_Int32 UnoDateFieldControl::getFirst() throw(uno::RuntimeException)
+{
+ return mnFirst;
+}
+
+void UnoDateFieldControl::setLast( sal_Int32 Date ) throw(uno::RuntimeException)
+{
+ mnLast = Date;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setLast( Date );
+ }
+}
+
+sal_Int32 UnoDateFieldControl::getLast() throw(uno::RuntimeException)
+{
+ return mnLast;
+}
+
+void UnoDateFieldControl::setLongFormat( sal_Bool bLong ) throw(uno::RuntimeException)
+{
+ mbLongFormat = bLong;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setLongFormat( bLong );
+ }
+}
+
+sal_Bool UnoDateFieldControl::isLongFormat() throw(uno::RuntimeException)
+{
+ return ( mbLongFormat != 2 ) ? mbLongFormat : sal_False;
+}
+
+void UnoDateFieldControl::setEmpty() throw(uno::RuntimeException)
+{
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setEmpty();
+ }
+}
+
+sal_Bool UnoDateFieldControl::isEmpty() throw(uno::RuntimeException)
+{
+ sal_Bool bEmpty = sal_False;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XDateField > xField( getPeer(), uno::UNO_QUERY );
+ bEmpty = xField->isEmpty();
+ }
+ return bEmpty;
+}
+
+void UnoDateFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoDateFieldControl::isStrictFormat() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+// ----------------------------------------------------
+// class UnoControlTimeFieldModel
+// ----------------------------------------------------
+UnoControlTimeFieldModel::UnoControlTimeFieldModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXTimeField );
+}
+
+::rtl::OUString UnoControlTimeFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeFieldModel );
+}
+
+uno::Any UnoControlTimeFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTimeField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlTimeFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlTimeFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoTimeFieldControl
+// ----------------------------------------------------
+UnoTimeFieldControl::UnoTimeFieldControl()
+{
+ mnFirst = Time( 0, 0 ).GetTime();
+ mnLast = Time( 23, 59, 59, 99 ).GetTime();
+}
+
+::rtl::OUString UnoTimeFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "timefield" );
+}
+
+// uno::XInterface
+uno::Any UnoTimeFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XTimeField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoTimeFieldControl )
+ getCppuType( ( uno::Reference< awt::XTimeField>* ) NULL ),
+ UnoSpinFieldControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoTimeFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnFirst );
+ xField->setLast( mnLast );
+}
+
+void UnoTimeFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
+{
+ // also change the text property (#i25106#)
+ uno::Reference< awt::XVclWindowPeer > xPeer( getPeer(), uno::UNO_QUERY );
+ ::rtl::OUString sTextPropertyName = GetPropertyName( BASEPROPERTY_TEXT );
+ ImplSetPropertyValue( sTextPropertyName, xPeer->getProperty( sTextPropertyName ), sal_False );
+
+ // re-calc the Time property
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
+ uno::Any aValue;
+ if ( !xField->isEmpty() )
+ aValue <<= xField->getTime();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aValue, sal_False );
+
+ // multiplex the event
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoTimeFieldControl::setTime( sal_Int32 Time ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Time;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIME ), aAny, sal_True );
+}
+
+sal_Int32 UnoTimeFieldControl::getTime() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_TIME );
+}
+
+void UnoTimeFieldControl::setMin( sal_Int32 Time ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Time;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMIN ), aAny, sal_True );
+}
+
+sal_Int32 UnoTimeFieldControl::getMin() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMIN );
+}
+
+void UnoTimeFieldControl::setMax( sal_Int32 Time ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Time;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_TIMEMAX ), aAny, sal_True );
+}
+
+sal_Int32 UnoTimeFieldControl::getMax() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_TIMEMAX );
+}
+
+void UnoTimeFieldControl::setFirst( sal_Int32 Time ) throw(uno::RuntimeException)
+{
+ mnFirst = Time;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnFirst );
+ }
+}
+
+sal_Int32 UnoTimeFieldControl::getFirst() throw(uno::RuntimeException)
+{
+ return mnFirst;
+}
+
+void UnoTimeFieldControl::setLast( sal_Int32 Time ) throw(uno::RuntimeException)
+{
+ mnLast = Time;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnLast );
+ }
+}
+
+sal_Int32 UnoTimeFieldControl::getLast() throw(uno::RuntimeException)
+{
+ return mnLast;
+}
+
+void UnoTimeFieldControl::setEmpty() throw(uno::RuntimeException)
+{
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setEmpty();
+ }
+}
+
+sal_Bool UnoTimeFieldControl::isEmpty() throw(uno::RuntimeException)
+{
+ sal_Bool bEmpty = sal_False;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XTimeField > xField( getPeer(), uno::UNO_QUERY );
+ bEmpty = xField->isEmpty();
+ }
+ return bEmpty;
+}
+
+void UnoTimeFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoTimeFieldControl::isStrictFormat() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+// ----------------------------------------------------
+// class UnoControlNumericFieldModel
+// ----------------------------------------------------
+UnoControlNumericFieldModel::UnoControlNumericFieldModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXNumericField );
+}
+
+::rtl::OUString UnoControlNumericFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericFieldModel );
+}
+
+uno::Any UnoControlNumericFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlNumericField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+
+::cppu::IPropertyArrayHelper& UnoControlNumericFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlNumericFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+
+// ----------------------------------------------------
+// class UnoNumericFieldControl
+// ----------------------------------------------------
+UnoNumericFieldControl::UnoNumericFieldControl()
+{
+ mnFirst = 0;
+ mnLast = 0x7FFFFFFF;
+}
+
+::rtl::OUString UnoNumericFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "numericfield" );
+}
+
+// uno::XInterface
+uno::Any UnoNumericFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XNumericField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoNumericFieldControl )
+ getCppuType( ( uno::Reference< awt::XNumericField>* ) NULL ),
+ UnoSpinFieldControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoNumericFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnFirst );
+ xField->setLast( mnLast );
+}
+
+
+void UnoNumericFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
+{
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
+ uno::Any aAny;
+ aAny <<= xField->getValue();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoNumericFieldControl::setValue( double Value ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getValue() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
+}
+
+void UnoNumericFieldControl::setMin( double Value ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getMin() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
+}
+
+void UnoNumericFieldControl::setMax( double Value ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getMax() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
+}
+
+void UnoNumericFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
+{
+ mnFirst = Value;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnFirst );
+ }
+}
+
+double UnoNumericFieldControl::getFirst() throw(uno::RuntimeException)
+{
+ return mnFirst;
+}
+
+void UnoNumericFieldControl::setLast( double Value ) throw(uno::RuntimeException)
+{
+ mnLast = Value;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XNumericField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setLast( mnLast );
+ }
+}
+
+double UnoNumericFieldControl::getLast() throw(uno::RuntimeException)
+{
+ return mnLast;
+}
+
+void UnoNumericFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoNumericFieldControl::isStrictFormat() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+void UnoNumericFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Digits;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
+}
+
+double UnoNumericFieldControl::getSpinSize() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
+}
+
+void UnoNumericFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Digits;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, sal_True );
+}
+
+sal_Int16 UnoNumericFieldControl::getDecimalDigits() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
+}
+
+// ----------------------------------------------------
+// class UnoControlCurrencyFieldModel
+// ----------------------------------------------------
+UnoControlCurrencyFieldModel::UnoControlCurrencyFieldModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXCurrencyField );
+}
+
+::rtl::OUString UnoControlCurrencyFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyFieldModel );
+}
+
+uno::Any UnoControlCurrencyFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlCurrencyField );
+ return aAny;
+ }
+ if ( nPropId == BASEPROPERTY_CURSYM_POSITION )
+ {
+ uno::Any aAny;
+ aAny <<= (sal_Bool)sal_False;
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlCurrencyFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlCurrencyFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoCurrencyFieldControl
+// ----------------------------------------------------
+UnoCurrencyFieldControl::UnoCurrencyFieldControl()
+{
+ mnFirst = 0;
+ mnLast = 0x7FFFFFFF;
+}
+
+::rtl::OUString UnoCurrencyFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "longcurrencyfield" );
+}
+
+// uno::XInterface
+uno::Any UnoCurrencyFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XCurrencyField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoCurrencyFieldControl )
+ getCppuType( ( uno::Reference< awt::XCurrencyField>* ) NULL ),
+ UnoSpinFieldControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoCurrencyFieldControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoSpinFieldControl::createPeer( rxToolkit, rParentPeer );
+
+ uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnFirst );
+ xField->setLast( mnLast );
+}
+
+void UnoCurrencyFieldControl::textChanged( const awt::TextEvent& e ) throw(uno::RuntimeException)
+{
+ uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
+ uno::Any aAny;
+ aAny <<= xField->getValue();
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_False );
+
+ if ( GetTextListeners().getLength() )
+ GetTextListeners().textChanged( e );
+}
+
+void UnoCurrencyFieldControl::setValue( double Value ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUE_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getValue() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUE_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setMin( double Value ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMIN_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getMin() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMIN_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setMax( double Value ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Value;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUEMAX_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getMax() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUEMAX_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setFirst( double Value ) throw(uno::RuntimeException)
+{
+ mnFirst = Value;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setFirst( mnFirst );
+ }
+}
+
+double UnoCurrencyFieldControl::getFirst() throw(uno::RuntimeException)
+{
+ return mnFirst;
+}
+
+void UnoCurrencyFieldControl::setLast( double Value ) throw(uno::RuntimeException)
+{
+ mnLast = Value;
+ if ( getPeer().is() )
+ {
+ uno::Reference < awt::XCurrencyField > xField( getPeer(), uno::UNO_QUERY );
+ xField->setLast( mnLast );
+ }
+}
+
+double UnoCurrencyFieldControl::getLast() throw(uno::RuntimeException)
+{
+ return mnLast;
+}
+
+void UnoCurrencyFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoCurrencyFieldControl::isStrictFormat() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+void UnoCurrencyFieldControl::setSpinSize( double Digits ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Digits;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_VALUESTEP_DOUBLE ), aAny, sal_True );
+}
+
+double UnoCurrencyFieldControl::getSpinSize() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_DOUBLE( BASEPROPERTY_VALUESTEP_DOUBLE );
+}
+
+void UnoCurrencyFieldControl::setDecimalDigits( sal_Int16 Digits ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= Digits;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_DECIMALACCURACY ), aAny, sal_True );
+}
+
+sal_Int16 UnoCurrencyFieldControl::getDecimalDigits() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT16( BASEPROPERTY_DECIMALACCURACY );
+}
+
+// ----------------------------------------------------
+// class UnoControlPatternFieldModel
+// ----------------------------------------------------
+UnoControlPatternFieldModel::UnoControlPatternFieldModel()
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXPatternField );
+}
+
+::rtl::OUString UnoControlPatternFieldModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternFieldModel );
+}
+
+uno::Any UnoControlPatternFieldModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlPatternField );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlPatternFieldModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlPatternFieldModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoPatternFieldControl
+// ----------------------------------------------------
+UnoPatternFieldControl::UnoPatternFieldControl()
+{
+}
+
+::rtl::OUString UnoPatternFieldControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "patternfield" );
+}
+
+void UnoPatternFieldControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
+ sal_uInt16 nType = GetPropertyId( rPropName );
+ if ( ( nType == BASEPROPERTY_TEXT ) || ( nType == BASEPROPERTY_EDITMASK ) || ( nType == BASEPROPERTY_LITERALMASK ) )
+ {
+ // Die Masken koennen nicht nacheinander gesetzt werden.
+ ::rtl::OUString Text = ImplGetPropertyValue_UString( BASEPROPERTY_TEXT );
+ ::rtl::OUString EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
+ ::rtl::OUString LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
+
+ uno::Reference < awt::XPatternField > xPF( getPeer(), uno::UNO_QUERY );
+ if (xPF.is())
+ {
+ // same comment as in UnoControl::ImplSetPeerProperty - see there
+ ::rtl::OUString sText( Text );
+ ImplCheckLocalize( sText );
+ xPF->setString( sText );
+ xPF->setMasks( EditMask, LiteralMask );
+ }
+ }
+ else
+ UnoSpinFieldControl::ImplSetPeerProperty( rPropName, rVal );
+}
+
+
+// uno::XInterface
+uno::Any UnoPatternFieldControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XPatternField*, this ) );
+ return (aRet.hasValue() ? aRet : UnoSpinFieldControl::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoPatternFieldControl )
+ getCppuType( ( uno::Reference< awt::XPatternField>* ) NULL ),
+ UnoSpinFieldControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoPatternFieldControl::setString( const ::rtl::OUString& rString ) throw(uno::RuntimeException)
+{
+ setText( rString );
+}
+
+::rtl::OUString UnoPatternFieldControl::getString() throw(uno::RuntimeException)
+{
+ return getText();
+}
+
+void UnoPatternFieldControl::setMasks( const ::rtl::OUString& EditMask, const ::rtl::OUString& LiteralMask ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= EditMask;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_EDITMASK ), aAny, sal_True );
+ aAny <<= LiteralMask;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_LITERALMASK ), aAny, sal_True );
+}
+
+void UnoPatternFieldControl::getMasks( ::rtl::OUString& EditMask, ::rtl::OUString& LiteralMask ) throw(uno::RuntimeException)
+{
+ EditMask = ImplGetPropertyValue_UString( BASEPROPERTY_EDITMASK );
+ LiteralMask = ImplGetPropertyValue_UString( BASEPROPERTY_LITERALMASK );
+}
+
+void UnoPatternFieldControl::setStrictFormat( sal_Bool bStrict ) throw(uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= bStrict;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_STRICTFORMAT ), aAny, sal_True );
+}
+
+sal_Bool UnoPatternFieldControl::isStrictFormat() throw(uno::RuntimeException)
+{
+ return ImplGetPropertyValue_BOOL( BASEPROPERTY_STRICTFORMAT );
+}
+
+
+// ----------------------------------------------------
+// class UnoControlProgressBarModel
+// ----------------------------------------------------
+UnoControlProgressBarModel::UnoControlProgressBarModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_FILLCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE );
+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MAX );
+ ImplRegisterProperty( BASEPROPERTY_PROGRESSVALUE_MIN );
+}
+
+::rtl::OUString UnoControlProgressBarModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlProgressBarModel );
+}
+
+uno::Any UnoControlProgressBarModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlProgressBar );
+ return aAny;
+ }
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlProgressBarModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlProgressBarModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+
+// ----------------------------------------------------
+// class UnoProgressBarControl
+// ----------------------------------------------------
+UnoProgressBarControl::UnoProgressBarControl()
+{
+}
+
+::rtl::OUString UnoProgressBarControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "ProgressBar" );
+}
+
+// uno::XInterface
+uno::Any UnoProgressBarControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XProgressBar*, this ) );
+ return (aRet.hasValue() ? aRet : UnoControlBase::queryAggregation( rType ));
+}
+
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoProgressBarControl )
+ getCppuType( ( uno::Reference< awt::XProgressBar>* ) NULL ),
+ UnoControlBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+// ::com::sun::star::awt::XProgressBar
+void UnoProgressBarControl::setForegroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= nColor;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_FILLCOLOR ), aAny, sal_True );
+}
+
+void UnoProgressBarControl::setBackgroundColor( sal_Int32 nColor ) throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= nColor;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_BACKGROUNDCOLOR ), aAny, sal_True );
+}
+
+void UnoProgressBarControl::setValue( sal_Int32 nValue ) throw(::com::sun::star::uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= nValue;
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE ), aAny, sal_True );
+}
+
+void UnoProgressBarControl::setRange( sal_Int32 nMin, sal_Int32 nMax ) throw(::com::sun::star::uno::RuntimeException )
+{
+ uno::Any aMin;
+ uno::Any aMax;
+
+ if ( nMin < nMax )
+ {
+ // take correct min and max
+ aMin <<= nMin;
+ aMax <<= nMax;
+ }
+ else
+ {
+ // change min and max
+ aMin <<= nMax;
+ aMax <<= nMin;
+ }
+
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MIN ), aMin, sal_True );
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_PROGRESSVALUE_MAX ), aMax, sal_True );
+}
+
+sal_Int32 UnoProgressBarControl::getValue() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ImplGetPropertyValue_INT32( BASEPROPERTY_PROGRESSVALUE );
+}
+
+
+// ----------------------------------------------------
+// class UnoControlFixedLineModel
+// ----------------------------------------------------
+UnoControlFixedLineModel::UnoControlFixedLineModel()
+{
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_LABEL );
+ ImplRegisterProperty( BASEPROPERTY_ORIENTATION );
+ ImplRegisterProperty( BASEPROPERTY_PRINTABLE );
+}
+
+::rtl::OUString UnoControlFixedLineModel::getServiceName( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedLineModel );
+}
+
+uno::Any UnoControlFixedLineModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_DEFAULTCONTROL )
+ {
+ uno::Any aAny;
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlFixedLine );
+ return aAny;
+ }
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+
+::cppu::IPropertyArrayHelper& UnoControlFixedLineModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlFixedLineModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ----------------------------------------------------
+// class UnoFixedLineControl
+// ----------------------------------------------------
+UnoFixedLineControl::UnoFixedLineControl()
+{
+ maComponentInfos.nWidth = 100; // ??
+ maComponentInfos.nHeight = 100; // ??
+}
+
+::rtl::OUString UnoFixedLineControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "FixedLine" );
+}
+
+sal_Bool UnoFixedLineControl::isTransparent() throw(uno::RuntimeException)
+{
+ return sal_True;
+}
diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx
new file mode 100644
index 000000000000..ba466ac6959d
--- /dev/null
+++ b/toolkit/source/helper/accessibilityclient.cxx
@@ -0,0 +1,277 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <toolkit/helper/accessibilityclient.hxx>
+#include <toolkit/helper/accessiblefactory.hxx>
+#include <osl/module.h>
+#include <osl/diagnose.h>
+#include <tools/solar.h>
+
+// #define UNLOAD_ON_LAST_CLIENT_DYING
+ // this is not recommended currently. If enabled, the implementation will log
+ // the number of active clients, and unload the acc library when the last client
+ // goes away.
+ // Sounds like a good idea, unfortunately, there's no guarantee that all objects
+ // implemented in this library are already dead.
+ // Iow, just because an object implementing an XAccessible (implemented in this lib
+ // here) died, it's not said that everybody released all references to the
+ // XAccessibleContext used by this component, and implemented in the acc lib.
+ // So we cannot really unload the lib.
+ //
+ // Alternatively, if the lib would us own "usage counting", i.e. every component
+ // implemented therein would affect a static ref count, the acc lib could care
+ // for unloading itself.
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::accessibility;
+
+ namespace
+ {
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ static oslInterlockedCount s_nAccessibilityClients = 0;
+#endif // UNLOAD_ON_LAST_CLIENT_DYING
+ static oslModule s_hAccessibleImplementationModule = NULL;
+ static GetStandardAccComponentFactory s_pAccessibleFactoryFunc = NULL;
+ static ::rtl::Reference< IAccessibleFactory > s_pFactory;
+ }
+
+ //====================================================================
+ //= AccessibleDummyFactory
+ //====================================================================
+ class AccessibleDummyFactory : public IAccessibleFactory
+ {
+ public:
+ AccessibleDummyFactory();
+
+ protected:
+ virtual ~AccessibleDummyFactory();
+
+ private:
+ AccessibleDummyFactory( const AccessibleDummyFactory& ); // never implemented
+ AccessibleDummyFactory& operator=( const AccessibleDummyFactory& ); // never implemented
+
+ oslInterlockedCount m_refCount;
+
+ public:
+ // IReference
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ // IAccessibleFactory
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXButton* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXCheckBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXRadioButton* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXListBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedHyperlink* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXFixedText* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXScrollBar* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXEdit* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXComboBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXToolBox* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ createAccessibleContext( VCLXWindow* /*_pXWindow*/ )
+ {
+ return NULL;
+ }
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ createAccessible( Menu* /*_pMenu*/, sal_Bool /*_bIsMenuBar*/ )
+ {
+ return NULL;
+ }
+ };
+
+ //--------------------------------------------------------------------
+ AccessibleDummyFactory::AccessibleDummyFactory()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ AccessibleDummyFactory::~AccessibleDummyFactory()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL AccessibleDummyFactory::acquire()
+ {
+ return osl_incrementInterlockedCount( &m_refCount );
+ }
+
+ //--------------------------------------------------------------------
+ oslInterlockedCount SAL_CALL AccessibleDummyFactory::release()
+ {
+ if ( 0 == osl_decrementInterlockedCount( &m_refCount ) )
+ {
+ delete this;
+ return 0;
+ }
+ return m_refCount;
+ }
+
+ //====================================================================
+ //= AccessibilityClient
+ //====================================================================
+ //--------------------------------------------------------------------
+ AccessibilityClient::AccessibilityClient()
+ :m_bInitialized( false )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ extern "C" { static void SAL_CALL thisModule() {} }
+
+ void AccessibilityClient::ensureInitialized()
+ {
+ if ( m_bInitialized )
+ return;
+
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ if ( 1 == osl_incrementInterlockedCount( &s_nAccessibilityClients ) )
+ { // the first client
+#endif // UNLOAD_ON_LAST_CLIENT_DYING
+ // load the library implementing the factory
+ if ( !s_pFactory.get() )
+ {
+ const ::rtl::OUString sModuleName = ::rtl::OUString::createFromAscii(
+ SVLIBRARY( "acc" )
+ );
+ s_hAccessibleImplementationModule = osl_loadModuleRelative( &thisModule, sModuleName.pData, 0 );
+ if ( s_hAccessibleImplementationModule != NULL )
+ {
+ const ::rtl::OUString sFactoryCreationFunc =
+ ::rtl::OUString::createFromAscii( "getStandardAccessibleFactory" );
+ s_pAccessibleFactoryFunc = (GetStandardAccComponentFactory)
+ osl_getFunctionSymbol( s_hAccessibleImplementationModule, sFactoryCreationFunc.pData );
+
+ }
+ OSL_ENSURE( s_pAccessibleFactoryFunc, "AccessibilityClient::ensureInitialized: could not load the library, or not retrieve the needed symbol!" );
+
+ // get a factory instance
+ if ( s_pAccessibleFactoryFunc )
+ {
+ IAccessibleFactory* pFactory = static_cast< IAccessibleFactory* >( (*s_pAccessibleFactoryFunc)() );
+ OSL_ENSURE( pFactory, "AccessibilityClient::ensureInitialized: no factory provided by the A11Y lib!" );
+ if ( pFactory )
+ {
+ s_pFactory = pFactory;
+ pFactory->release();
+ }
+ }
+ }
+
+ if ( !s_pFactory.get() )
+ // the attempt to load the lib, or to create the factory, failed
+ // -> fall back to a dummy factory
+ s_pFactory = new AccessibleDummyFactory;
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ }
+#endif
+
+ m_bInitialized = true;
+ }
+
+ //--------------------------------------------------------------------
+ AccessibilityClient::~AccessibilityClient()
+ {
+ if ( m_bInitialized )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+
+#ifdef UNLOAD_ON_LAST_CLIENT_DYING
+ if( 0 == osl_decrementInterlockedCount( &s_nAccessibilityClients ) )
+ {
+ s_pFactory = NULL;
+ s_pAccessibleFactoryFunc = NULL;
+ if ( s_hAccessibleImplementationModule )
+ {
+ osl_unloadModule( s_hAccessibleImplementationModule );
+ s_hAccessibleImplementationModule = NULL;
+ }
+ }
+#endif // UNLOAD_ON_LAST_CLIENT_DYING
+ }
+ }
+
+ //--------------------------------------------------------------------
+ IAccessibleFactory& AccessibilityClient::getFactory()
+ {
+ ensureInitialized();
+ OSL_ENSURE( s_pFactory.is(), "AccessibilityClient::getFactory: at least a dummy factory should have been created!" );
+ return *s_pFactory;
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/helper/externallock.cxx b/toolkit/source/helper/externallock.cxx
new file mode 100644
index 000000000000..c0eb2427936f
--- /dev/null
+++ b/toolkit/source/helper/externallock.cxx
@@ -0,0 +1,46 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/externallock.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+// -----------------------------------------------------------------------------
+// class VCLExternalSolarLock
+// -----------------------------------------------------------------------------
+void VCLExternalSolarLock::acquire()
+{
+ Application::GetSolarMutex().acquire();
+}
+// -----------------------------------------------------------------------------
+void VCLExternalSolarLock::release()
+{
+ Application::GetSolarMutex().release();
+}
+
diff --git a/toolkit/source/helper/fixedhyperbase.cxx b/toolkit/source/helper/fixedhyperbase.cxx
new file mode 100644
index 000000000000..d6c22e936116
--- /dev/null
+++ b/toolkit/source/helper/fixedhyperbase.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/helper/fixedhyperbase.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+// ----------------------------------------------------
+// class FixedHyperlinkBase
+// ----------------------------------------------------
+
+FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, const ResId& rId ) :
+ FixedText( pParent, rId )
+{
+}
+
+FixedHyperlinkBase::FixedHyperlinkBase( Window* pParent, WinBits nWinStyle ) :
+ FixedText( pParent, nWinStyle )
+{
+}
+
+FixedHyperlinkBase::~FixedHyperlinkBase()
+{
+}
+
+void FixedHyperlinkBase::SetURL( const String& )
+{
+}
+
+String FixedHyperlinkBase::GetURL() const
+{
+ return String::EmptyString();
+}
+
+void FixedHyperlinkBase::SetDescription( const String& )
+{
+}
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
diff --git a/toolkit/source/helper/formpdfexport.cxx b/toolkit/source/helper/formpdfexport.cxx
new file mode 100644
index 000000000000..bff2d6008d10
--- /dev/null
+++ b/toolkit/source/helper/formpdfexport.cxx
@@ -0,0 +1,639 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+#ifndef _TOOLKIT_HELPER_FORM_FORMPDFEXPORT_HXX
+#include <toolkit/helper/formpdfexport.hxx>
+#endif
+
+/** === begin UNO includes === **/
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include <com/sun/star/container/XIndexAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
+#include <com/sun/star/container/XNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
+#include <com/sun/star/form/XForm.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/container/XChild.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
+#include <com/sun/star/form/FormComponentType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_TEXTALIGN_HPP_
+#include <com/sun/star/awt/TextAlign.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_VERTICALALIGNMENT_HPP_
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_FORMBUTTONTYPE_HPP_
+#include <com/sun/star/form/FormButtonType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_SUBMITMETHOD_HPP_
+#include <com/sun/star/form/FormSubmitMethod.hpp>
+#endif
+/** === end UNO includes === **/
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+#ifndef _VCL_PDFEXTOUTDEVDATA_HXX
+#include <vcl/pdfextoutdevdata.hxx>
+#endif
+#ifndef _SV_OUTDEV_HXX
+#include <vcl/outdev.hxx>
+#endif
+
+#include <functional>
+#include <algorithm>
+
+//........................................................................
+namespace toolkitform
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::awt;
+ using namespace ::com::sun::star::style;
+ using namespace ::com::sun::star::beans;
+ using namespace ::com::sun::star::form;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::container;
+
+ // used strings
+ static const ::rtl::OUString FM_PROP_CLASSID(RTL_CONSTASCII_USTRINGPARAM("ClassId"));
+ static const ::rtl::OUString FM_PROP_NAME(RTL_CONSTASCII_USTRINGPARAM("Name"));
+ static const ::rtl::OUString FM_PROP_STRINGITEMLIST(RTL_CONSTASCII_USTRINGPARAM("StringItemList"));
+ static const ::rtl::OUString FM_PROP_HELPTEXT(RTL_CONSTASCII_USTRINGPARAM("HelpText"));
+ static const ::rtl::OUString FM_PROP_TEXT(RTL_CONSTASCII_USTRINGPARAM("Text"));
+ static const ::rtl::OUString FM_PROP_LABEL(RTL_CONSTASCII_USTRINGPARAM("Label"));
+ static const ::rtl::OUString FM_PROP_READONLY(RTL_CONSTASCII_USTRINGPARAM("ReadOnly"));
+ static const ::rtl::OUString FM_PROP_BORDER(RTL_CONSTASCII_USTRINGPARAM("Border"));
+ static const ::rtl::OUString FM_PROP_BACKGROUNDCOLOR(RTL_CONSTASCII_USTRINGPARAM("BackgroundColor"));
+ static const ::rtl::OUString FM_PROP_TEXTCOLOR(RTL_CONSTASCII_USTRINGPARAM("TextColor"));
+ static const ::rtl::OUString FM_PROP_MULTILINE(RTL_CONSTASCII_USTRINGPARAM("MultiLine"));
+ static const ::rtl::OUString FM_PROP_ALIGN(RTL_CONSTASCII_USTRINGPARAM("Align"));
+ static const ::rtl::OUString FM_PROP_FONT(RTL_CONSTASCII_USTRINGPARAM("FontDescriptor"));
+ static const ::rtl::OUString FM_PROP_MAXTEXTLEN(RTL_CONSTASCII_USTRINGPARAM("MaxTextLen"));
+ static const ::rtl::OUString FM_PROP_TARGET_URL(RTL_CONSTASCII_USTRINGPARAM("TargetURL"));
+ static const ::rtl::OUString FM_PROP_STATE(RTL_CONSTASCII_USTRINGPARAM("State"));
+ static const ::rtl::OUString FM_PROP_REFVALUE(RTL_CONSTASCII_USTRINGPARAM("RefValue"));
+ static const ::rtl::OUString FM_PROP_DROPDOWN(RTL_CONSTASCII_USTRINGPARAM("Dropdown"));
+ static const ::rtl::OUString FM_SUN_COMPONENT_FILECONTROL(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.FileControl"));
+
+ namespace
+ {
+ //--------------------------------------------------------------------
+ /** determines the FormComponentType of a form control
+ */
+ sal_Int16 classifyFormControl( const Reference< XPropertySet >& _rxModel ) SAL_THROW(( Exception ))
+ {
+ sal_Int16 nControlType = FormComponentType::CONTROL;
+
+ Reference< XPropertySetInfo > xPSI;
+ if ( _rxModel.is() )
+ xPSI = _rxModel->getPropertySetInfo();
+ if ( xPSI.is() && xPSI->hasPropertyByName( FM_PROP_CLASSID ) )
+ {
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_CLASSID ) >>= nControlType );
+ }
+
+ return nControlType;
+ }
+
+ //--------------------------------------------------------------------
+ /** (default-)creates a PDF widget according to a given FormComponentType
+ */
+ ::vcl::PDFWriter::AnyWidget* createDefaultWidget( sal_Int16 _nFormComponentType )
+ {
+ switch ( _nFormComponentType )
+ {
+ case FormComponentType::COMMANDBUTTON:
+ return new ::vcl::PDFWriter::PushButtonWidget;
+ case FormComponentType::CHECKBOX:
+ return new ::vcl::PDFWriter::CheckBoxWidget;
+ case FormComponentType::RADIOBUTTON:
+ return new ::vcl::PDFWriter::RadioButtonWidget;
+ case FormComponentType::LISTBOX:
+ return new ::vcl::PDFWriter::ListBoxWidget;
+ case FormComponentType::COMBOBOX:
+ return new ::vcl::PDFWriter::ComboBoxWidget;
+
+ case FormComponentType::TEXTFIELD:
+ case FormComponentType::FILECONTROL:
+ case FormComponentType::DATEFIELD:
+ case FormComponentType::TIMEFIELD:
+ case FormComponentType::NUMERICFIELD:
+ case FormComponentType::CURRENCYFIELD:
+ case FormComponentType::PATTERNFIELD:
+ return new ::vcl::PDFWriter::EditWidget;
+ }
+ return NULL;
+ }
+
+ //--------------------------------------------------------------------
+ /** determines a unique number for the radio group which the given radio
+ button model belongs to
+
+ The number is guaranteed to be
+ <ul><li>unique within the document in which the button lives</li>
+ <li>the same for subsequent calls with other radio button models,
+ which live in the same document, and belong to the same group</li>
+ </ul>
+
+ @precond
+ the model must be part of the form component hierarchy in a document
+ */
+ sal_Int32 determineRadioGroupId( const Reference< XPropertySet >& _rxRadioModel ) SAL_THROW((Exception))
+ {
+ OSL_ENSURE( classifyFormControl( _rxRadioModel ) == FormComponentType::RADIOBUTTON,
+ "determineRadioGroupId: this *is* no radio button model!" );
+ // The fact that radio button groups need to be unique within the complete
+ // host document makes it somewhat difficult ...
+ // Problem is that two form radio buttons belong to the same group if
+ // - they have the same parent
+ // - AND they have the same name
+ // This implies that we need some knowledge about (potentially) *all* radio button
+ // groups in the document.
+
+ // get the root-level container
+ Reference< XChild > xChild( _rxRadioModel, UNO_QUERY );
+ Reference< XForm > xParentForm( xChild.is() ? xChild->getParent() : Reference< XInterface >(), UNO_QUERY );
+ OSL_ENSURE( xParentForm.is(), "determineRadioGroupId: no parent form -> group id!" );
+ if ( !xParentForm.is() )
+ return -1;
+
+ while ( xParentForm.is() )
+ {
+ xChild = xParentForm.get();
+ xParentForm = xParentForm.query( xChild->getParent() );
+ }
+ Reference< XIndexAccess > xRoot( xChild->getParent(), UNO_QUERY );
+ OSL_ENSURE( xRoot.is(), "determineRadioGroupId: unable to determine the root of the form component hierarchy!" );
+ if ( !xRoot.is() )
+ return -1;
+
+ // count the leafs in the hierarchy, until we encounter radio button
+ ::std::vector< Reference< XIndexAccess > > aAncestors;
+ ::std::vector< sal_Int32 > aPath;
+
+ Reference< XInterface > xNormalizedLookup( _rxRadioModel, UNO_QUERY );
+ ::rtl::OUString sRadioGroupName;
+ OSL_VERIFY( _rxRadioModel->getPropertyValue( FM_PROP_NAME ) >>= sRadioGroupName );
+
+ Reference< XIndexAccess > xCurrentContainer( xRoot );
+ sal_Int32 nStartWithChild = 0;
+ sal_Int32 nGroupsEncountered = 0;
+ do
+ {
+ Reference< XNameAccess > xElementNameAccess( xCurrentContainer, UNO_QUERY );
+ OSL_ENSURE( xElementNameAccess.is(), "determineRadioGroupId: no name container?" );
+ if ( !xElementNameAccess.is() )
+ return -1;
+
+ if ( nStartWithChild == 0 )
+ { // we encounter this container the first time. In particular, we did not
+ // just step up
+ nGroupsEncountered += xElementNameAccess->getElementNames().getLength();
+ // this is way too much: Not all of the elements in the current container
+ // may form groups, especially if they're forms. But anyway, this number is
+ // sufficient for our purpose. Finally, the container contains *at most*
+ // that much groups
+ }
+
+ sal_Int32 nCount = xCurrentContainer->getCount();
+ sal_Int32 i;
+ for ( i = nStartWithChild; i < nCount; ++i )
+ {
+ Reference< XInterface > xElement( xCurrentContainer->getByIndex( i ), UNO_QUERY );
+ if ( !xElement.is() )
+ {
+ OSL_ENSURE( sal_False, "determineRadioGroupId: very suspicious!" );
+ continue;
+ }
+
+ Reference< XIndexAccess > xNewContainer( xElement, UNO_QUERY );
+ if ( xNewContainer.is() )
+ {
+ // step down the hierarchy
+ aAncestors.push_back( xCurrentContainer );
+ xCurrentContainer = xNewContainer;
+ aPath.push_back( i );
+ nStartWithChild = 0;
+ break;
+ // out of the inner loop, but continue with the outer loop
+ }
+
+ if ( xElement.get() == xNormalizedLookup.get() )
+ {
+ // look up the name of the radio group in the list of all element names
+ Sequence< ::rtl::OUString > aElementNames( xElementNameAccess->getElementNames() );
+ const ::rtl::OUString* pElementNames = aElementNames.getConstArray();
+ const ::rtl::OUString* pElementNamesEnd = pElementNames + aElementNames.getLength();
+ while ( pElementNames != pElementNamesEnd )
+ {
+ if ( *pElementNames == sRadioGroupName )
+ {
+ sal_Int32 nLocalGroupIndex = pElementNames - aElementNames.getConstArray();
+ OSL_ENSURE( nLocalGroupIndex < xElementNameAccess->getElementNames().getLength(),
+ "determineRadioGroupId: inconsistency!" );
+
+ sal_Int32 nGlobalGroupId = nGroupsEncountered - xElementNameAccess->getElementNames().getLength() + nLocalGroupIndex;
+ return nGlobalGroupId;
+ }
+ ++pElementNames;
+ }
+ OSL_ENSURE( sal_False, "determineRadioGroupId: did not find the radios element name!" );
+ }
+ }
+
+ if ( !( i < nCount ) )
+ {
+ // the loop terminated because there were no more elements
+ // -> step up, if possible
+ if ( aAncestors.empty() )
+ break;
+
+ xCurrentContainer = aAncestors.back(); aAncestors.pop_back();
+ nStartWithChild = aPath.back() + 1; aPath.pop_back();
+ }
+ }
+ while ( true );
+ return -1;
+ }
+
+ //--------------------------------------------------------------------
+ /** copies a StringItemList to a PDF widget's list
+ */
+ void getStringItemVector( const Reference< XPropertySet >& _rxModel, ::std::vector< ::rtl::OUString >& _rVector )
+ {
+ Sequence< ::rtl::OUString > aListEntries;
+ OSL_VERIFY( _rxModel->getPropertyValue( FM_PROP_STRINGITEMLIST ) >>= aListEntries );
+ ::std::copy( aListEntries.getConstArray(), aListEntries.getConstArray() + aListEntries.getLength(),
+ ::std::back_insert_iterator< ::std::vector< ::rtl::OUString > >( _rVector ) );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ /** creates a PDF compatible control descriptor for the given control
+ */
+ void TOOLKIT_DLLPUBLIC describePDFControl( const Reference< XControl >& _rxControl, ::std::auto_ptr< ::vcl::PDFWriter::AnyWidget >& _rpDescriptor ) SAL_THROW(())
+ {
+ _rpDescriptor.reset( NULL );
+ OSL_ENSURE( _rxControl.is(), "describePDFControl: invalid (NULL) control!" );
+ if ( !_rxControl.is() )
+ return;
+
+ try
+ {
+ Reference< XPropertySet > xModelProps( _rxControl->getModel(), UNO_QUERY );
+ sal_Int16 nControlType = classifyFormControl( xModelProps );
+ _rpDescriptor.reset( createDefaultWidget( nControlType ) );
+ if ( !_rpDescriptor.get() )
+ // no PDF widget available for this
+ return;
+
+ Reference< XPropertySetInfo > xPSI( xModelProps->getPropertySetInfo() );
+ Reference< XServiceInfo > xSI( xModelProps, UNO_QUERY );
+ OSL_ENSURE( xSI.is(), "describePDFControl: no service info!" );
+ // if we survived classifyFormControl, then it's a real form control, and they all have
+ // service infos
+
+ // ================================
+ // set the common widget properties
+
+ // --------------------------------
+ // Name, Description, Text
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_NAME ) >>= _rpDescriptor->Name );
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_HELPTEXT ) >>= _rpDescriptor->Description );
+ Any aText;
+ if ( xPSI->hasPropertyByName( FM_PROP_TEXT ) )
+ aText = xModelProps->getPropertyValue( FM_PROP_TEXT );
+ else if ( xPSI->hasPropertyByName( FM_PROP_LABEL ) )
+ aText = xModelProps->getPropertyValue( FM_PROP_LABEL );
+ if ( aText.hasValue() )
+ OSL_VERIFY( aText >>= _rpDescriptor->Text );
+
+ // --------------------------------
+ // readonly
+ if ( xPSI->hasPropertyByName( FM_PROP_READONLY ) )
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_READONLY ) >>= _rpDescriptor->ReadOnly );
+
+ // --------------------------------
+ // border
+ {
+ if ( xPSI->hasPropertyByName( FM_PROP_BORDER ) )
+ {
+ sal_Int16 nBorderType = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_BORDER ) >>= nBorderType );
+ _rpDescriptor->Border = ( nBorderType != 0 );
+
+ ::rtl::OUString sBorderColorPropertyName( RTL_CONSTASCII_USTRINGPARAM( "BorderColor" ) );
+ if ( xPSI->hasPropertyByName( sBorderColorPropertyName ) )
+ {
+ sal_Int32 nBoderColor = COL_TRANSPARENT;
+ if ( xModelProps->getPropertyValue( sBorderColorPropertyName ) >>= nBoderColor )
+ _rpDescriptor->BorderColor = Color( nBoderColor );
+ else
+ _rpDescriptor->BorderColor = Color( COL_BLACK );
+ }
+ }
+ }
+
+ // --------------------------------
+ // background color
+ if ( xPSI->hasPropertyByName( FM_PROP_BACKGROUNDCOLOR ) )
+ {
+ sal_Int32 nBackColor = COL_TRANSPARENT;
+ xModelProps->getPropertyValue( FM_PROP_BACKGROUNDCOLOR ) >>= nBackColor;
+ _rpDescriptor->Background = true;
+ _rpDescriptor->BackgroundColor = Color( nBackColor );
+ }
+
+ // --------------------------------
+ // text color
+ if ( xPSI->hasPropertyByName( FM_PROP_TEXTCOLOR ) )
+ {
+ sal_Int32 nTextColor = COL_TRANSPARENT;
+ xModelProps->getPropertyValue( FM_PROP_TEXTCOLOR ) >>= nTextColor;
+ _rpDescriptor->TextColor = Color( nTextColor );
+ }
+
+ // --------------------------------
+ // text style
+ _rpDescriptor->TextStyle = 0;
+ // ............................
+ // multi line and word break
+ // The MultiLine property of the control is mapped to both the "MULTILINE" and
+ // "WORDBREAK" style flags
+ if ( xPSI->hasPropertyByName( FM_PROP_MULTILINE ) )
+ {
+ sal_Bool bMultiLine = sal_False;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_MULTILINE ) >>= bMultiLine );
+ if ( bMultiLine )
+ _rpDescriptor->TextStyle |= TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK;
+ }
+ // ............................
+ // horizontal alignment
+ if ( xPSI->hasPropertyByName( FM_PROP_ALIGN ) )
+ {
+ sal_Int16 nAlign = awt::TextAlign::LEFT;
+ xModelProps->getPropertyValue( FM_PROP_ALIGN ) >>= nAlign;
+ // TODO: when the property is VOID - are there situations/UIs where this
+ // means something else than LEFT?
+ switch ( nAlign )
+ {
+ case awt::TextAlign::LEFT: _rpDescriptor->TextStyle |= TEXT_DRAW_LEFT; break;
+ case awt::TextAlign::CENTER: _rpDescriptor->TextStyle |= TEXT_DRAW_CENTER; break;
+ case awt::TextAlign::RIGHT: _rpDescriptor->TextStyle |= TEXT_DRAW_RIGHT; break;
+ default:
+ OSL_ENSURE( sal_False, "describePDFControl: invalid text align!" );
+ }
+ }
+ // ............................
+ // vertical alignment
+ {
+ ::rtl::OUString sVertAlignPropertyName( RTL_CONSTASCII_USTRINGPARAM( "VerticalAlign" ) );
+ if ( xPSI->hasPropertyByName( sVertAlignPropertyName ) )
+ {
+ sal_Int16 nAlign = VerticalAlignment_MIDDLE;
+ xModelProps->getPropertyValue( sVertAlignPropertyName ) >>= nAlign;
+ switch ( nAlign )
+ {
+ case VerticalAlignment_TOP: _rpDescriptor->TextStyle |= TEXT_DRAW_TOP; break;
+ case VerticalAlignment_MIDDLE: _rpDescriptor->TextStyle |= TEXT_DRAW_VCENTER; break;
+ case VerticalAlignment_BOTTOM: _rpDescriptor->TextStyle |= TEXT_DRAW_BOTTOM; break;
+ default:
+ OSL_ENSURE( sal_False, "describePDFControl: invalid vertical text align!" );
+ }
+ }
+ }
+
+ // font
+ if ( xPSI->hasPropertyByName( FM_PROP_FONT ) )
+ {
+ FontDescriptor aUNOFont;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_FONT ) >>= aUNOFont );
+ _rpDescriptor->TextFont = VCLUnoHelper::CreateFont( aUNOFont, Font() );
+ }
+
+ // tab order
+ rtl::OUString aTabIndexString( RTL_CONSTASCII_USTRINGPARAM( "TabIndex" ) );
+ if ( xPSI->hasPropertyByName( aTabIndexString ) )
+ {
+ sal_Int16 nIndex = -1;
+ OSL_VERIFY( xModelProps->getPropertyValue( aTabIndexString ) >>= nIndex );
+ _rpDescriptor->TabOrder = nIndex;
+ }
+
+ // ================================
+ // special widget properties
+ // --------------------------------
+ // edits
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::Edit )
+ {
+ ::vcl::PDFWriter::EditWidget* pEditWidget = static_cast< ::vcl::PDFWriter::EditWidget* >( _rpDescriptor.get() );
+ // ............................
+ // multiline (already flagged in the TextStyle)
+ pEditWidget->MultiLine = ( _rpDescriptor->TextStyle & TEXT_DRAW_MULTILINE ) != 0;
+ // ............................
+ // password input
+ ::rtl::OUString sEchoCharPropName( RTL_CONSTASCII_USTRINGPARAM( "EchoChar" ) );
+ if ( xPSI->hasPropertyByName( sEchoCharPropName ) )
+ {
+ sal_Int16 nEchoChar = 0;
+ if ( ( xModelProps->getPropertyValue( sEchoCharPropName ) >>= nEchoChar ) && ( nEchoChar != 0 ) )
+ pEditWidget->Password = true;
+ }
+ // ............................
+ // file select
+ if ( xSI->supportsService( FM_SUN_COMPONENT_FILECONTROL ) )
+ pEditWidget->FileSelect = true;
+ // ............................
+ // maximum text length
+ if ( xPSI->hasPropertyByName( FM_PROP_MAXTEXTLEN ) )
+ {
+ sal_Int16 nMaxTextLength = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_MAXTEXTLEN ) >>= nMaxTextLength );
+ if ( nMaxTextLength <= 0 )
+ // "-1" has a special meaning for database-bound controls
+ nMaxTextLength = 0;
+ pEditWidget->MaxLen = nMaxTextLength;
+ }
+ }
+
+ // --------------------------------
+ // buttons
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::PushButton )
+ {
+ ::vcl::PDFWriter::PushButtonWidget* pButtonWidget = static_cast< ::vcl::PDFWriter::PushButtonWidget* >( _rpDescriptor.get() );
+ FormButtonType eButtonType = FormButtonType_PUSH;
+ OSL_VERIFY( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) ) ) >>= eButtonType );
+ if ( eButtonType == FormButtonType_SUBMIT )
+ {
+ // if a button is a submit button, then it uses the URL at it's parent form
+ Reference< XChild > xChild( xModelProps, UNO_QUERY );
+ Reference < XPropertySet > xParentProps;
+ if ( xChild.is() )
+ xParentProps = xParentProps.query( xChild->getParent() );
+ if ( xParentProps.is() )
+ {
+ Reference< XServiceInfo > xParentSI( xParentProps, UNO_QUERY );
+ if ( xParentSI.is() && xParentSI->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.component.HTMLForm" ) ) ) )
+ {
+ OSL_VERIFY( xParentProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL );
+ pButtonWidget->Submit = true;
+ FormSubmitMethod eMethod = FormSubmitMethod_POST;
+ OSL_VERIFY( xParentProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SubmitMethod" ) ) ) >>= eMethod );
+ pButtonWidget->SubmitGet = (eMethod == FormSubmitMethod_GET);
+ }
+ }
+ }
+ else if ( eButtonType == FormButtonType_URL )
+ {
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_TARGET_URL ) >>= pButtonWidget->URL);
+ pButtonWidget->Submit = false;
+ }
+
+ // TODO:
+ // In PDF files, buttons are either reset, url or submit buttons. So if we have a simple PUSH button
+ // in a document, then this means that we do not export a SubmitToURL, which means that in PDF,
+ // the button is used as reset button.
+ // Is this desired? If no, we would have to reset _rpDescriptor to NULL here, in case eButtonType
+ // != FormButtonType_SUBMIT && != FormButtonType_RESET
+
+ // the PDF exporter defaults the text style, if 0. To prevent this, we have to transfer the UNO
+ // defaults to the PDF widget
+ if ( !pButtonWidget->TextStyle )
+ pButtonWidget->TextStyle = TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER;
+ }
+
+ // --------------------------------
+ // check boxes
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::CheckBox )
+ {
+ ::vcl::PDFWriter::CheckBoxWidget* pCheckBoxWidget = static_cast< ::vcl::PDFWriter::CheckBoxWidget* >( _rpDescriptor.get() );
+ sal_Int16 nState = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_STATE ) >>= nState );
+ pCheckBoxWidget->Checked = ( nState != 0 );
+ }
+
+ // --------------------------------
+ // radio buttons
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::RadioButton )
+ {
+ ::vcl::PDFWriter::RadioButtonWidget* pRadioWidget = static_cast< ::vcl::PDFWriter::RadioButtonWidget* >( _rpDescriptor.get() );
+ sal_Int16 nState = 0;
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_STATE ) >>= nState );
+ pRadioWidget->Selected = ( nState != 0 );
+ pRadioWidget->RadioGroup = determineRadioGroupId( xModelProps );
+ try
+ {
+ xModelProps->getPropertyValue( FM_PROP_REFVALUE ) >>= pRadioWidget->OnValue;
+ }
+ catch(...)
+ {
+ pRadioWidget->OnValue = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "On" ) );
+ }
+ }
+
+ // --------------------------------
+ // list boxes
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::ListBox )
+ {
+ ::vcl::PDFWriter::ListBoxWidget* pListWidget = static_cast< ::vcl::PDFWriter::ListBoxWidget* >( _rpDescriptor.get() );
+ // ............................
+ // drop down
+ OSL_VERIFY( xModelProps->getPropertyValue( FM_PROP_DROPDOWN ) >>= pListWidget->DropDown );
+ // ............................
+ // multi selection
+ OSL_VERIFY( xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= pListWidget->MultiSelect );
+ // ............................
+ // entries
+ getStringItemVector( xModelProps, pListWidget->Entries );
+ // since we explicitly list the entries in the order in which they appear, they should not be
+ // resorted by the PDF viewer
+ pListWidget->Sort = false;
+
+ // get selected items
+ Sequence< sal_Int16 > aSelectIndices;
+ OSL_VERIFY( xModelProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= aSelectIndices );
+ if( aSelectIndices.getLength() > 0 )
+ {
+ pListWidget->SelectedEntries.resize( 0 );
+ for( sal_Int32 i = 0; i < aSelectIndices.getLength(); i++ )
+ {
+ sal_Int16 nIndex = aSelectIndices.getConstArray()[i];
+ if( nIndex >= 0 && nIndex < (sal_Int16)pListWidget->Entries.size() )
+ pListWidget->SelectedEntries.push_back( nIndex );
+ }
+ }
+ }
+
+ // --------------------------------
+ // combo boxes
+ if ( _rpDescriptor->getType() == ::vcl::PDFWriter::ComboBox )
+ {
+ ::vcl::PDFWriter::ComboBoxWidget* pComboWidget = static_cast< ::vcl::PDFWriter::ComboBoxWidget* >( _rpDescriptor.get() );
+ // ............................
+ // entries
+ getStringItemVector( xModelProps, pComboWidget->Entries );
+ // same reasoning as above
+ pComboWidget->Sort = false;
+ }
+
+ // ================================
+ // some post-processing
+ // --------------------------------
+ // text line ends
+ // some controls may (always or dependent on other settings) return UNIX line ends
+ String aConverter( _rpDescriptor->Text );
+ _rpDescriptor->Text = aConverter.ConvertLineEnd( LINEEND_CRLF );
+ }
+ catch( const Exception& )
+ {
+ OSL_ENSURE( sal_False, "describePDFControl: caught an exception!" );
+ }
+ }
+
+//........................................................................
+} // namespace toolkitform
+//........................................................................
diff --git a/toolkit/source/helper/imagealign.cxx b/toolkit/source/helper/imagealign.cxx
new file mode 100644
index 000000000000..c5e8781d478b
--- /dev/null
+++ b/toolkit/source/helper/imagealign.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <toolkit/helper/imagealign.hxx>
+#include <com/sun/star/awt/ImagePosition.hpp>
+#include <com/sun/star/awt/ImageAlign.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star::awt::ImagePosition;
+ using namespace ::com::sun::star::awt::ImageAlign;
+
+ sal_Int16 translateImagePosition( ImageAlign _eVCLAlign )
+ {
+ sal_Int16 nReturn = AboveCenter;
+ switch ( _eVCLAlign )
+ {
+ case IMAGEALIGN_LEFT: nReturn = LeftCenter; break;
+ case IMAGEALIGN_TOP: nReturn = AboveCenter; break;
+ case IMAGEALIGN_RIGHT: nReturn = RightCenter; break;
+ case IMAGEALIGN_BOTTOM: nReturn = BelowCenter; break;
+ case IMAGEALIGN_LEFT_TOP: nReturn = LeftTop; break;
+ case IMAGEALIGN_LEFT_BOTTOM: nReturn = LeftBottom; break;
+ case IMAGEALIGN_TOP_LEFT: nReturn = AboveLeft; break;
+ case IMAGEALIGN_TOP_RIGHT: nReturn = AboveRight; break;
+ case IMAGEALIGN_RIGHT_TOP: nReturn = RightTop; break;
+ case IMAGEALIGN_RIGHT_BOTTOM: nReturn = RightBottom; break;
+ case IMAGEALIGN_BOTTOM_LEFT: nReturn = BelowLeft; break;
+ case IMAGEALIGN_BOTTOM_RIGHT: nReturn = BelowRight; break;
+ case IMAGEALIGN_CENTER: nReturn = Centered; break;
+ default:
+ OSL_ENSURE( sal_False, "translateImagePosition: unknown IMAGEALIGN value!" );
+ }
+ return nReturn;
+ }
+
+ ImageAlign translateImagePosition( sal_Int16 _eUNOAlign )
+ {
+ ImageAlign nReturn = IMAGEALIGN_TOP;
+ switch ( _eUNOAlign )
+ {
+ case LeftCenter: nReturn = IMAGEALIGN_LEFT; break;
+ case AboveCenter: nReturn = IMAGEALIGN_TOP; break;
+ case RightCenter: nReturn = IMAGEALIGN_RIGHT; break;
+ case BelowCenter: nReturn = IMAGEALIGN_BOTTOM; break;
+ case LeftTop: nReturn = IMAGEALIGN_LEFT_TOP; break;
+ case LeftBottom: nReturn = IMAGEALIGN_LEFT_BOTTOM; break;
+ case AboveLeft: nReturn = IMAGEALIGN_TOP_LEFT; break;
+ case AboveRight: nReturn = IMAGEALIGN_TOP_RIGHT; break;
+ case RightTop: nReturn = IMAGEALIGN_RIGHT_TOP; break;
+ case RightBottom: nReturn = IMAGEALIGN_RIGHT_BOTTOM; break;
+ case BelowLeft: nReturn = IMAGEALIGN_BOTTOM_LEFT; break;
+ case BelowRight: nReturn = IMAGEALIGN_BOTTOM_RIGHT; break;
+ case Centered: nReturn = IMAGEALIGN_CENTER; break;
+ default:
+ OSL_ENSURE( sal_False, "translateImagePosition: unknown css.awt.ImagePosition value!" );
+ }
+ return nReturn;
+ }
+
+ sal_Int16 getCompatibleImageAlign( ImageAlign _eAlign )
+ {
+ sal_Int16 nReturn = TOP;
+ switch ( _eAlign )
+ {
+ case IMAGEALIGN_LEFT_TOP:
+ case IMAGEALIGN_LEFT:
+ case IMAGEALIGN_LEFT_BOTTOM: nReturn = LEFT; break;
+
+ case IMAGEALIGN_TOP_LEFT:
+ case IMAGEALIGN_TOP:
+ case IMAGEALIGN_TOP_RIGHT: nReturn = TOP; break;
+
+ case IMAGEALIGN_RIGHT_TOP:
+ case IMAGEALIGN_RIGHT:
+ case IMAGEALIGN_RIGHT_BOTTOM: nReturn = RIGHT; break;
+
+ case IMAGEALIGN_BOTTOM_LEFT:
+ case IMAGEALIGN_BOTTOM:
+ case IMAGEALIGN_BOTTOM_RIGHT: nReturn = BOTTOM; break;
+
+ case IMAGEALIGN_CENTER: nReturn = TOP; break;
+ default:
+ OSL_ENSURE( sal_False, "getCompatibleImageAlign: unknown IMAGEALIGN value!" );
+ }
+ return nReturn;
+ }
+
+ sal_Int16 getExtendedImagePosition( sal_Int16 _nImageAlign )
+ {
+ sal_Int16 nReturn = AboveCenter;
+ switch ( _nImageAlign )
+ {
+ case LEFT: nReturn = LeftCenter; break;
+ case TOP: nReturn = AboveCenter; break;
+ case RIGHT: nReturn = RightCenter; break;
+ case BOTTOM: nReturn = BelowCenter; break;
+ default:
+ OSL_ENSURE( sal_False, "getExtendedImagePosition: unknown ImageAlign value!" );
+ }
+ return nReturn;
+ }
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
diff --git a/toolkit/source/helper/listenermultiplexer.cxx b/toolkit/source/helper/listenermultiplexer.cxx
new file mode 100644
index 000000000000..fcfd6214780e
--- /dev/null
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+//#include "precompiled_toolkit.hxx"
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <com/sun/star/lang/DisposedException.hpp>
+
+// ----------------------------------------------------
+// class ListenerMultiplexerBase
+// ----------------------------------------------------
+ListenerMultiplexerBase::ListenerMultiplexerBase( ::cppu::OWeakObject& rSource )
+ : ::cppu::OInterfaceContainerHelper( GetMutex() ), mrContext( rSource )
+{
+}
+
+ListenerMultiplexerBase::~ListenerMultiplexerBase()
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any ListenerMultiplexerBase::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::cppu::queryInterface( rType, SAL_STATIC_CAST( ::com::sun::star::uno::XInterface*, this ) );
+}
+
+
+// ----------------------------------------------------
+// class EventListenerMultiplexer
+// ----------------------------------------------------
+EventListenerMultiplexer::EventListenerMultiplexer( ::cppu::OWeakObject& rSource )
+ : ListenerMultiplexerBase( rSource )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any EventListenerMultiplexer::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, this ) );
+ return (aRet.hasValue() ? aRet : ListenerMultiplexerBase::queryInterface( rType ));
+}
+
+// ::com::sun::star::lang::XEventListener
+void EventListenerMultiplexer::disposing( const ::com::sun::star::lang::EventObject& ) throw(::com::sun::star::uno::RuntimeException)
+{
+}
+
+// ----------------------------------------------------
+// class FocusListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusGained, ::com::sun::star::awt::FocusEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( FocusListenerMultiplexer, ::com::sun::star::awt::XFocusListener, focusLost, ::com::sun::star::awt::FocusEvent )
+
+// ----------------------------------------------------
+// class WindowListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowResized, ::com::sun::star::awt::WindowEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowMoved, ::com::sun::star::awt::WindowEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowShown, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( WindowListenerMultiplexer, ::com::sun::star::awt::XWindowListener, windowHidden, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class VclContainerListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowAdded, ::com::sun::star::awt::VclContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( VclContainerListenerMultiplexer, ::com::sun::star::awt::XVclContainerListener, windowRemoved, ::com::sun::star::awt::VclContainerEvent )
+
+// ----------------------------------------------------
+// class KeyListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyPressed, ::com::sun::star::awt::KeyEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( KeyListenerMultiplexer, ::com::sun::star::awt::XKeyListener, keyReleased, ::com::sun::star::awt::KeyEvent )
+
+// ----------------------------------------------------
+// class MouseListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mousePressed, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseReleased, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseEntered, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseListenerMultiplexer, ::com::sun::star::awt::XMouseListener, mouseExited, ::com::sun::star::awt::MouseEvent )
+
+// ----------------------------------------------------
+// class MouseMotionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseDragged, ::com::sun::star::awt::MouseEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MouseMotionListenerMultiplexer, ::com::sun::star::awt::XMouseMotionListener, mouseMoved, ::com::sun::star::awt::MouseEvent )
+
+// ----------------------------------------------------
+// class PaintListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( PaintListenerMultiplexer, ::com::sun::star::awt::XPaintListener, windowPaint, ::com::sun::star::awt::PaintEvent )
+
+// ----------------------------------------------------
+// class TopWindowListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowOpened, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosing, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowClosed, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowMinimized, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowNormalized, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowActivated, ::com::sun::star::lang::EventObject )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TopWindowListenerMultiplexer, ::com::sun::star::awt::XTopWindowListener, windowDeactivated, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class TextListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TextListenerMultiplexer, ::com::sun::star::awt::XTextListener, textChanged, ::com::sun::star::awt::TextEvent )
+
+// ----------------------------------------------------
+// class ActionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ActionListenerMultiplexer, ::com::sun::star::awt::XActionListener, actionPerformed, ::com::sun::star::awt::ActionEvent )
+
+// ----------------------------------------------------
+// class ItemListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ItemListenerMultiplexer, ::com::sun::star::awt::XItemListener, itemStateChanged, ::com::sun::star::awt::ItemEvent )
+
+// ----------------------------------------------------
+// class ContainerListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementInserted, ::com::sun::star::container::ContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementRemoved, ::com::sun::star::container::ContainerEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( ContainerListenerMultiplexer, ::com::sun::star::container::XContainerListener, elementReplaced, ::com::sun::star::container::ContainerEvent )
+
+// ----------------------------------------------------
+// class SpinListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, up, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, down, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, first, ::com::sun::star::awt::SpinEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SpinListenerMultiplexer, ::com::sun::star::awt::XSpinListener, last, ::com::sun::star::awt::SpinEvent )
+
+// ----------------------------------------------------
+// class AdjustmentListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( AdjustmentListenerMultiplexer, ::com::sun::star::awt::XAdjustmentListener, adjustmentValueChanged, ::com::sun::star::awt::AdjustmentEvent )
+
+// ----------------------------------------------------
+// class MenuListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, highlight, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, select, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, activate, ::com::sun::star::awt::MenuEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( MenuListenerMultiplexer, ::com::sun::star::awt::XMenuListener, deactivate, ::com::sun::star::awt::MenuEvent )
+
+// ----------------------------------------------------
+// class TreeSelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeSelectionListenerMultiplexer, ::com::sun::star::view::XSelectionChangeListener, selectionChanged, ::com::sun::star::lang::EventObject )
+
+// ----------------------------------------------------
+// class TreeSelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, requestChildNodes, ::com::sun::star::awt::tree::TreeExpansionEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeExpanding, ::com::sun::star::awt::tree::TreeExpansionEvent, ::com::sun::star::awt::tree::ExpandVetoException )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD_EXCEPTION( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeCollapsing, ::com::sun::star::awt::tree::TreeExpansionEvent, ::com::sun::star::awt::tree::ExpandVetoException )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeExpanded, ::com::sun::star::awt::tree::TreeExpansionEvent )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TreeExpansionListenerMultiplexer, ::com::sun::star::awt::tree::XTreeExpansionListener, treeCollapsed, ::com::sun::star::awt::tree::TreeExpansionEvent )
+
+// ----------------------------------------------------
+// class TreeEditListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TreeEditListenerMultiplexer, ::com::sun::star::awt::tree::XTreeEditListener )
+
diff --git a/toolkit/source/helper/makefile.mk b/toolkit/source/helper/makefile.mk
new file mode 100644
index 000000000000..bf10b0aa0178
--- /dev/null
+++ b/toolkit/source/helper/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=toolkit
+TARGET=helper
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/listenermultiplexer.obj \
+ $(SLO)$/property.obj \
+ $(SLO)$/registerservices.obj \
+ $(SLO)$/servicenames.obj \
+ $(SLO)$/tkresmgr.obj \
+ $(SLO)$/unomemorystream.obj \
+ $(SLO)$/unopropertyarrayhelper.obj \
+ $(SLO)$/unowrapper.obj \
+ $(SLO)$/vclunohelper.obj \
+ $(SLO)$/externallock.obj \
+ $(SLO)$/imagealign.obj \
+ $(SLO)$/throbberimpl.obj \
+ $(SLO)$/formpdfexport.obj \
+ $(SLO)$/accessibilityclient.obj \
+ $(SLO)$/fixedhyperbase.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
new file mode 100644
index 000000000000..7ede81d485d7
--- /dev/null
+++ b/toolkit/source/helper/property.cxx
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <osl/mutex.hxx>
+
+#include <stdlib.h> // qsort/bsearch
+#include <tools/debug.hxx>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/CharSet.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <com/sun/star/awt/FontType.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/tree/XTreeDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <com/sun/star/awt/grid/ScrollBarMode.hpp>
+#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <comphelper/types.hxx>
+#include <functional>
+#include <algorithm>
+#include <toolkit/helper/property.hxx>
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::awt::XDevice;
+using ::com::sun::star::awt::FontDescriptor;
+using ::com::sun::star::style::VerticalAlignment;
+
+struct ImplPropertyInfo
+{
+ ::rtl::OUString aName;
+ sal_uInt16 nPropId;
+ ::com::sun::star::uno::Type aType;
+ sal_Int16 nAttribs;
+ sal_Bool bDependsOnOthers; // eg. VALUE depends on MIN/MAX and must be set after MIN/MAX.
+
+ ImplPropertyInfo()
+ {
+ nPropId = 0;
+ nAttribs = 0;
+ bDependsOnOthers = sal_False;
+ }
+
+ ImplPropertyInfo( const sal_Unicode* pName, sal_uInt16 nId, const ::com::sun::star::uno::Type& rType,
+ sal_Int16 nAttrs, sal_Bool bDepends = sal_False )
+ : aName( pName )
+ {
+ nPropId = nId;
+ aType = rType;
+ nAttribs = nAttrs;
+ bDependsOnOthers = bDepends;
+ }
+
+};
+
+#define DECL_PROP_1( asciiname, id, type, attrib1 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 )
+#define DECL_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 )
+#define DECL_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 )
+#define DECL_PROP_4( asciiname, id, type, attrib1, attrib2, attrib3, attrib4 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3 | ::com::sun::star::beans::PropertyAttribute::attrib4 )
+
+#define DECL_DEP_PROP_1( asciiname, id, type, attrib1 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1, sal_True )
+#define DECL_DEP_PROP_2( asciiname, id, type, attrib1, attrib2 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2, sal_True )
+#define DECL_DEP_PROP_3( asciiname, id, type, attrib1, attrib2, attrib3 ) \
+ ImplPropertyInfo( ::rtl::OUString::createFromAscii( asciiname ), BASEPROPERTY_##id, ::getCppuType( static_cast< const type* >( NULL ) ), ::com::sun::star::beans::PropertyAttribute::attrib1 | ::com::sun::star::beans::PropertyAttribute::attrib2 | ::com::sun::star::beans::PropertyAttribute::attrib3, sal_True )
+
+ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount )
+{
+ static ImplPropertyInfo* pPropertyInfos = NULL;
+ static sal_uInt16 nElements = 0;
+ if( !pPropertyInfos )
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pPropertyInfos )
+ {
+ static ImplPropertyInfo __FAR_DATA aImplPropertyInfos [] =
+ {
+ DECL_PROP_2 ( "AccessibleName", ACCESSIBLENAME, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "Align", ALIGN, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Autocomplete", AUTOCOMPLETE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "AutoHScroll", AUTOHSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_1 ( "AutoMnemonics", AUTOMNEMONICS, bool, BOUND ),
+ DECL_PROP_2 ( "AutoToggle", AUTOTOGGLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "AutoVScroll", AUTOVSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "BackgroundColor", BACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_2 ( "BlockIncrement", BLOCKINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "Border", BORDER, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "BorderColor", BORDERCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Closeable", CLOSEABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "CurrencySymbol", CURRENCYSYMBOL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "CustomUnitText", CUSTOMUNITTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "Date", DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "DateFormat", EXTDATEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DateMax", DATEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DateMin", DATEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "DateShowCentury", DATESHOWCENTURY, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "DecimalAccuracy", DECIMALACCURACY, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DefaultButton", DEFAULTBUTTON, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DefaultControl", DEFAULTCONTROL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DesktopAsParent", DESKTOP_AS_PARENT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DisplayBackgroundColor", DISPLAYBACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEVOID ),
+ DECL_PROP_2 ( "Dropdown", DROPDOWN, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "EchoChar", ECHOCHAR, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "EditMask", EDITMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "EffectiveDefault", EFFECTIVE_DEFAULT, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "EffectiveMax", EFFECTIVE_MAX, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "EffectiveMin", EFFECTIVE_MIN, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "EffectiveValue", EFFECTIVE_VALUE, Any, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Enabled", ENABLED, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "EnforceFormat", ENFORCE_FORMAT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "FillColor", FILLCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "FocusOnClick", FOCUSONCLICK, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontRelief", FONTRELIEF, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontEmphasisMark", FONTEMPHASISMARK, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontDescriptor", FONTDESCRIPTOR, FontDescriptor, BOUND, MAYBEDEFAULT ),
+
+ // Teile des ::com::sun::star::awt::FontDescriptor
+ DECL_PROP_2 ( "FontName", FONTDESCRIPTORPART_NAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontStyleName", FONTDESCRIPTORPART_STYLENAME, ::rtl::OUString,BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontFamily", FONTDESCRIPTORPART_FAMILY, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontCharset", FONTDESCRIPTORPART_CHARSET, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontHeight", FONTDESCRIPTORPART_HEIGHT, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontWidth", FONTDESCRIPTORPART_WIDTH, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontPitch", FONTDESCRIPTORPART_PITCH, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontWeight", FONTDESCRIPTORPART_WEIGHT, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontCharWidth", FONTDESCRIPTORPART_CHARWIDTH, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontOrientation", FONTDESCRIPTORPART_ORIENTATION, float, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontSlant", FONTDESCRIPTORPART_SLANT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontUnderline", FONTDESCRIPTORPART_UNDERLINE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontStrikeout", FONTDESCRIPTORPART_STRIKEOUT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontKerning", FONTDESCRIPTORPART_KERNING, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontWordLineMode", FONTDESCRIPTORPART_WORDLINEMODE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "FontType", FONTDESCRIPTORPART_TYPE, sal_Int16, BOUND, MAYBEDEFAULT ),
+
+ DECL_PROP_3 ( "FormatKey", FORMATKEY, sal_Int32, BOUND, MAYBEVOID, TRANSIENT ),
+ DECL_PROP_3 ( "FormatsSupplier", FORMATSSUPPLIER, Reference< ::com::sun::star::util::XNumberFormatsSupplier >, BOUND, MAYBEVOID, TRANSIENT ),
+
+ DECL_PROP_2 ( "Graphic", GRAPHIC, Reference< ::com::sun::star::graphic::XGraphic >, BOUND, TRANSIENT ),
+ DECL_PROP_2 ( "HelpText", HELPTEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HelpURL", HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HideInactiveSelection", HIDEINACTIVESELECTION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HighContrastMode", HIGHCONTRASTMODE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HScroll", HSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "HardLineBreaks", HARDLINEBREAKS, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ImageAlign", IMAGEALIGN, sal_Int16, BOUND, MAYBEDEFAULT),
+ DECL_PROP_2 ( "ImagePosition", IMAGEPOSITION, sal_Int16, BOUND, MAYBEDEFAULT),
+ DECL_PROP_2 ( "ImageURL", IMAGEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Label", LABEL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "LineColor", LINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "LineCount", LINECOUNT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "LineEndFormat", LINE_END_FORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "LineIncrement", LINEINCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "LiteralMask", LITERALMASK, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "LiveScroll", LIVE_SCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "MaxTextLen", MAXTEXTLEN, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Moveable", MOVEABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_1 ( "MouseTransparent", MOUSETRANSPARENT, bool, BOUND ),
+ DECL_PROP_2 ( "MultiLine", MULTILINE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "MultiSelection", MULTISELECTION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "NativeWidgetLook", NATIVE_WIDGET_LOOK, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "NoLabel", NOLABEL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Orientation", ORIENTATION, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PaintTransparent", PAINTTRANSPARENT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PluginParent", PLUGINPARENT, sal_Int64, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PrependCurrencySymbol", CURSYM_POSITION, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Printable", PRINTABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "ProgressValue", PROGRESSVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "ProgressValueMax", PROGRESSVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ProgressValueMin", PROGRESSVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "PushButtonType", PUSHBUTTONTYPE, sal_Int16, BOUND, MAYBEDEFAULT),
+ DECL_PROP_2 ( "ReadOnly", READONLY, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Repeat", REPEAT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "RepeatDelay", REPEAT_DELAY, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ScaleImage", SCALEIMAGE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ScaleMode", IMAGE_SCALE_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "ScrollValue", SCROLLVALUE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "ScrollValueMax", SCROLLVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ScrollValueMin", SCROLLVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "SelectedItems", SELECTEDITEMS, Sequence<sal_Int16>, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowThousandsSeparator", NUMSHOWTHOUSANDSEP, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Sizeable", SIZEABLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Spin", SPIN, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "SpinIncrement", SPININCREMENT, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "SpinValue", SPINVALUE, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "SpinValueMax", SPINVALUE_MAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "SpinValueMin", SPINVALUE_MIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_2 ( "State", STATE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "StrictFormat", STRICTFORMAT, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "StringItemList", STRINGITEMLIST, Sequence< ::rtl::OUString >, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "VisualEffect", VISUALEFFECT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "SymbolColor", SYMBOL_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "Tabstop", TABSTOP, bool, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Text", TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "TextColor", TEXTCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "TextLineColor", TEXTLINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "Time", TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "TimeFormat", EXTTIMEFORMAT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "TimeMax", TIMEMAX, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "TimeMin", TIMEMIN, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Title", TITLE, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Toggle", TOGGLE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "TreatAsNumber", TREATASNUMBER, bool, BOUND, MAYBEDEFAULT,TRANSIENT ),
+ DECL_PROP_2 ( "TriState", TRISTATE, bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Unit", UNIT, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "VScroll", VSCROLL, bool, BOUND, MAYBEDEFAULT ),
+ DECL_DEP_PROP_3 ( "Value", VALUE_DOUBLE, double, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "ValueMax", VALUEMAX_DOUBLE, double, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ValueMin", VALUEMIN_DOUBLE, double, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ValueStep", VALUESTEP_DOUBLE, double, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "VerticalAlign", VERTICALALIGN, VerticalAlignment, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_DEP_PROP_3 ( "VisibleSize", VISIBLESIZE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "Activated", ACTIVATED, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Complete", COMPLETE, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "CurrentItemID", CURRENTITEMID, sal_Int16, BOUND, MAYBEDEFAULT ),
+
+ DECL_PROP_2 ( "MouseWheelBehavior", MOUSE_WHEEL_BEHAVIOUR, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "StepTime", STEP_TIME, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Decoration", DECORATION, sal_Bool, BOUND, MAYBEDEFAULT ),
+
+ DECL_PROP_2 ( "SelectionType", TREE_SELECTIONTYPE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "Editable", TREE_EDITABLE, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "DataModel", TREE_DATAMODEL, Reference< ::com::sun::star::awt::tree::XTreeDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "RootDisplayed", TREE_ROOTDISPLAYED, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowsHandles", TREE_SHOWSHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowsRootHandles", TREE_SHOWSROOTHANDLES, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "RowHeight", TREE_ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "InvokesStopNodeEditing", TREE_INVOKESSTOPNODEEDITING, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "DialogSourceURL", DIALOGSOURCEURL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "URL", URL, ::rtl::OUString, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "WritingMode", WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ContextWritingMode", CONTEXT_WRITING_MODE, sal_Int16, BOUND, MAYBEDEFAULT, TRANSIENT ),
+ DECL_PROP_2 ( "ShowRowHeader", GRID_SHOWROWHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "SelectionModel", GRID_SELECTIONMODE, ::com::sun::star::view::SelectionType, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "EnableVisible", ENABLEVISIBLE, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ReferenceDevice", REFERENCE_DEVICE, Reference< XDevice >,BOUND, MAYBEDEFAULT, TRANSIENT )
+ };
+ pPropertyInfos = aImplPropertyInfos;
+ nElements = sizeof( aImplPropertyInfos ) / sizeof( ImplPropertyInfo );
+ }
+ }
+ rElementCount = nElements;
+ return pPropertyInfos;
+}
+
+
+struct ImplPropertyInfoCompareFunctor : ::std::binary_function<ImplPropertyInfo,::rtl::OUString,bool>
+{
+ inline bool operator()(const ImplPropertyInfo& lhs,const ImplPropertyInfo& rhs) const
+ {
+ return lhs.aName.compareTo(rhs.aName) < 0;
+ }
+ inline bool operator()(const ImplPropertyInfo& lhs,const ::rtl::OUString& rhs) const
+ {
+ return lhs.aName.compareTo(rhs) < 0;
+ }
+ inline bool operator()(const ::rtl::OUString& lhs,const ImplPropertyInfo& rhs) const
+ {
+ return lhs.compareTo(rhs.aName) < 0;
+ }
+};
+
+void ImplAssertValidPropertyArray()
+{
+ static sal_Bool bSorted = sal_False;
+ if( !bSorted )
+ {
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ ::std::sort(pInfos, pInfos+nElements,ImplPropertyInfoCompareFunctor());
+ bSorted = sal_True;
+ }
+}
+
+sal_uInt16 GetPropertyId( const ::rtl::OUString& rPropertyName )
+{
+ ImplAssertValidPropertyArray();
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ ImplPropertyInfo* pInf = ::std::lower_bound(pInfos,pInfos+nElements,rPropertyName,ImplPropertyInfoCompareFunctor());
+/*
+ (ImplPropertyInfo*)
+ bsearch( &aSearch, pInfos, nElements, sizeof( ImplPropertyInfo ), ImplPropertyInfoCompare );
+*/
+
+ return ( pInf && pInf != (pInfos+nElements) && pInf->aName == rPropertyName) ? pInf->nPropId: 0;
+}
+
+const ImplPropertyInfo* ImplGetImplPropertyInfo( sal_uInt16 nPropertyId )
+{
+ ImplAssertValidPropertyArray();
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ sal_uInt16 n;
+ for ( n = 0; n < nElements && pInfos[n].nPropId != nPropertyId; ++n)
+ ;
+
+ return (n < nElements) ? &pInfos[n] : NULL;
+}
+
+sal_uInt16 GetPropertyOrderNr( sal_uInt16 nPropertyId )
+{
+ ImplAssertValidPropertyArray();
+
+ sal_uInt16 nElements;
+ ImplPropertyInfo* pInfos = ImplGetPropertyInfos( nElements );
+ for ( sal_uInt16 n = nElements; n; )
+ {
+ if ( pInfos[--n].nPropId == nPropertyId )
+ return n;
+ }
+ return 0xFFFF;
+}
+
+const ::rtl::OUString& GetPropertyName( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo->aName;
+}
+
+const ::com::sun::star::uno::Type* GetPropertyType( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? &pImplPropertyInfo->aType : NULL;
+}
+
+sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? pImplPropertyInfo->nAttribs : 0;
+}
+
+sal_Bool DoesDependOnOthers( sal_uInt16 nPropertyId )
+{
+ const ImplPropertyInfo* pImplPropertyInfo = ImplGetImplPropertyInfo( nPropertyId );
+ DBG_ASSERT( pImplPropertyInfo, "Invalid PropertyId!" );
+ return pImplPropertyInfo ? pImplPropertyInfo->bDependsOnOthers : sal_False;
+}
+
+sal_Bool CompareProperties( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 )
+{
+ return ::comphelper::compare( r1, r2 );
+}
+
+
+
diff --git a/toolkit/source/helper/registerservices.cxx b/toolkit/source/helper/registerservices.cxx
new file mode 100644
index 000000000000..7d1dcaeb2762
--- /dev/null
+++ b/toolkit/source/helper/registerservices.cxx
@@ -0,0 +1,399 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/weak.hxx>
+#include <osl/mutex.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <toolkit/helper/macros.hxx>
+#include <toolkit/awt/vclxtoolkit.hxx>
+#include <toolkit/awt/vclxmenu.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/awt/vclxprinter.hxx>
+#include <toolkit/controls/unocontrols.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <toolkit/controls/stdtabcontrollermodel.hxx>
+#include <toolkit/controls/formattedcontrol.hxx>
+#include <toolkit/controls/roadmapcontrol.hxx>
+#include <toolkit/controls/tkscrollbar.hxx>
+#include "toolkit/controls/tkspinbutton.hxx"
+#include <toolkit/controls/tksimpleanimation.hxx>
+#include <toolkit/controls/tkthrobber.hxx>
+#include <toolkit/controls/dialogcontrol.hxx>
+#include "toolkit/dllapi.h"
+
+namespace toolkit
+{
+ using namespace ::com::sun::star::uno;
+ using namespace ::com::sun::star::lang;
+ using namespace ::com::sun::star::registry;
+
+ //.........................................................................
+ Reference< XRegistryKey > registerServices( const Reference< XRegistryKey >& _rxParentKey,
+ const sal_Char* _pAsciiImplName, const sal_Char* _pAsciiServiceName )
+ {
+ ::rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM( "/stardiv.Toolkit." ) );
+ sImplName += ::rtl::OUString::createFromAscii( _pAsciiImplName );
+ sImplName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES" ) );
+
+ Reference< XRegistryKey > xNewKey = _rxParentKey->createKey( sImplName );
+ xNewKey->createKey( ::rtl::OUString::createFromAscii( _pAsciiServiceName ) );
+
+ return xNewKey;
+ }
+
+ //.........................................................................
+ Reference< XRegistryKey > registerServices( const Reference< XRegistryKey >& _rxParentKey,
+ const sal_Char* _pAsciiImplName, const sal_Char* _pAsciiServiceName1, const sal_Char* _pAsciiServiceName2 )
+ {
+ Reference< XRegistryKey > xComponentServicesKey = registerServices( _rxParentKey, _pAsciiImplName, _pAsciiServiceName1 );
+ xComponentServicesKey->createKey( ::rtl::OUString::createFromAscii( _pAsciiServiceName2 ) );
+ return xComponentServicesKey;
+ }
+
+ //.........................................................................
+ void* tryCreateFactory( const sal_Char* _pRequiredImplName, const sal_Char* _pComponentImplName,
+ const sal_Char* _pAsciiServiceName1, const sal_Char* _pAsciiServiceName2,
+ ::cppu::ComponentInstantiation _pInstantiation, const Reference< XMultiServiceFactory >& _rxServiceFactory )
+ {
+ void* pReturn = NULL;
+
+ if ( rtl_str_compare( _pRequiredImplName, _pComponentImplName ) == 0 )
+ {
+ Sequence< ::rtl::OUString > aServiceNames( _pAsciiServiceName2 ? 2 : 1 );
+ aServiceNames.getArray()[ 0 ] = ::rtl::OUString::createFromAscii( _pAsciiServiceName1 );
+ if ( _pAsciiServiceName2 )
+ aServiceNames.getArray()[ 1 ] = ::rtl::OUString::createFromAscii( _pAsciiServiceName2 );
+ Reference< XSingleServiceFactory > xFactory( ::cppu::createSingleFactory(
+ _rxServiceFactory, ::rtl::OUString::createFromAscii( _pComponentImplName ),
+ _pInstantiation, aServiceNames
+ ) );
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pReturn = xFactory.get();
+ }
+ }
+
+ return pReturn;
+ }
+
+
+}
+
+#define IMPL_CREATEINSTANCE( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& ) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName ); }
+
+#define IMPL_CREATEINSTANCE2( ImplName ) \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplName##_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( rSMgr ) ); }
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL UnoControlDialogModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& )
+{
+ return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel> );
+}
+
+#define CHECKANDCREATEFACTORY( ImplName, ServiceName1, ServiceName2 ) \
+ pRet = tryCreateFactory( sImplementationName, "stardiv.Toolkit." #ImplName, \
+ ServiceName1, ServiceName2, \
+ ImplName##_CreateInstance, xServiceFactory \
+ ); \
+ if ( pRet ) \
+ return pRet; \
+
+using namespace toolkit;
+
+IMPL_CREATEINSTANCE2( VCLXToolkit )
+IMPL_CREATEINSTANCE( StdTabController )
+IMPL_CREATEINSTANCE( StdTabControllerModel )
+IMPL_CREATEINSTANCE( UnoButtonControl )
+IMPL_CREATEINSTANCE( UnoCheckBoxControl )
+IMPL_CREATEINSTANCE( UnoComboBoxControl )
+IMPL_CREATEINSTANCE( UnoControlButtonModel )
+IMPL_CREATEINSTANCE( UnoControlCheckBoxModel )
+IMPL_CREATEINSTANCE( UnoControlComboBoxModel )
+IMPL_CREATEINSTANCE( UnoControlContainer )
+IMPL_CREATEINSTANCE( UnoControlContainerModel )
+IMPL_CREATEINSTANCE( UnoControlCurrencyFieldModel )
+IMPL_CREATEINSTANCE( UnoControlDateFieldModel )
+IMPL_CREATEINSTANCE( UnoControlEditModel )
+IMPL_CREATEINSTANCE( UnoControlFileControlModel )
+IMPL_CREATEINSTANCE( UnoControlFixedHyperlinkModel )
+IMPL_CREATEINSTANCE( UnoControlFixedTextModel )
+IMPL_CREATEINSTANCE( UnoControlFormattedFieldModel )
+IMPL_CREATEINSTANCE( UnoControlGroupBoxModel )
+IMPL_CREATEINSTANCE( UnoControlImageControlModel )
+IMPL_CREATEINSTANCE( UnoControlListBoxModel )
+IMPL_CREATEINSTANCE( UnoControlNumericFieldModel )
+IMPL_CREATEINSTANCE( UnoControlPatternFieldModel )
+IMPL_CREATEINSTANCE( UnoControlRadioButtonModel )
+IMPL_CREATEINSTANCE( UnoControlTimeFieldModel )
+IMPL_CREATEINSTANCE( UnoControlProgressBarModel )
+IMPL_CREATEINSTANCE( UnoControlScrollBarModel )
+IMPL_CREATEINSTANCE( UnoSpinButtonModel )
+IMPL_CREATEINSTANCE( UnoControlFixedLineModel )
+IMPL_CREATEINSTANCE( UnoCurrencyFieldControl )
+IMPL_CREATEINSTANCE( UnoDateFieldControl )
+IMPL_CREATEINSTANCE( UnoDialogControl )
+IMPL_CREATEINSTANCE( UnoEditControl )
+IMPL_CREATEINSTANCE( UnoFileControl )
+IMPL_CREATEINSTANCE( UnoFixedHyperlinkControl )
+IMPL_CREATEINSTANCE( UnoFixedTextControl )
+IMPL_CREATEINSTANCE( UnoFormattedFieldControl )
+IMPL_CREATEINSTANCE( UnoGroupBoxControl )
+IMPL_CREATEINSTANCE( UnoImageControlControl )
+IMPL_CREATEINSTANCE( UnoListBoxControl )
+IMPL_CREATEINSTANCE( UnoNumericFieldControl )
+IMPL_CREATEINSTANCE( UnoPatternFieldControl )
+IMPL_CREATEINSTANCE( UnoRadioButtonControl )
+IMPL_CREATEINSTANCE( UnoTimeFieldControl )
+IMPL_CREATEINSTANCE( UnoProgressBarControl )
+IMPL_CREATEINSTANCE( UnoScrollBarControl )
+IMPL_CREATEINSTANCE( UnoSpinButtonControl )
+IMPL_CREATEINSTANCE( UnoFixedLineControl )
+IMPL_CREATEINSTANCE( VCLXMenuBar )
+IMPL_CREATEINSTANCE( VCLXPointer )
+IMPL_CREATEINSTANCE( VCLXPopupMenu )
+IMPL_CREATEINSTANCE( VCLXPrinterServer )
+IMPL_CREATEINSTANCE( UnoRoadmapControl )
+IMPL_CREATEINSTANCE( UnoControlRoadmapModel )
+IMPL_CREATEINSTANCE( UnoSimpleAnimationControl )
+IMPL_CREATEINSTANCE( UnoSimpleAnimationControlModel )
+IMPL_CREATEINSTANCE( UnoThrobberControl )
+IMPL_CREATEINSTANCE( UnoThrobberControlModel )
+
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL TreeControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL MutableTreeDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControl_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridControlModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DefaultGridColumnModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GridColumn_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+extern sal_Bool SAL_CALL comp_AsyncCallback_component_writeInfo( void * serviceManager, void * registryKey );
+extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
+
+extern sal_Bool SAL_CALL comp_Layout_component_writeInfo( void * serviceManager, void * registryKey );
+extern void * SAL_CALL comp_Layout_component_getFactory( const char * implName, void * serviceManager, void * registryKey );
+
+extern "C"
+{
+
+TOOLKIT_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char** ppEnvTypeName, uno_Environment** )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+TOOLKIT_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void* _pServiceManager, void* _pRegistryKey )
+{
+ if (_pRegistryKey)
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey > xRegistryKey =
+ static_cast< ::com::sun::star::registry::XRegistryKey* >( _pRegistryKey );
+
+ registerServices( xRegistryKey, "VCLXToolkit", szServiceName_Toolkit, szServiceName2_Toolkit );
+ registerServices( xRegistryKey, "VCLXPopupMenu", szServiceName_PopupMenu, szServiceName2_PopupMenu );
+ registerServices( xRegistryKey, "VCLXMenuBar", szServiceName_MenuBar, szServiceName2_MenuBar );
+ registerServices( xRegistryKey, "VCLXPointer", szServiceName_Pointer, szServiceName2_Pointer );
+ registerServices( xRegistryKey, "UnoControlContainer", szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer );
+ registerServices( xRegistryKey, "UnoControlContainerModel", szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel );
+ registerServices( xRegistryKey, "StdTabController", szServiceName_TabController, szServiceName2_TabController );
+ registerServices( xRegistryKey, "StdTabControllerModel", szServiceName_TabControllerModel, szServiceName2_TabControllerModel );
+ registerServices( xRegistryKey, "UnoDialogControl", szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog );
+ registerServices( xRegistryKey, "UnoControlDialogModel", szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel );
+ registerServices( xRegistryKey, "UnoEditControl", szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit );
+ registerServices( xRegistryKey, "UnoControlEditModel", szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel );
+ registerServices( xRegistryKey, "UnoDateFieldControl", szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField );
+ registerServices( xRegistryKey, "UnoControlDateFieldModel", szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel );
+ registerServices( xRegistryKey, "UnoTimeFieldControl", szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField );
+ registerServices( xRegistryKey, "UnoControlTimeFieldModel", szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel );
+ registerServices( xRegistryKey, "UnoNumericFieldControl", szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField );
+ registerServices( xRegistryKey, "UnoControlNumericFieldModel", szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel );
+ registerServices( xRegistryKey, "UnoCurrencyFieldControl", szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField );
+ registerServices( xRegistryKey, "UnoControlCurrencyFieldModel", szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel );
+ registerServices( xRegistryKey, "UnoPatternFieldControl", szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField );
+ registerServices( xRegistryKey, "UnoControlPatternFieldModel", szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel );
+ registerServices( xRegistryKey, "UnoFormattedFieldControl", szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField );
+ registerServices( xRegistryKey, "UnoControlFormattedFieldModel", szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel );
+ registerServices( xRegistryKey, "UnoFileControl", szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl );
+ registerServices( xRegistryKey, "UnoControlFileControlModel", szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel );
+ registerServices( xRegistryKey, "UnoButtonControl", szServiceName_UnoControlButton, szServiceName2_UnoControlButton );
+ registerServices( xRegistryKey, "UnoControlButtonModel", szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel );
+ registerServices( xRegistryKey, "UnoImageControlControl", szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton );
+ registerServices( xRegistryKey, "UnoControlImageControlModel", szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel );
+ registerServices( xRegistryKey, "UnoImageControlControl", szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl );
+ registerServices( xRegistryKey, "UnoControlImageControlModel", szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel );
+ registerServices( xRegistryKey, "UnoRadioButtonControl", szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton );
+ registerServices( xRegistryKey, "UnoControlRadioButtonModel", szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel );
+ registerServices( xRegistryKey, "UnoCheckBoxControl", szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox );
+ registerServices( xRegistryKey, "UnoControlCheckBoxModel", szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel );
+ registerServices( xRegistryKey, "UnoListBoxControl", szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox );
+ registerServices( xRegistryKey, "UnoControlListBoxModel", szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel );
+ registerServices( xRegistryKey, "UnoComboBoxControl", szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox );
+ registerServices( xRegistryKey, "UnoControlComboBoxModel", szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel );
+ registerServices( xRegistryKey, "UnoFixedTextControl", szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText );
+ registerServices( xRegistryKey, "UnoControlFixedTextModel", szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel );
+ registerServices( xRegistryKey, "UnoGroupBoxControl", szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox );
+ registerServices( xRegistryKey, "UnoControlGroupBoxModel", szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel );
+ registerServices( xRegistryKey, "UnoProgressBarControl", szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar );
+ registerServices( xRegistryKey, "UnoControlProgressBarModel", szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel );
+ registerServices( xRegistryKey, "UnoScrollBarControl", szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar );
+ registerServices( xRegistryKey, "UnoControlScrollBarModel", szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel );
+ registerServices( xRegistryKey, "UnoSpinButtonModel", szServiceName_UnoSpinButtonModel );
+ registerServices( xRegistryKey, "UnoSpinButtonControl", szServiceName_UnoSpinButtonControl );
+ registerServices( xRegistryKey, "UnoFixedLineControl", szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine );
+ registerServices( xRegistryKey, "UnoControlFixedLineModel", szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel );
+ registerServices( xRegistryKey, "VCLXPrinterServer", szServiceName_PrinterServer, szServiceName2_PrinterServer );
+ registerServices( xRegistryKey, "UnoRoadmapControl", szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap );
+ registerServices( xRegistryKey, "UnoControlRoadmapModel", szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel );
+ registerServices( xRegistryKey, "TreeControl", szServiceName_TreeControl );
+ registerServices( xRegistryKey, "TreeControlModel", szServiceName_TreeControlModel );
+ registerServices( xRegistryKey, "MutableTreeDataModel", szServiceName_MutableTreeDataModel );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControlModel", szServiceName_UnoSimpleAnimationControlModel );
+ registerServices( xRegistryKey, "UnoSimpleAnimationControl", szServiceName_UnoSimpleAnimationControl );
+ registerServices( xRegistryKey, "UnoThrobberControlModel", szServiceName_UnoThrobberControlModel );
+ registerServices( xRegistryKey, "UnoThrobberControl", szServiceName_UnoThrobberControl );
+ registerServices( xRegistryKey, "UnoFixedHyperlinkControl", szServiceName_UnoControlFixedHyperlink );
+ registerServices( xRegistryKey, "UnoControlFixedHyperlinkModel", szServiceName_UnoControlFixedHyperlinkModel );
+ registerServices( xRegistryKey, "GridControl", szServiceName_GridControl );
+ registerServices( xRegistryKey, "GridControlModel", szServiceName_GridControlModel );
+ registerServices( xRegistryKey, "DefaultGridDataModel", szServiceName_DefaultGridDataModel );
+ registerServices( xRegistryKey, "DefaultGridColumnModel", szServiceName_DefaultGridColumnModel );
+ registerServices( xRegistryKey, "GridColumn", szServiceName_GridColumn );
+
+ comp_AsyncCallback_component_writeInfo( _pServiceManager, _pRegistryKey );
+ comp_Layout_component_writeInfo( _pServiceManager, _pRegistryKey );
+
+ return sal_True;
+ }
+ return sal_False;
+}
+
+TOOLKIT_DLLPUBLIC void* SAL_CALL component_getFactory( const sal_Char* sImplementationName, void* _pServiceManager, void* _pRegistryKey )
+{
+ void* pRet = NULL;
+
+ if ( _pServiceManager )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory =
+ static_cast< ::com::sun::star::lang::XMultiServiceFactory* >( _pServiceManager );
+
+ CHECKANDCREATEFACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
+ CHECKANDCREATEFACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
+ CHECKANDCREATEFACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
+ CHECKANDCREATEFACTORY( VCLXPointer, szServiceName_Pointer, szServiceName2_Pointer )
+ CHECKANDCREATEFACTORY( UnoControlContainer, szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer )
+ CHECKANDCREATEFACTORY( UnoControlContainerModel, szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel )
+ CHECKANDCREATEFACTORY( StdTabController, szServiceName_TabController, szServiceName2_TabController )
+ CHECKANDCREATEFACTORY( StdTabControllerModel, szServiceName_TabControllerModel, szServiceName2_TabControllerModel )
+ CHECKANDCREATEFACTORY( UnoDialogControl, szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog )
+ CHECKANDCREATEFACTORY( UnoControlDialogModel, szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel )
+ CHECKANDCREATEFACTORY( UnoEditControl, szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit )
+ CHECKANDCREATEFACTORY( UnoControlEditModel, szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel )
+ CHECKANDCREATEFACTORY( UnoDateFieldControl, szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField )
+ CHECKANDCREATEFACTORY( UnoControlDateFieldModel, szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel )
+ CHECKANDCREATEFACTORY( UnoTimeFieldControl, szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField )
+ CHECKANDCREATEFACTORY( UnoControlTimeFieldModel, szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel )
+ CHECKANDCREATEFACTORY( UnoNumericFieldControl, szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField )
+ CHECKANDCREATEFACTORY( UnoControlNumericFieldModel, szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel )
+ CHECKANDCREATEFACTORY( UnoCurrencyFieldControl, szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField )
+ CHECKANDCREATEFACTORY( UnoControlCurrencyFieldModel, szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel )
+ CHECKANDCREATEFACTORY( UnoPatternFieldControl, szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField )
+ CHECKANDCREATEFACTORY( UnoControlPatternFieldModel, szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel )
+ CHECKANDCREATEFACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField )
+ CHECKANDCREATEFACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel )
+ CHECKANDCREATEFACTORY( UnoFileControl, szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl )
+ CHECKANDCREATEFACTORY( UnoControlFileControlModel, szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel )
+ CHECKANDCREATEFACTORY( UnoButtonControl, szServiceName_UnoControlButton, szServiceName2_UnoControlButton )
+ CHECKANDCREATEFACTORY( UnoControlButtonModel, szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel )
+ CHECKANDCREATEFACTORY( UnoImageControlControl, szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton )
+ CHECKANDCREATEFACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel )
+ CHECKANDCREATEFACTORY( UnoImageControlControl, szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl )
+ CHECKANDCREATEFACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel )
+ CHECKANDCREATEFACTORY( UnoRadioButtonControl, szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton )
+ CHECKANDCREATEFACTORY( UnoControlRadioButtonModel, szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel )
+ CHECKANDCREATEFACTORY( UnoCheckBoxControl, szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox )
+ CHECKANDCREATEFACTORY( UnoControlCheckBoxModel, szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel )
+ CHECKANDCREATEFACTORY( UnoListBoxControl, szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox )
+ CHECKANDCREATEFACTORY( UnoControlListBoxModel, szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel )
+ CHECKANDCREATEFACTORY( UnoComboBoxControl, szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox )
+ CHECKANDCREATEFACTORY( UnoControlComboBoxModel, szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel )
+ CHECKANDCREATEFACTORY( UnoFixedTextControl, szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText )
+ CHECKANDCREATEFACTORY( UnoControlFixedTextModel, szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel )
+ CHECKANDCREATEFACTORY( UnoGroupBoxControl, szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox )
+ CHECKANDCREATEFACTORY( UnoControlGroupBoxModel, szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel )
+ CHECKANDCREATEFACTORY( UnoProgressBarControl, szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar )
+ CHECKANDCREATEFACTORY( UnoControlProgressBarModel, szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel )
+ CHECKANDCREATEFACTORY( UnoScrollBarControl, szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar )
+ CHECKANDCREATEFACTORY( UnoControlScrollBarModel, szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel )
+ CHECKANDCREATEFACTORY( UnoFixedLineControl, szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine )
+ CHECKANDCREATEFACTORY( UnoControlFixedLineModel, szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel )
+ CHECKANDCREATEFACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
+ CHECKANDCREATEFACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
+ CHECKANDCREATEFACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
+ CHECKANDCREATEFACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
+ CHECKANDCREATEFACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
+ CHECKANDCREATEFACTORY( TreeControl, szServiceName_TreeControl, NULL )
+ CHECKANDCREATEFACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
+ CHECKANDCREATEFACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
+ CHECKANDCREATEFACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, NULL )
+ CHECKANDCREATEFACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, NULL )
+ CHECKANDCREATEFACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, NULL )
+ CHECKANDCREATEFACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, NULL )
+ CHECKANDCREATEFACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
+ CHECKANDCREATEFACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
+ CHECKANDCREATEFACTORY( GridControl, szServiceName_GridControl, NULL );
+ CHECKANDCREATEFACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
+ CHECKANDCREATEFACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
+ CHECKANDCREATEFACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
+ CHECKANDCREATEFACTORY( GridColumn, szServiceName_GridColumn, NULL );
+
+
+ if ( rtl_str_compare( sImplementationName, "com.sun.star.awt.comp.AsyncCallback" ) == 0 )
+ return comp_AsyncCallback_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
+
+
+ if( pRet == 0 )
+ pRet = comp_Layout_component_getFactory( sImplementationName, _pServiceManager, _pRegistryKey );
+ }
+ return pRet;
+}
+}
+
+
+
diff --git a/toolkit/source/helper/servicenames.cxx b/toolkit/source/helper/servicenames.cxx
new file mode 100644
index 000000000000..1885387561cb
--- /dev/null
+++ b/toolkit/source/helper/servicenames.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <sal/types.h>
+#include <tools/solar.h>
+
+#include <toolkit/helper/servicenames.hxx>
+
+const sal_Char __FAR_DATA szServiceName_Toolkit[] = "stardiv.vcl.VclToolkit", szServiceName2_Toolkit[] = "com.sun.star.awt.Toolkit";
+const sal_Char __FAR_DATA szServiceName_PopupMenu[] = "stardiv.vcl.PopupMenu", szServiceName2_PopupMenu[] = "com.sun.star.awt.PopupMenu";
+const sal_Char __FAR_DATA szServiceName_MenuBar[] = "stardiv.vcl.MenuBar", szServiceName2_MenuBar[] = "com.sun.star.awt.MenuBar";
+const sal_Char __FAR_DATA szServiceName_Pointer[] = "stardiv.vcl.Pointer", szServiceName2_Pointer[] = "com.sun.star.awt.Pointer";
+const sal_Char __FAR_DATA szServiceName_UnoControlContainer[] = "stardiv.vcl.control.ControlContainer", szServiceName2_UnoControlContainer[] = "com.sun.star.awt.UnoControlContainer";
+const sal_Char __FAR_DATA szServiceName_UnoControlContainerModel[] = "stardiv.vcl.controlmodel.ControlContainer", szServiceName2_UnoControlContainerModel[] = "com.sun.star.awt.UnoControlContainerModel";
+const sal_Char __FAR_DATA szServiceName_TabController[] = "stardiv.vcl.control.TabController", szServiceName2_TabController[] = "com.sun.star.awt.TabController";
+const sal_Char __FAR_DATA szServiceName_TabControllerModel[] = "stardiv.vcl.controlmodel.TabController", szServiceName2_TabControllerModel[] = "com.sun.star.awt.TabControllerModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlDialog[] = "stardiv.vcl.control.Dialog", szServiceName2_UnoControlDialog[] = "com.sun.star.awt.UnoControlDialog";
+const sal_Char __FAR_DATA szServiceName_UnoControlDialogModel[] = "stardiv.vcl.controlmodel.Dialog", szServiceName2_UnoControlDialogModel[] = "com.sun.star.awt.UnoControlDialogModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlEdit[] = "stardiv.vcl.control.Edit", szServiceName2_UnoControlEdit[] = "com.sun.star.awt.UnoControlEdit";
+const sal_Char __FAR_DATA szServiceName_UnoControlEditModel[] = "stardiv.vcl.controlmodel.Edit", szServiceName2_UnoControlEditModel[] = "com.sun.star.awt.UnoControlEditModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFileControl[] = "stardiv.vcl.control.FileControl", szServiceName2_UnoControlFileControl[] = "com.sun.star.awt.UnoControlFileControl";
+const sal_Char __FAR_DATA szServiceName_UnoControlFileControlModel[] = "stardiv.vcl.controlmodel.FileControl", szServiceName2_UnoControlFileControlModel[] = "com.sun.star.awt.UnoControlFileControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlButton[] = "stardiv.vcl.control.Button", szServiceName2_UnoControlButton[] = "com.sun.star.awt.UnoControlButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlButtonModel[] = "stardiv.vcl.controlmodel.Button", szServiceName2_UnoControlButtonModel[] = "com.sun.star.awt.UnoControlButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageButton[] = "stardiv.vcl.control.ImageButton", szServiceName2_UnoControlImageButton[] = "com.sun.star.awt.UnoControlImageButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageButtonModel[] = "stardiv.vcl.controlmodel.ImageButton", szServiceName2_UnoControlImageButtonModel[] = "com.sun.star.awt.UnoControlImageButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageControl[] = "stardiv.vcl.control.ImageControl", szServiceName2_UnoControlImageControl[] = "com.sun.star.awt.UnoControlImageControl";
+const sal_Char __FAR_DATA szServiceName_UnoControlImageControlModel[] = "stardiv.vcl.controlmodel.ImageControl", szServiceName2_UnoControlImageControlModel[] = "com.sun.star.awt.UnoControlImageControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlRadioButton[] = "stardiv.vcl.control.RadioButton", szServiceName2_UnoControlRadioButton[] = "com.sun.star.awt.UnoControlRadioButton";
+const sal_Char __FAR_DATA szServiceName_UnoControlRadioButtonModel[] = "stardiv.vcl.controlmodel.RadioButton", szServiceName2_UnoControlRadioButtonModel[] = "com.sun.star.awt.UnoControlRadioButtonModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlCheckBox[] = "stardiv.vcl.control.CheckBox", szServiceName2_UnoControlCheckBox[] = "com.sun.star.awt.UnoControlCheckBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlCheckBoxModel[] = "stardiv.vcl.controlmodel.CheckBox", szServiceName2_UnoControlCheckBoxModel[] = "com.sun.star.awt.UnoControlCheckBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlListBox[] = "stardiv.vcl.control.ListBox", szServiceName2_UnoControlListBox[] = "com.sun.star.awt.UnoControlListBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlListBoxModel[] = "stardiv.vcl.controlmodel.ListBox", szServiceName2_UnoControlListBoxModel[] = "com.sun.star.awt.UnoControlListBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlComboBox[] = "stardiv.vcl.control.ComboBox", szServiceName2_UnoControlComboBox[] = "com.sun.star.awt.UnoControlComboBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlComboBoxModel[] = "stardiv.vcl.controlmodel.ComboBox", szServiceName2_UnoControlComboBoxModel[] = "com.sun.star.awt.UnoControlComboBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedText[] = "stardiv.vcl.control.FixedText", szServiceName2_UnoControlFixedText[] = "com.sun.star.awt.UnoControlFixedText";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedTextModel[] = "stardiv.vcl.controlmodel.FixedText", szServiceName2_UnoControlFixedTextModel[] = "com.sun.star.awt.UnoControlFixedTextModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlGroupBox[] = "stardiv.vcl.control.GroupBox", szServiceName2_UnoControlGroupBox[] = "com.sun.star.awt.UnoControlGroupBox";
+const sal_Char __FAR_DATA szServiceName_UnoControlGroupBoxModel[] = "stardiv.vcl.controlmodel.GroupBox", szServiceName2_UnoControlGroupBoxModel[] = "com.sun.star.awt.UnoControlGroupBoxModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlDateField[] = "stardiv.vcl.control.DateField", szServiceName2_UnoControlDateField[] = "com.sun.star.awt.UnoControlDateField";
+const sal_Char __FAR_DATA szServiceName_UnoControlDateFieldModel[] = "stardiv.vcl.controlmodel.DateField", szServiceName2_UnoControlDateFieldModel[] = "com.sun.star.awt.UnoControlDateFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTimeField[] = "stardiv.vcl.control.TimeField", szServiceName2_UnoControlTimeField[] = "com.sun.star.awt.UnoControlTimeField";
+const sal_Char __FAR_DATA szServiceName_UnoControlTimeFieldModel[] = "stardiv.vcl.controlmodel.TimeField", szServiceName2_UnoControlTimeFieldModel[] = "com.sun.star.awt.UnoControlTimeFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlNumericField[] = "stardiv.vcl.control.NumericField", szServiceName2_UnoControlNumericField[] = "com.sun.star.awt.UnoControlNumericField";
+const sal_Char __FAR_DATA szServiceName_UnoControlNumericFieldModel[] = "stardiv.vcl.controlmodel.NumericField", szServiceName2_UnoControlNumericFieldModel[] = "com.sun.star.awt.UnoControlNumericFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyField[] = "stardiv.vcl.control.CurrencyField", szServiceName2_UnoControlCurrencyField[] = "com.sun.star.awt.UnoControlCurrencyField";
+const sal_Char __FAR_DATA szServiceName_UnoControlCurrencyFieldModel[] = "stardiv.vcl.controlmodel.CurrencyField", szServiceName2_UnoControlCurrencyFieldModel[] = "com.sun.star.awt.UnoControlCurrencyFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlPatternField[] = "stardiv.vcl.control.PatternField", szServiceName2_UnoControlPatternField[] = "com.sun.star.awt.UnoControlPatternField";
+const sal_Char __FAR_DATA szServiceName_UnoControlPatternFieldModel[] = "stardiv.vcl.controlmodel.PatternField", szServiceName2_UnoControlPatternFieldModel[] = "com.sun.star.awt.UnoControlPatternFieldModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFormattedField[] = "stardiv.vcl.control.FormattedField", szServiceName2_UnoControlFormattedField[] = "com.sun.star.awt.UnoControlFormattedField";
+const sal_Char __FAR_DATA szServiceName_UnoControlFormattedFieldModel[] = "stardiv.vcl.controlmodel.FormattedField", szServiceName2_UnoControlFormattedFieldModel[] = "com.sun.star.awt.UnoControlFormattedFieldModel";
+const sal_Char __FAR_DATA szServiceName_MVCIntrospection[] = "stardiv.vcl.MVCIntrospection", szServiceName2_MVCIntrospection[] = "com.sun.star.awt.MVCIntrospection";
+const sal_Char __FAR_DATA szServiceName_ImageProducer[] = "stardiv.vcl.ImageProducer", szServiceName2_ImageProducer[] = "com.sun.star.awt.ImageProducer";
+const sal_Char __FAR_DATA szServiceName_PrinterServer[] = "stardiv.vcl.PrinterServer", szServiceName2_PrinterServer[] = "com.sun.star.awt.PrinterServer";
+const sal_Char __FAR_DATA szServiceName_UnoControlProgressBar[] = "stardiv.vcl.control.ProgressBar", szServiceName2_UnoControlProgressBar[] = "com.sun.star.awt.UnoControlProgressBar";
+const sal_Char __FAR_DATA szServiceName_UnoControlProgressBarModel[] = "stardiv.vcl.controlmodel.ProgressBar", szServiceName2_UnoControlProgressBarModel[] = "com.sun.star.awt.UnoControlProgressBarModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlScrollBar[] = "stardiv.vcl.control.ScrollBar", szServiceName2_UnoControlScrollBar[] = "com.sun.star.awt.UnoControlScrollBar";
+const sal_Char __FAR_DATA szServiceName_UnoControlScrollBarModel[] = "stardiv.vcl.controlmodel.ScrollBar", szServiceName2_UnoControlScrollBarModel[] = "com.sun.star.awt.UnoControlScrollBarModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedLine[] = "stardiv.vcl.control.FixedLine", szServiceName2_UnoControlFixedLine[] = "com.sun.star.awt.UnoControlFixedLine";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedLineModel[] = "stardiv.vcl.controlmodel.FixedLine", szServiceName2_UnoControlFixedLineModel[] = "com.sun.star.awt.UnoControlFixedLineModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlRoadmap[] = "stardiv.vcl.control.Roadmap", szServiceName2_UnoControlRoadmap[] = "com.sun.star.awt.UnoControlRoadmap";
+const sal_Char __FAR_DATA szServiceName_UnoControlRoadmapModel[] = "stardiv.vcl.controlmodel.Roadmap", szServiceName2_UnoControlRoadmapModel[] = "com.sun.star.awt.UnoControlRoadmapModel";
+const sal_Char __FAR_DATA szServiceName_UnoSpinButtonControl[] = "com.sun.star.awt.UnoControlSpinButton";
+const sal_Char __FAR_DATA szServiceName_UnoSpinButtonModel[] = "com.sun.star.awt.UnoControlSpinButtonModel";
+const sal_Char __FAR_DATA szServiceName_TreeControl[] = "com.sun.star.awt.tree.TreeControl";
+const sal_Char __FAR_DATA szServiceName_TreeControlModel[] = "com.sun.star.awt.tree.TreeControlModel";
+const sal_Char __FAR_DATA szServiceName_MutableTreeDataModel[] = "com.sun.star.awt.tree.MutableTreeDataModel";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoSimpleAnimationControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[] = "com.sun.star.awt.UnoControlFixedHyperlink";
+const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlinkModel[] = "com.sun.star.awt.UnoControlFixedHyperlinkModel";
+const sal_Char __FAR_DATA szServiceName_GridControl[] = "com.sun.star.awt.grid.UnoControlGrid";
+const sal_Char __FAR_DATA szServiceName_GridControlModel[] = "com.sun.star.awt.grid.UnoControlGridModel";
+const sal_Char __FAR_DATA szServiceName_DefaultGridDataModel[] = "com.sun.star.awt.grid.DefaultGridDataModel";
+const sal_Char __FAR_DATA szServiceName_DefaultGridColumnModel[] = "com.sun.star.awt.grid.DefaultGridColumnModel";
+const sal_Char __FAR_DATA szServiceName_GridColumn[] = "com.sun.star.awt.grid.GridColumn";
diff --git a/toolkit/source/helper/throbberimpl.cxx b/toolkit/source/helper/throbberimpl.cxx
new file mode 100644
index 000000000000..7a8e260ab4b8
--- /dev/null
+++ b/toolkit/source/helper/throbberimpl.cxx
@@ -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.
+ *
+ ************************************************************************/
+#include "precompiled_toolkit.hxx"
+#include <toolkit/helper/throbberimpl.hxx>
+
+#include <vcl/svapp.hxx>
+#include <vcl/fixed.hxx>
+
+//........................................................................
+namespace toolkit
+//........................................................................
+{
+ using namespace ::com::sun::star;
+
+ //--------------------------------------------------------------------
+ Throbber_Impl::Throbber_Impl( uno::Reference< VCLXWindow > xParent,
+ sal_Int32 nStepTime,
+ sal_Bool bRepeat )
+ :mrMutex( Application::GetSolarMutex() )
+ {
+ mxParent = xParent;
+ mbRepeat = bRepeat;
+ mnStepTime = nStepTime;
+ maWaitTimer.SetTimeout( mnStepTime );
+ maWaitTimer.SetTimeoutHdl( LINK( this, Throbber_Impl, TimeOutHdl ) );
+ }
+
+ //--------------------------------------------------------------------
+ Throbber_Impl::~Throbber_Impl()
+ {
+ maWaitTimer.Stop();
+ mxParent = NULL;
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::start() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ mnCurStep = 0;
+ maWaitTimer.Start();
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::stop() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maWaitTimer.Stop();
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
+ throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ maImageList = rImageList;
+
+ mnStepCount = maImageList.getLength();
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+ if ( pImage )
+ {
+ if ( mnStepCount )
+ pImage->SetImage( maImageList[ 0 ] );
+ else
+ pImage->SetImage( Image() );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void Throbber_Impl::initImage()
+ throw ( uno::RuntimeException )
+ {
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+ if ( pImage && maImageList.getLength() )
+ pImage->SetImage( maImageList[ 0 ] );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool Throbber_Impl::isHCMode()
+ throw ( uno::RuntimeException )
+ {
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+ if ( pImage )
+ return pImage->GetSettings().GetStyleSettings().GetHighContrastMode();
+ else
+ return Application::GetSettings().GetStyleSettings().GetHighContrastMode();
+ }
+
+ // -----------------------------------------------------------------------
+ IMPL_LINK( Throbber_Impl, TimeOutHdl, Throbber_Impl*, EMPTYARG )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ FixedImage* pImage = static_cast< FixedImage* >( mxParent->GetWindow() );
+
+ if ( !pImage || !maImageList.getLength() )
+ return 0;
+
+ if ( mnCurStep < mnStepCount - 1 )
+ mnCurStep += 1;
+ else
+ mnCurStep = 0;
+
+ pImage->SetImage( maImageList[ mnCurStep ] );
+
+ return 0;
+ }
+
+//........................................................................
+} // namespacetoolkit
+//........................................................................
+
diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx
new file mode 100644
index 000000000000..4e1e4153daf1
--- /dev/null
+++ b/toolkit/source/helper/tkresmgr.cxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <toolkit/helper/tkresmgr.hxx>
+#include <tools/simplerm.hxx>
+#ifndef _TOOLS_RESMGR_HXX_
+#include <tools/resmgr.hxx>
+#endif
+
+
+#include <vcl/svapp.hxx>
+
+
+// -----------------------------------------------------------------------------
+// TkResMgr
+// -----------------------------------------------------------------------------
+
+SimpleResMgr* TkResMgr::m_pSimpleResMgr = NULL;
+ResMgr* TkResMgr::m_pResMgr = NULL;
+
+// -----------------------------------------------------------------------------
+
+TkResMgr::EnsureDelete::~EnsureDelete()
+{
+ delete TkResMgr::m_pSimpleResMgr;
+// delete TkResMgr::m_pResMgr;
+}
+
+// -----------------------------------------------------------------------------
+
+void TkResMgr::ensureImplExists()
+{
+ if (m_pSimpleResMgr)
+ return;
+
+ ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
+
+ ByteString sResMgrName( "tk" );
+
+ m_pSimpleResMgr = SimpleResMgr::Create( sResMgrName.GetBuffer(), aLocale );
+ m_pResMgr = ResMgr::CreateResMgr( sResMgrName.GetBuffer() );
+
+ if (m_pSimpleResMgr)
+ {
+ // 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_pSimpleResMgr )
+ sReturn = m_pSimpleResMgr->ReadString( nResId );
+
+ return sReturn;
+}
+
+// -----------------------------------------------------------------------------
+Image TkResMgr::loadImage( sal_uInt16 nResId )
+{
+ Image aReturn;
+
+ ensureImplExists();
+ if ( m_pResMgr )
+ aReturn = Image( ResId( nResId, *m_pResMgr ) );
+
+ return aReturn;
+}
+
+// -----------------------------------------------------------------------------
diff --git a/toolkit/source/helper/unomemorystream.cxx b/toolkit/source/helper/unomemorystream.cxx
new file mode 100644
index 000000000000..b07cee100406
--- /dev/null
+++ b/toolkit/source/helper/unomemorystream.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_toolkit.hxx"
+
+
+#include <toolkit/helper/unomemorystream.hxx>
+#include <algorithm>
+
+// ----------------------------------------------------
+// class UnoMemoryStream
+// ----------------------------------------------------
+UnoMemoryStream::UnoMemoryStream( sal_uInt32 nInitSize, sal_uInt32 nInitResize )
+ : SvMemoryStream( nInitSize, nInitResize )
+{
+}
+
+// ::com::sun::star::uno::XInterface
+::com::sun::star::uno::Any UnoMemoryStream::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( ::com::sun::star::io::XInputStream*, this ) );
+ return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
+}
+
+
+// ::com::sun::star::io::XInputStream
+sal_Int32 UnoMemoryStream::readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nRead = available();
+ if ( nRead > nBytesToRead )
+ nRead = nBytesToRead;
+
+ rData = ::com::sun::star::uno::Sequence< sal_Int8 >( nRead );
+ Read( rData.getArray(), nRead );
+
+ return nRead;
+}
+
+sal_Int32 UnoMemoryStream::readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& rData, sal_Int32 nMaxBytesToRead ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_Int32 nAvailable = available();
+ if( nAvailable )
+ {
+ return readBytes( rData, std::min( nMaxBytesToRead , nAvailable ) );
+ }
+ else
+ {
+ // Not the most effective method, but it sticks to the specification
+ return readBytes( rData, 1 );
+ }
+}
+
+void UnoMemoryStream::skipBytes( sal_Int32 nBytesToSkip ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ SeekRel( nBytesToSkip );
+}
+
+sal_Int32 UnoMemoryStream::available() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ sal_uInt32 nStreamPos = Tell();
+ sal_uInt32 nEnd = Seek( STREAM_SEEK_TO_END );
+ Seek( nStreamPos );
+ return nEnd - nStreamPos;
+}
+
+void UnoMemoryStream::closeInput() throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException)
+{
+ // nothing to do
+}
+
+
+
+
+
diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx
new file mode 100644
index 000000000000..da946ffdc08a
--- /dev/null
+++ b/toolkit/source/helper/unopropertyarrayhelper.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+
+// ----------------------------------------------------
+// class UnoPropertyArrayHelper
+// ----------------------------------------------------
+
+UnoPropertyArrayHelper::UnoPropertyArrayHelper( const ::com::sun::star::uno::Sequence<sal_Int32>& rIDs )
+{
+ sal_Int32 nIDs = rIDs.getLength();
+ const sal_Int32* pIDs = rIDs.getConstArray();
+ for ( sal_Int32 n = 0; n < nIDs; n++ )
+ maIDs.Insert( pIDs[n], (void*)1L );
+}
+
+UnoPropertyArrayHelper::UnoPropertyArrayHelper( const std::list< sal_uInt16 > &rIDs )
+{
+ std::list< sal_uInt16 >::const_iterator iter;
+ for( iter = rIDs.begin(); iter != rIDs.end(); iter++)
+ maIDs.Insert( *iter, (void*)1L);
+}
+
+sal_Bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const
+{
+ if ( ( nPropId >= BASEPROPERTY_FONTDESCRIPTORPART_START ) && ( nPropId <= BASEPROPERTY_FONTDESCRIPTORPART_END ) )
+ nPropId = BASEPROPERTY_FONTDESCRIPTOR;
+
+ return maIDs.Get( nPropId ) ? sal_True : sal_False;
+}
+
+// ::cppu::IPropertyArrayHelper
+sal_Bool UnoPropertyArrayHelper::fillPropertyMembersByHandle( ::rtl::OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nPropId )
+{
+ sal_uInt16 id = sal::static_int_cast< sal_uInt16 >(nPropId);
+ sal_Bool bValid = ImplHasProperty( id );
+ if ( bValid )
+ {
+ if ( pPropName )
+ *pPropName = GetPropertyName( id );
+ if ( pAttributes )
+ *pAttributes = GetPropertyAttribs( id );
+ }
+ return bValid;
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > UnoPropertyArrayHelper::getProperties()
+{
+ // Sortiert nach Namen...
+
+ Table aSortedPropsIds;
+ sal_uInt32 nProps = maIDs.Count();
+ for ( sal_uInt32 s = 0; s < nProps; s++ )
+ {
+ sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(
+ maIDs.GetObjectKey( s ));
+ aSortedPropsIds.Insert( 1+GetPropertyOrderNr( nId ), (void*)(sal_uInt32)nId );
+
+ if ( nId == BASEPROPERTY_FONTDESCRIPTOR )
+ {
+ // Einzelproperties...
+ for ( sal_uInt16 i = BASEPROPERTY_FONTDESCRIPTORPART_START; i <= BASEPROPERTY_FONTDESCRIPTORPART_END; i++ )
+ aSortedPropsIds.Insert( 1+GetPropertyOrderNr( i ), (void*)(sal_uInt32)i );
+ }
+ }
+
+ nProps = aSortedPropsIds.Count(); // koennen jetzt mehr sein
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> aProps( nProps );
+ ::com::sun::star::beans::Property* pProps = aProps.getArray();
+
+ for ( sal_uInt32 n = 0; n < nProps; n++ )
+ {
+ sal_uInt16 nId = (sal_uInt16)(sal_uIntPtr)aSortedPropsIds.GetObject( n );
+ pProps[n].Name = GetPropertyName( nId );
+ pProps[n].Handle = nId;
+ pProps[n].Type = *GetPropertyType( nId );
+ pProps[n].Attributes = GetPropertyAttribs( nId );
+ }
+
+ return aProps;
+}
+
+::com::sun::star::beans::Property UnoPropertyArrayHelper::getPropertyByName(const ::rtl::OUString& rPropertyName) throw (::com::sun::star::beans::UnknownPropertyException)
+{
+ ::com::sun::star::beans::Property aProp;
+ sal_uInt16 nId = GetPropertyId( rPropertyName );
+ if ( ImplHasProperty( nId ) )
+ {
+ aProp.Name = rPropertyName;
+ aProp.Handle = -1;
+ aProp.Type = *GetPropertyType( nId );
+ aProp.Attributes = GetPropertyAttribs( nId );
+ }
+
+ return aProp;
+}
+
+sal_Bool UnoPropertyArrayHelper::hasPropertyByName(const ::rtl::OUString& rPropertyName)
+{
+ return ImplHasProperty( GetPropertyId( rPropertyName ) );
+}
+
+sal_Int32 UnoPropertyArrayHelper::getHandleByName( const ::rtl::OUString & rPropertyName )
+{
+ sal_Int32 nId = (sal_Int32 ) GetPropertyId( rPropertyName );
+ return nId ? nId : (-1);
+}
+
+sal_Int32 UnoPropertyArrayHelper::fillHandles( sal_Int32* pHandles, const ::com::sun::star::uno::Sequence< ::rtl::OUString > & rPropNames )
+{
+ const ::rtl::OUString* pNames = rPropNames.getConstArray();
+ sal_Int32 nValues = rPropNames.getLength();
+ sal_Int32 nValidHandles = 0;
+
+ for ( sal_Int32 n = 0; n < nValues; n++ )
+ {
+ sal_uInt16 nPropId = GetPropertyId( pNames[n] );
+ if ( nPropId && ImplHasProperty( nPropId ) )
+ {
+ pHandles[n] = nPropId;
+ nValidHandles++;
+ }
+ else
+ {
+ pHandles[n] = -1;
+ }
+ }
+ return nValidHandles;
+}
+
+
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx
new file mode 100644
index 000000000000..d7cec7c17354
--- /dev/null
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -0,0 +1,335 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <com/sun/star/awt/WindowEvent.hpp>
+#include <comphelper/processfactory.hxx>
+
+#include <toolkit/helper/unowrapper.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/awt/vclxcontainer.hxx>
+#include <toolkit/awt/vclxtopwindow.hxx>
+#include <toolkit/awt/vclxgraphics.hxx>
+
+#include "toolkit/dllapi.h"
+#include <vcl/svapp.hxx>
+#include <vcl/syswin.hxx>
+#include <vcl/menu.hxx>
+
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > CreateXWindow( Window* pWindow )
+{
+ switch ( pWindow->GetType() )
+ {
+ case WINDOW_IMAGERADIOBUTTON:
+ case WINDOW_IMAGEBUTTON:
+ case WINDOW_SPINBUTTON:
+ case WINDOW_MENUBUTTON:
+ case WINDOW_MOREBUTTON:
+ case WINDOW_PUSHBUTTON:
+ case WINDOW_HELPBUTTON:
+ case WINDOW_OKBUTTON:
+ case WINDOW_CANCELBUTTON: return new VCLXButton;
+ case WINDOW_CHECKBOX: return new VCLXCheckBox;
+ // --> OD 2009-06-29 #i95042#
+ // A Window of type <MetricBox> is inherited from type <ComboBox>.
+ // Thus, it does make more sense to return a <VCLXComboBox> instance
+ // instead of only a <VCLXWindow> instance, especially regarding its
+ // corresponding accessibility API.
+ case WINDOW_METRICBOX:
+ // <--
+ case WINDOW_COMBOBOX: return new VCLXComboBox;
+ case WINDOW_SPINFIELD:
+ case WINDOW_NUMERICFIELD:
+ case WINDOW_CURRENCYFIELD: return new VCLXNumericField;
+ case WINDOW_DATEFIELD: return new VCLXDateField;
+ case WINDOW_MULTILINEEDIT:
+ case WINDOW_EDIT: return new VCLXEdit;
+ case WINDOW_METRICFIELD: return new VCLXSpinField;
+ case WINDOW_MESSBOX:
+ case WINDOW_INFOBOX:
+ case WINDOW_WARNINGBOX:
+ case WINDOW_QUERYBOX:
+ case WINDOW_ERRORBOX: return new VCLXMessageBox;
+ case WINDOW_FIXEDIMAGE: return new VCLXImageControl;
+ case WINDOW_FIXEDTEXT: return new VCLXFixedText;
+ case WINDOW_MULTILISTBOX:
+ case WINDOW_LISTBOX: return new VCLXListBox;
+ case WINDOW_LONGCURRENCYFIELD: return new VCLXCurrencyField;
+ case WINDOW_DIALOG:
+ case WINDOW_MODALDIALOG:
+ case WINDOW_TABDIALOG:
+ case WINDOW_BUTTONDIALOG:
+ case WINDOW_MODELESSDIALOG: return new VCLXDialog;
+ case WINDOW_PATTERNFIELD: return new VCLXPatternField;
+ case WINDOW_RADIOBUTTON: return new VCLXRadioButton;
+ case WINDOW_SCROLLBAR: return new VCLXScrollBar;
+ case WINDOW_TIMEFIELD: return new VCLXTimeField;
+
+ case WINDOW_SYSWINDOW:
+ case WINDOW_WORKWINDOW:
+ case WINDOW_DOCKINGWINDOW:
+ case WINDOW_FLOATINGWINDOW:
+ case WINDOW_HELPTEXTWINDOW: return new VCLXTopWindow;
+
+ case WINDOW_WINDOW:
+ case WINDOW_TABPAGE: return new VCLXContainer;
+
+ case WINDOW_TOOLBOX: return new VCLXToolBox;
+
+ // case WINDOW_FIXEDLINE:
+ // case WINDOW_FIXEDBITMAP:
+ // case WINDOW_DATEBOX:
+ // case WINDOW_GROUPBOX:
+ // case WINDOW_LONGCURRENCYBOX:
+ // case WINDOW_SPLITTER:
+ // case WINDOW_STATUSBAR:
+ // case WINDOW_TABCONTROL:
+ // case WINDOW_NUMERICBOX:
+ // case WINDOW_TRISTATEBOX:
+ // case WINDOW_TIMEBOX:
+ // case WINDOW_SPLITWINDOW:
+ // case WINDOW_SCROLLBARBOX:
+ // case WINDOW_PATTERNBOX:
+ // case WINDOW_CURRENCYBOX:
+ default: return new VCLXWindow( true );
+ }
+}
+
+// ----------------------------------------------------
+// class UnoWrapper
+// ----------------------------------------------------
+
+extern "C" {
+
+TOOLKIT_DLLPUBLIC UnoWrapperBase* CreateUnoWrapper()
+{
+ return new UnoWrapper( NULL );
+}
+
+} // extern "C"
+
+
+UnoWrapper::UnoWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& rxToolkit )
+{
+ mxToolkit = rxToolkit;
+}
+
+void UnoWrapper::Destroy()
+{
+ delete this;
+}
+
+UnoWrapper::~UnoWrapper()
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> UnoWrapper::GetVCLToolkit()
+{
+ if ( !mxToolkit.is() )
+ mxToolkit = VCLUnoHelper::CreateToolkit();
+ return mxToolkit.get();
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> UnoWrapper::GetWindowInterface( Window* pWindow, BOOL bCreate )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
+ if ( !xPeer.is() && bCreate )
+ {
+ xPeer = CreateXWindow( pWindow );
+ SetWindowInterface( pWindow, xPeer );
+ }
+ return xPeer;
+}
+
+void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( xIFace );
+
+ DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
+ if ( pVCLXWindow )
+ {
+ if( pWindow->GetWindowPeer() )
+ {
+ int i = 0;
+ i++;
+ // DBG_ERROR( "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
+ }
+ pVCLXWindow->SetWindow( pWindow );
+ pWindow->SetWindowPeer( xIFace, pVCLXWindow );
+ }
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> UnoWrapper::CreateGraphics( OutputDevice* pOutDev )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> xGrf;
+ VCLXGraphics* pGrf = new VCLXGraphics;
+ xGrf = pGrf;
+ pGrf->Init( pOutDev );
+ return xGrf;
+}
+
+void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev )
+{
+ List* pLst = pOutDev->GetUnoGraphicsList();
+ if ( pLst )
+ {
+ for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
+ {
+ VCLXGraphics* pGrf = (VCLXGraphics*)pLst->GetObject( n );
+ pGrf->SetOutputDevice( NULL );
+ }
+ }
+
+}
+
+// MT: Wurde im Window-CTOR gerufen, damit Container-Listener
+// vom Parent reagieren, aber hat sowieso nicht richtig funktioniert,
+// weil im Window-CTOR das Interface noch nicht da ist!
+// => Nur Listener rufen, wenn ueber das ::com::sun::star::awt::Toolkit erzeugt
+
+/*
+void ImplSmartWindowCreated( Window* pNewWindow )
+{
+ UNOWindowData* pParentUNOData = pNewWindow->GetParent() ?
+ pNewWindow->GetParent()->GetUNOData() : NULL;
+
+ if ( pParentUNOData && pParentUNOData->GetListeners( EL_CONTAINER ) )
+ {
+ UNOWindowData* pUNOData = pNewWindow->GetUNOData();
+ if ( !pUNOData )
+ pUNOData = ImplSmartCreateUNOData( pNewWindow );
+
+ ::com::sun::star::awt::VclContainerEvent aEvent;
+ aEvent.Source = (UsrObject*)pParentUNOData->GetWindowPeer();
+ aEvent.Id = VCLCOMPONENT_ADDED;
+ aEvent.Child = (UsrObject*)pUNOData->GetWindowPeer();
+
+ EventList* pLst = pParentUNOData->GetListeners( EL_CONTAINER );
+ for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * pRef = pLst->GetObject( n );
+ ((::com::sun::star::awt::XVclContainerListener*)(::com::sun::star::lang::XEventListener*)*pRef)->windowAdded( aEvent );
+ }
+ }
+}
+*/
+
+sal_Bool lcl_ImplIsParent( Window* pParentWindow, Window* pPossibleChild )
+{
+ Window* pWindow = ( pPossibleChild != pParentWindow ) ? pPossibleChild : NULL;
+ while ( pWindow && ( pWindow != pParentWindow ) )
+ pWindow = pWindow->GetParent();
+
+ return pWindow ? sal_True : sal_False;
+}
+
+void UnoWrapper::WindowDestroyed( Window* pWindow )
+{
+ // ggf. existieren noch von ::com::sun::star::loader::Java erzeugte Childs, die sonst erst
+ // im Garbage-Collector zerstoert werden...
+ Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+ while ( pChild )
+ {
+ Window* pNextChild = pChild->GetWindow( WINDOW_NEXT );
+
+ Window* pClient = pChild->GetWindow( WINDOW_CLIENT );
+ if ( pClient->GetWindowPeer() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( FALSE ), ::com::sun::star::uno::UNO_QUERY );
+ xComp->dispose();
+ }
+
+ pChild = pNextChild;
+ }
+
+ // ::com::sun::star::chaos::System-Windows suchen...
+ Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
+ pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP );
+ while ( pOverlap )
+ {
+ Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
+ Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT );
+
+ if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( FALSE ), ::com::sun::star::uno::UNO_QUERY );
+ xComp->dispose();
+ }
+
+ pOverlap = pNextOverlap;
+ }
+
+ Window* pParent = pWindow->GetParent();
+ if ( pParent && pParent->GetWindowPeer() )
+ pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
+
+ VCLXWindow* pWindowPeer = pWindow->GetWindowPeer();
+ uno::Reference< lang::XComponent > xWindowPeerComp( pWindow->GetComponentInterface( FALSE ), uno::UNO_QUERY );
+ OSL_ENSURE( ( pWindowPeer != NULL ) == ( xWindowPeerComp.is() == sal_True ),
+ "UnoWrapper::WindowDestroyed: inconsistency in the window's peers!" );
+ if ( pWindowPeer )
+ {
+ pWindowPeer->SetWindow( NULL );
+ pWindow->SetWindowPeer( NULL, NULL );
+ }
+ if ( xWindowPeerComp.is() )
+ xWindowPeerComp->dispose();
+
+ // #102132# Iterate over frames after setting Window peer to NULL,
+ // because while destroying other frames, we get get into the method again and try
+ // to destroy this window again...
+ // #i42462#/#116855# no, don't loop: Instead, just ensure that all our top-window-children
+ // are disposed, too (which should also be a valid fix for #102132#, but doesn't have the extreme
+ // performance penalties)
+ if ( pWindow )
+ {
+ Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
+ while ( pTopWindowChild )
+ {
+ OSL_ENSURE( pTopWindowChild->GetParent() == pWindow, "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
+
+ uno::Reference< lang::XComponent > xComp( pTopWindowChild->GetComponentInterface( FALSE ), uno::UNO_QUERY );
+ pTopWindowChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
+ if ( xComp.is() )
+ xComp->dispose();
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > UnoWrapper::CreateAccessible( Menu* pMenu, sal_Bool bIsMenuBar )
+{
+ return maAccessibleFactoryAccess.getFactory().createAccessible( pMenu, bIsMenuBar );
+}
diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx
new file mode 100644
index 000000000000..da91945c0b0e
--- /dev/null
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -0,0 +1,799 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+
+#include <tools/debug.hxx>
+#include <tools/stream.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/window.hxx>
+#include <com/sun/star/util/MeasureUnit.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XPointer.hpp>
+#include <com/sun/star/awt/SimpleFontMetric.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontWidth.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <com/sun/star/awt/MouseButton.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/embed/EmbedMapUnits.hpp>
+
+#include <com/sun/star/graphic/XGraphic.hpp>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <toolkit/awt/vclxbitmap.hxx>
+#include <toolkit/awt/vclxregion.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxgraphics.hxx>
+#include <toolkit/awt/vclxpointer.hxx>
+#include <toolkit/awt/vclxfont.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <toolkit/controls/unocontrolcontainermodel.hxx>
+
+#include <vcl/graph.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+
+using namespace ::com::sun::star;
+
+// ----------------------------------------------------
+// class VCLUnoHelper
+// ----------------------------------------------------
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> VCLUnoHelper::CreateToolkit()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString::createFromAscii( szServiceName2_Toolkit ) );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> xToolkit;
+ if ( xI.is() )
+ xToolkit = ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>( xI, ::com::sun::star::uno::UNO_QUERY );
+
+ return xToolkit;
+}
+
+BitmapEx VCLUnoHelper::GetBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>& rxBitmap )
+{
+ BitmapEx aBmp;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > xGraphic( rxBitmap, ::com::sun::star::uno::UNO_QUERY );
+ if( xGraphic.is() )
+ {
+ Graphic aGraphic( xGraphic );
+ aBmp = aGraphic.GetBitmapEx();
+ }
+ else if ( rxBitmap.is() )
+ {
+ VCLXBitmap* pVCLBitmap = VCLXBitmap::GetImplementation( rxBitmap );
+ if ( pVCLBitmap )
+ aBmp = pVCLBitmap->GetBitmap();
+ else
+ {
+ Bitmap aDIB, aMask;
+ {
+ ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getDIB();
+ SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
+ aMem >> aDIB;
+ }
+ {
+ ::com::sun::star::uno::Sequence<sal_Int8> aBytes = rxBitmap->getMaskDIB();
+ SvMemoryStream aMem( (char*) aBytes.getArray(), aBytes.getLength(), STREAM_READ );
+ aMem >> aMask;
+ }
+ aBmp = BitmapEx( aDIB, aMask );
+ }
+ }
+ return aBmp;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> VCLUnoHelper::CreateBitmap( const BitmapEx& rBitmap )
+{
+ Graphic aGraphic( rBitmap );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap> xBmp( aGraphic.GetXGraphic(), ::com::sun::star::uno::UNO_QUERY );
+ return xBmp;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Window* VCLUnoHelper::GetWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& rxWindow )
+{
+ VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( rxWindow );
+ return pVCLXWindow ? pVCLXWindow->GetWindow() : NULL;
+}
+
+Region VCLUnoHelper::GetRegion( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XRegion >& rxRegion )
+{
+ Region aRegion;
+ VCLXRegion* pVCLRegion = VCLXRegion::GetImplementation( rxRegion );
+ if ( pVCLRegion )
+ aRegion = pVCLRegion->GetRegion();
+ else
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::awt::Rectangle > aRects = rxRegion->getRectangles();
+ sal_Int32 nRects = aRects.getLength();
+ for ( sal_Int32 n = 0; n < nRects; n++ )
+ aRegion.Union( VCLRectangle( aRects.getArray()[n] ) );
+ }
+ return aRegion;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> VCLUnoHelper::GetInterface( Window* pWindow )
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > xWin;
+ if ( pWindow )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetComponentInterface();
+ xWin = xWin.query( xPeer );
+ }
+ return xWin;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> VCLUnoHelper::CreatePointer()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XPointer> xPointer = new VCLXPointer;
+ return xPointer;
+}
+
+OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice>& rxDevice )
+{
+ OutputDevice* pOutDev = NULL;
+ VCLXDevice* pDev = VCLXDevice::GetImplementation( rxDevice );
+ if ( pDev )
+ pOutDev = pDev->GetOutputDevice();
+ return pOutDev;
+}
+
+OutputDevice* VCLUnoHelper::GetOutputDevice( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics>& rxGraphics )
+{
+ OutputDevice* pOutDev = NULL;
+ VCLXGraphics* pGrf = VCLXGraphics::GetImplementation( rxGraphics );
+ if ( pGrf )
+ pOutDev = pGrf->GetOutputDevice();
+ return pOutDev;
+}
+
+Polygon VCLUnoHelper::CreatePolygon( const ::com::sun::star::uno::Sequence< sal_Int32 >& DataX, const ::com::sun::star::uno::Sequence< sal_Int32 >& DataY )
+{
+ sal_uInt32 nLen = DataX.getLength();
+ const sal_Int32* pDataX = DataX.getConstArray();
+ const sal_Int32* pDataY = DataY.getConstArray();
+ Polygon aPoly( (sal_uInt16) nLen );
+ for ( sal_uInt16 n = 0; n < nLen; n++ )
+ {
+ Point aPnt;
+ aPnt.X() = pDataX[n];
+ aPnt.Y() = pDataY[n];
+ aPoly[n] = aPnt;
+ }
+ return aPoly;
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer> VCLUnoHelper::CreateControlContainer( Window* pWindow )
+{
+ UnoControlContainer* pContainer = new UnoControlContainer( pWindow->GetComponentInterface( sal_True ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer;
+
+ UnoControlModel* pContainerModel = new UnoControlContainerModel;
+ pContainer->setModel( (::com::sun::star::awt::XControlModel*)pContainerModel );
+
+ return x;
+}
+
+float VCLUnoHelper::ConvertFontWidth( FontWidth eWidth )
+{
+ if( eWidth == WIDTH_DONTKNOW )
+ return ::com::sun::star::awt::FontWidth::DONTKNOW;
+ else if( eWidth == WIDTH_ULTRA_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::ULTRACONDENSED;
+ else if( eWidth == WIDTH_EXTRA_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::EXTRACONDENSED;
+ else if( eWidth == WIDTH_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::CONDENSED;
+ else if( eWidth == WIDTH_SEMI_CONDENSED )
+ return ::com::sun::star::awt::FontWidth::SEMICONDENSED;
+ else if( eWidth == WIDTH_NORMAL )
+ return ::com::sun::star::awt::FontWidth::NORMAL;
+ else if( eWidth == WIDTH_SEMI_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::SEMIEXPANDED;
+ else if( eWidth == WIDTH_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::EXPANDED;
+ else if( eWidth == WIDTH_EXTRA_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::EXTRAEXPANDED;
+ else if( eWidth == WIDTH_ULTRA_EXPANDED )
+ return ::com::sun::star::awt::FontWidth::ULTRAEXPANDED;
+
+ DBG_ERROR( "Unknown FontWidth" );
+ return ::com::sun::star::awt::FontWidth::DONTKNOW;
+}
+
+FontWidth VCLUnoHelper::ConvertFontWidth( float f )
+{
+ if( f <= ::com::sun::star::awt::FontWidth::DONTKNOW )
+ return WIDTH_DONTKNOW;
+ else if( f <= ::com::sun::star::awt::FontWidth::ULTRACONDENSED )
+ return WIDTH_ULTRA_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXTRACONDENSED )
+ return WIDTH_EXTRA_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::CONDENSED )
+ return WIDTH_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::SEMICONDENSED )
+ return WIDTH_SEMI_CONDENSED;
+ else if( f <= ::com::sun::star::awt::FontWidth::NORMAL )
+ return WIDTH_NORMAL;
+ else if( f <= ::com::sun::star::awt::FontWidth::SEMIEXPANDED )
+ return WIDTH_SEMI_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXPANDED )
+ return WIDTH_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::EXTRAEXPANDED )
+ return WIDTH_EXTRA_EXPANDED;
+ else if( f <= ::com::sun::star::awt::FontWidth::ULTRAEXPANDED )
+ return WIDTH_ULTRA_EXPANDED;
+
+ DBG_ERROR( "Unknown FontWidth" );
+ return WIDTH_DONTKNOW;
+}
+
+float VCLUnoHelper::ConvertFontWeight( FontWeight eWeight )
+{
+ if( eWeight == WEIGHT_DONTKNOW )
+ return ::com::sun::star::awt::FontWeight::DONTKNOW;
+ else if( eWeight == WEIGHT_THIN )
+ return ::com::sun::star::awt::FontWeight::THIN;
+ else if( eWeight == WEIGHT_ULTRALIGHT )
+ return ::com::sun::star::awt::FontWeight::ULTRALIGHT;
+ else if( eWeight == WEIGHT_LIGHT )
+ return ::com::sun::star::awt::FontWeight::LIGHT;
+ else if( eWeight == WEIGHT_SEMILIGHT )
+ return ::com::sun::star::awt::FontWeight::SEMILIGHT;
+ else if( ( eWeight == WEIGHT_NORMAL ) || ( eWeight == WEIGHT_MEDIUM ) )
+ return ::com::sun::star::awt::FontWeight::NORMAL;
+ else if( eWeight == WEIGHT_SEMIBOLD )
+ return ::com::sun::star::awt::FontWeight::SEMIBOLD;
+ else if( eWeight == WEIGHT_BOLD )
+ return ::com::sun::star::awt::FontWeight::BOLD;
+ else if( eWeight == WEIGHT_ULTRABOLD )
+ return ::com::sun::star::awt::FontWeight::ULTRABOLD;
+ else if( eWeight == WEIGHT_BLACK )
+ return ::com::sun::star::awt::FontWeight::BLACK;
+
+ DBG_ERROR( "Unknown FontWeigth" );
+ return ::com::sun::star::awt::FontWeight::DONTKNOW;
+}
+
+FontWeight VCLUnoHelper::ConvertFontWeight( float f )
+{
+ if( f <= ::com::sun::star::awt::FontWeight::DONTKNOW )
+ return WEIGHT_DONTKNOW;
+ else if( f <= ::com::sun::star::awt::FontWeight::THIN )
+ return WEIGHT_THIN;
+ else if( f <= ::com::sun::star::awt::FontWeight::ULTRALIGHT )
+ return WEIGHT_ULTRALIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::LIGHT )
+ return WEIGHT_LIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::SEMILIGHT )
+ return WEIGHT_SEMILIGHT;
+ else if( f <= ::com::sun::star::awt::FontWeight::NORMAL )
+ return WEIGHT_NORMAL;
+ else if( f <= ::com::sun::star::awt::FontWeight::SEMIBOLD )
+ return WEIGHT_SEMIBOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::BOLD )
+ return WEIGHT_BOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::ULTRABOLD )
+ return WEIGHT_ULTRABOLD;
+ else if( f <= ::com::sun::star::awt::FontWeight::BLACK )
+ return WEIGHT_BLACK;
+
+ DBG_ERROR( "Unknown FontWeigth" );
+ return WEIGHT_DONTKNOW;
+}
+
+
+::com::sun::star::awt::FontDescriptor VCLUnoHelper::CreateFontDescriptor( const Font& rFont )
+{
+ ::com::sun::star::awt::FontDescriptor aFD;
+ aFD.Name = rFont.GetName();
+ aFD.StyleName = rFont.GetStyleName();
+ aFD.Height = (sal_Int16)rFont.GetSize().Height();
+ aFD.Width = (sal_Int16)rFont.GetSize().Width();
+ aFD.Family = sal::static_int_cast< sal_Int16 >(rFont.GetFamily());
+ aFD.CharSet = rFont.GetCharSet();
+ aFD.Pitch = sal::static_int_cast< sal_Int16 >(rFont.GetPitch());
+ aFD.CharacterWidth = VCLUnoHelper::ConvertFontWidth( rFont.GetWidthType() );
+ aFD.Weight= VCLUnoHelper::ConvertFontWeight( rFont.GetWeight() );
+ aFD.Slant = (::com::sun::star::awt::FontSlant)rFont.GetItalic();
+ aFD.Underline = sal::static_int_cast< sal_Int16 >(rFont.GetUnderline());
+ aFD.Strikeout = sal::static_int_cast< sal_Int16 >(rFont.GetStrikeout());
+ aFD.Orientation = rFont.GetOrientation();
+ aFD.Kerning = rFont.IsKerning();
+ aFD.WordLineMode = rFont.IsWordLineMode();
+ aFD.Type = 0; // ??? => Nur an Metric...
+ return aFD;
+}
+
+Font VCLUnoHelper::CreateFont( const ::com::sun::star::awt::FontDescriptor& rDescr, const Font& rInitFont )
+{
+ Font aFont( rInitFont );
+ if ( rDescr.Name.getLength() )
+ aFont.SetName( rDescr.Name );
+ if ( rDescr.StyleName.getLength() )
+ aFont.SetStyleName( rDescr.StyleName );
+ if ( rDescr.Height )
+ aFont.SetSize( Size( rDescr.Width, rDescr.Height ) );
+ if ( (FontFamily)rDescr.Family != FAMILY_DONTKNOW )
+ aFont.SetFamily( (FontFamily)rDescr.Family );
+ if ( (CharSet)rDescr.CharSet != RTL_TEXTENCODING_DONTKNOW )
+ aFont.SetCharSet( (CharSet)rDescr.CharSet );
+ if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW )
+ aFont.SetPitch( (FontPitch)rDescr.Pitch );
+ if ( rDescr.CharacterWidth )
+ aFont.SetWidthType( VCLUnoHelper::ConvertFontWidth( rDescr.CharacterWidth ) );
+ if ( rDescr.Weight )
+ aFont.SetWeight( VCLUnoHelper::ConvertFontWeight( rDescr.Weight ) );
+ if ( (FontItalic)rDescr.Slant != ITALIC_DONTKNOW )
+ aFont.SetItalic( (FontItalic)rDescr.Slant );
+ if ( (FontUnderline)rDescr.Underline != UNDERLINE_DONTKNOW )
+ aFont.SetUnderline( (FontUnderline)rDescr.Underline );
+ if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW )
+ aFont.SetStrikeout( (FontStrikeout)rDescr.Strikeout );
+
+ // Kein DONTKNOW
+ aFont.SetOrientation( (short)rDescr.Orientation );
+ aFont.SetKerning( rDescr.Kerning );
+ aFont.SetWordLineMode( rDescr.WordLineMode );
+
+ return aFont;
+}
+
+Font VCLUnoHelper::CreateFont( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont >& rxFont )
+{
+ Font aFont;
+ VCLXFont* pVCLXFont = VCLXFont::GetImplementation( rxFont );
+ if ( pVCLXFont )
+ aFont = pVCLXFont->GetFont();
+ return aFont;
+}
+
+
+::com::sun::star::awt::SimpleFontMetric VCLUnoHelper::CreateFontMetric( const FontMetric& rFontMetric )
+{
+ ::com::sun::star::awt::SimpleFontMetric aFM;
+ aFM.Ascent = (sal_Int16)rFontMetric.GetAscent();
+ aFM.Descent = (sal_Int16)rFontMetric.GetDescent();
+ aFM.Leading = (sal_Int16)rFontMetric.GetIntLeading();
+ aFM.Slant = (sal_Int16)rFontMetric.GetSlant();
+ aFM.FirstChar = 0x0020;
+ aFM.LastChar = 0xFFFD;
+ return aFM;
+}
+
+sal_Bool VCLUnoHelper::IsZero( ::com::sun::star::awt::Rectangle rRect )
+{
+ return ( !rRect.X && !rRect.Y && !rRect.Width && !rRect.Height );
+}
+
+MapUnit VCLUnoHelper::UnoEmbed2VCLMapUnit( sal_Int32 nUnoEmbedMapUnit )
+{
+ switch( nUnoEmbedMapUnit )
+ {
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM:
+ return MAP_100TH_MM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM:
+ return MAP_10TH_MM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_MM:
+ return MAP_MM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_CM:
+ return MAP_CM;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH:
+ return MAP_1000TH_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH:
+ return MAP_100TH_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH:
+ return MAP_10TH_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::ONE_INCH:
+ return MAP_INCH;
+ case ::com::sun::star::embed::EmbedMapUnits::POINT:
+ return MAP_POINT;
+ case ::com::sun::star::embed::EmbedMapUnits::TWIP:
+ return MAP_TWIP;
+ case ::com::sun::star::embed::EmbedMapUnits::PIXEL:
+ return MAP_PIXEL;
+ }
+
+ OSL_ENSURE( sal_False, "Unexpected UNO map mode is provided!\n" );
+ return MAP_LASTENUMDUMMY;
+}
+
+sal_Int32 VCLUnoHelper::VCL2UnoEmbedMapUnit( MapUnit nVCLMapUnit )
+{
+ switch( nVCLMapUnit )
+ {
+ case MAP_100TH_MM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_MM;
+ case MAP_10TH_MM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_MM;
+ case MAP_MM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_MM;
+ case MAP_CM:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_CM;
+ case MAP_1000TH_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_1000TH_INCH;
+ case MAP_100TH_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_100TH_INCH;
+ case MAP_10TH_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_10TH_INCH;
+ case MAP_INCH:
+ return ::com::sun::star::embed::EmbedMapUnits::ONE_INCH;
+ case MAP_POINT:
+ return ::com::sun::star::embed::EmbedMapUnits::POINT;
+ case MAP_TWIP:
+ return ::com::sun::star::embed::EmbedMapUnits::TWIP;
+ case MAP_PIXEL:
+ return ::com::sun::star::embed::EmbedMapUnits::PIXEL;
+ default: ; // avoid compiler warning
+ }
+
+ OSL_ENSURE( sal_False, "Unexpected VCL map mode is provided!\n" );
+ return -1;
+}
+
+using namespace ::com::sun::star::util;
+
+//====================================================================
+//= file-local helpers
+//====================================================================
+namespace
+{
+ enum UnitConversionDirection
+ {
+ FieldUnitToMeasurementUnit,
+ MeasurementUnitToFieldUnit
+ };
+
+ sal_Int16 convertMeasurementUnit( sal_Int16 _nUnit, UnitConversionDirection eDirection, sal_Int16& _rFieldToUNOValueFactor )
+ {
+ static struct _unit_table
+ {
+ FieldUnit eFieldUnit;
+ sal_Int16 nMeasurementUnit;
+ sal_Int16 nFieldToMeasureFactor;
+ } aUnits[] = {
+ { FUNIT_NONE, -1 , -1},
+ { FUNIT_MM, MeasureUnit::MM, 1 }, // must precede MM_10TH
+ { FUNIT_MM, MeasureUnit::MM_10TH, 10 },
+ { FUNIT_100TH_MM, MeasureUnit::MM_100TH, 1 },
+ { FUNIT_CM, MeasureUnit::CM, 1 },
+ { FUNIT_M, MeasureUnit::M, 1 },
+ { FUNIT_KM, MeasureUnit::KM, 1 },
+ { FUNIT_TWIP, MeasureUnit::TWIP, 1 },
+ { FUNIT_POINT, MeasureUnit::POINT, 1 },
+ { FUNIT_PICA, MeasureUnit::PICA, 1 },
+ { FUNIT_INCH, MeasureUnit::INCH, 1 }, // must precede INCH_*TH
+ { FUNIT_INCH, MeasureUnit::INCH_10TH, 10 },
+ { FUNIT_INCH, MeasureUnit::INCH_100TH, 100 },
+ { FUNIT_INCH, MeasureUnit::INCH_1000TH, 1000 },
+ { FUNIT_FOOT, MeasureUnit::FOOT, 1 },
+ { FUNIT_MILE, MeasureUnit::MILE, 1 },
+ };
+ for ( size_t i = 0; i < sizeof( aUnits ) / sizeof( aUnits[0] ); ++i )
+ {
+ if ( eDirection == FieldUnitToMeasurementUnit )
+ {
+ if ( ( aUnits[ i ].eFieldUnit == (FieldUnit)_nUnit ) && ( aUnits[ i ].nFieldToMeasureFactor == _rFieldToUNOValueFactor ) )
+ return aUnits[ i ].nMeasurementUnit;
+ }
+ else
+ {
+ if ( aUnits[ i ].nMeasurementUnit == _nUnit )
+ {
+ _rFieldToUNOValueFactor = aUnits[ i ].nFieldToMeasureFactor;
+ return (sal_Int16)aUnits[ i ].eFieldUnit;
+ }
+ }
+ }
+ if ( eDirection == FieldUnitToMeasurementUnit )
+ return -1;
+
+ _rFieldToUNOValueFactor = 1;
+ return (sal_Int16)FUNIT_NONE;
+ }
+}
+//========================================================================
+//= MeasurementUnitConversion
+//========================================================================
+//------------------------------------------------------------------------
+sal_Int16 VCLUnoHelper::ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int16 _nUNOToFieldValueFactor )
+{
+ return convertMeasurementUnit( (sal_Int16)_nFieldUnit, FieldUnitToMeasurementUnit, _nUNOToFieldValueFactor );
+}
+
+//------------------------------------------------------------------------
+FieldUnit VCLUnoHelper::ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor )
+{
+ return (FieldUnit)convertMeasurementUnit( _nMeasurementUnit, MeasurementUnitToFieldUnit, _rFieldToUNOValueFactor );
+}
+
+
+MapUnit /* MapModeUnit */ VCLUnoHelper::ConvertToMapModeUnit(sal_Int16 /* com.sun.star.util.MeasureUnit.* */ _nMeasureUnit) throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ MapUnit eMode;
+ switch(_nMeasureUnit)
+ {
+ case com::sun::star::util::MeasureUnit::MM_100TH:
+ eMode = MAP_100TH_MM;
+ break;
+
+
+ case com::sun::star::util::MeasureUnit::MM_10TH:
+ eMode = MAP_10TH_MM;
+ break;
+
+ case com::sun::star::util::MeasureUnit::MM:
+ eMode = MAP_MM;
+ break;
+
+ case com::sun::star::util::MeasureUnit::CM:
+ eMode = MAP_CM;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH_1000TH:
+ eMode = MAP_1000TH_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH_100TH:
+ eMode = MAP_100TH_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH_10TH:
+ eMode = MAP_10TH_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::INCH:
+ eMode = MAP_INCH;
+ break;
+
+ case com::sun::star::util::MeasureUnit::POINT:
+ eMode = MAP_POINT;
+ break;
+
+ case com::sun::star::util::MeasureUnit::TWIP:
+ eMode = MAP_TWIP;
+ break;
+
+ case com::sun::star::util::MeasureUnit::PIXEL:
+ eMode = MAP_PIXEL;
+ break;
+
+/*
+ case com::sun::star::util::MeasureUnit::M:
+ break;
+ case com::sun::star::util::MeasureUnit::KM:
+ break;
+ case com::sun::star::util::MeasureUnit::PICA:
+ break;
+ case com::sun::star::util::MeasureUnit::FOOT:
+ break;
+ case com::sun::star::util::MeasureUnit::MILE:
+ break;
+ case com::sun::star::util::MeasureUnit::PERCENT:
+ break;
+*/
+ case com::sun::star::util::MeasureUnit::APPFONT:
+ eMode = MAP_APPFONT;
+ break;
+
+ case com::sun::star::util::MeasureUnit::SYSFONT:
+ eMode = MAP_SYSFONT;
+ break;
+
+/*
+ case com::sun::star::util::MeasureUnit::RELATIVE:
+ eMode = MAP_RELATIVE;
+ break;
+ case com::sun::star::util::MeasureUnit::REALAPPFONT:
+ eMode = MAP_REALAPPFONT;
+ break;
+*/
+
+ default:
+ throw ::com::sun::star::lang::IllegalArgumentException(::rtl::OUString::createFromAscii("Unsupported measure unit."), NULL, 1 );
+ }
+ return eMode;
+}
+
+sal_Int16 /* com.sun.star.util.MeasureUnit.* */ VCLUnoHelper::ConvertToMeasurementUnit(MapUnit /* MapModeUnit */ _eMapModeUnit) throw (::com::sun::star::lang::IllegalArgumentException)
+{
+ sal_Int16 nMeasureUnit = 0;
+ switch (_eMapModeUnit)
+ {
+ case MAP_100TH_MM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::MM_100TH;
+ break;
+
+ case MAP_10TH_MM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::MM_10TH;
+ break;
+
+ case MAP_MM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::MM;
+ break;
+
+ case MAP_CM:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::CM;
+ break;
+
+ case MAP_1000TH_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_1000TH;
+ break;
+
+ case MAP_100TH_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_100TH;
+ break;
+
+ case MAP_10TH_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH_10TH;
+ break;
+
+ case MAP_INCH:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::INCH;
+ break;
+
+ case MAP_POINT:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::POINT;
+ break;
+
+ case MAP_TWIP:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::TWIP;
+ break;
+
+ case MAP_PIXEL:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::PIXEL;
+ break;
+
+ case MAP_APPFONT:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::APPFONT;
+ break;
+
+ case MAP_SYSFONT:
+ nMeasureUnit = com::sun::star::util::MeasureUnit::SYSFONT;
+ break;
+
+/*
+ case MAP_RELATIVE:
+ break;
+
+ case MAP_REALAPPFONT:
+ break;
+*/
+ default:
+ throw ::com::sun::star::lang::IllegalArgumentException(::rtl::OUString::createFromAscii("Unsupported MapMode unit."), NULL, 1 );
+ }
+ return nMeasureUnit;
+}
+
+::Size VCLUnoHelper::ConvertToVCLSize(com::sun::star::awt::Size const& _aSize)
+{
+ ::Size aVCLSize(_aSize.Width, _aSize.Height);
+ return aVCLSize;
+}
+
+com::sun::star::awt::Size VCLUnoHelper::ConvertToAWTSize(::Size /* VCLSize */ const& _aSize)
+{
+ com::sun::star::awt::Size aAWTSize(_aSize.Width(), _aSize.Height());
+ return aAWTSize;
+}
+
+
+::Point VCLUnoHelper::ConvertToVCLPoint(com::sun::star::awt::Point const& _aPoint)
+{
+ ::Point aVCLPoint(_aPoint.X, _aPoint.Y);
+ return aVCLPoint;
+}
+
+com::sun::star::awt::Point VCLUnoHelper::ConvertToAWTPoint(::Point /* VCLPoint */ const& _aPoint)
+{
+ com::sun::star::awt::Point aAWTPoint(_aPoint.X(), _aPoint.Y());
+ return aAWTPoint;
+}
+
+::Rectangle VCLUnoHelper::ConvertToVCLRect( ::com::sun::star::awt::Rectangle const & _rRect )
+{
+ return ::Rectangle( _rRect.X, _rRect.Y, _rRect.X + _rRect.Width - 1, _rRect.Y + _rRect.Height - 1 );
+}
+
+::com::sun::star::awt::Rectangle VCLUnoHelper::ConvertToAWTRect( ::Rectangle const & _rRect )
+{
+ return ::com::sun::star::awt::Rectangle( _rRect.Left(), _rRect.Top(), _rRect.GetWidth(), _rRect.GetHeight() );
+}
+
+awt::MouseEvent VCLUnoHelper::createMouseEvent( const ::MouseEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
+{
+ awt::MouseEvent aMouseEvent;
+ aMouseEvent.Source = _rxContext;
+
+ aMouseEvent.Modifiers = 0;
+ if ( _rVclEvent.IsShift() )
+ aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::SHIFT;
+ if ( _rVclEvent.IsMod1() )
+ aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD1;
+ if ( _rVclEvent.IsMod2() )
+ aMouseEvent.Modifiers |= ::com::sun::star::awt::KeyModifier::MOD2;
+
+ aMouseEvent.Buttons = 0;
+ if ( _rVclEvent.IsLeft() )
+ aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::LEFT;
+ if ( _rVclEvent.IsRight() )
+ aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::RIGHT;
+ if ( _rVclEvent.IsMiddle() )
+ aMouseEvent.Buttons |= ::com::sun::star::awt::MouseButton::MIDDLE;
+
+ aMouseEvent.X = _rVclEvent.GetPosPixel().X();
+ aMouseEvent.Y = _rVclEvent.GetPosPixel().Y();
+ aMouseEvent.ClickCount = _rVclEvent.GetClicks();
+ aMouseEvent.PopupTrigger = sal_False;
+
+ return aMouseEvent;
+}
+
+awt::KeyEvent VCLUnoHelper::createKeyEvent( const ::KeyEvent& _rVclEvent, const uno::Reference< uno::XInterface >& _rxContext )
+{
+ awt::KeyEvent aKeyEvent;
+ aKeyEvent.Source = _rxContext;
+
+ aKeyEvent.Modifiers = 0;
+ if ( _rVclEvent.GetKeyCode().IsShift() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::SHIFT;
+ if ( _rVclEvent.GetKeyCode().IsMod1() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::MOD1;
+ if ( _rVclEvent.GetKeyCode().IsMod2() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::MOD2;
+ if ( _rVclEvent.GetKeyCode().IsMod3() )
+ aKeyEvent.Modifiers |= awt::KeyModifier::MOD3;
+
+ aKeyEvent.KeyCode = _rVclEvent.GetKeyCode().GetCode();
+ aKeyEvent.KeyChar = _rVclEvent.GetCharCode();
+ aKeyEvent.KeyFunc = ::sal::static_int_cast< sal_Int16 >( _rVclEvent.GetKeyCode().GetFunction());
+
+ return aKeyEvent;
+}
diff --git a/toolkit/source/layout/core/bin.cxx b/toolkit/source/layout/core/bin.cxx
new file mode 100644
index 000000000000..0f0719f12bbd
--- /dev/null
+++ b/toolkit/source/layout/core/bin.cxx
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "bin.hxx"
+
+#include <sal/macros.h>
+
+namespace layoutimpl
+{
+
+using namespace css;
+
+/* Bin */
+
+Bin::Bin() : Container()
+{
+}
+
+void SAL_CALL
+Bin::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
+ throw (uno::RuntimeException, awt::MaxChildrenException)
+{
+ if ( mxChild.is() )
+ throw awt::MaxChildrenException();
+ if ( xChild.is() )
+ {
+ mxChild = xChild;
+ setChildParent( xChild );
+ queueResize();
+ }
+}
+
+void SAL_CALL
+Bin::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
+ throw (uno::RuntimeException)
+{
+ if ( xChild == mxChild )
+ {
+ mxChild = uno::Reference< awt::XLayoutConstrains >();
+ unsetChildParent( xChild );
+ queueResize();
+ }
+}
+
+uno::Sequence< uno::Reference< awt::XLayoutConstrains > > SAL_CALL
+Bin::getChildren()
+ throw (uno::RuntimeException)
+{
+ return getSingleChild (mxChild);
+}
+
+void SAL_CALL
+Bin::allocateArea( const awt::Rectangle &rArea )
+ throw (uno::RuntimeException)
+{
+ maAllocation = rArea;
+ if ( mxChild.is() )
+ allocateChildAt( mxChild, rArea );
+}
+
+awt::Size SAL_CALL
+Bin::getMinimumSize()
+ throw(uno::RuntimeException)
+{
+ if ( mxChild.is() )
+ return maRequisition = maChildRequisition = mxChild->getMinimumSize();
+ return maRequisition = awt::Size( 0, 0 );
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL
+Bin::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& )
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< beans::XPropertySet >();
+}
+
+sal_Bool SAL_CALL
+Bin::hasHeightForWidth()
+ throw(uno::RuntimeException)
+{
+ uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
+ if ( xChildCont.is() )
+ return xChildCont->hasHeightForWidth();
+ return false;
+}
+
+sal_Int32 SAL_CALL
+Bin::getHeightForWidth( sal_Int32 nWidth )
+ throw(uno::RuntimeException)
+{
+ uno::Reference< awt::XLayoutContainer > xChildCont( mxChild, uno::UNO_QUERY );
+ if ( xChildCont.is() )
+ return xChildCont->getHeightForWidth( nWidth );
+ return maRequisition.Height;
+}
+
+/* Align */
+
+Align::Align() : Bin()
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Halign" ),
+ ::getCppuType( static_cast< const float* >( NULL ) ),
+ &fHorAlign );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Valign" ),
+ ::getCppuType( static_cast< const float* >( NULL ) ),
+ &fVerAlign );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Hfill" ),
+ ::getCppuType( static_cast< const float* >( NULL ) ),
+ &fHorFill );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Vfill" ),
+ ::getCppuType( static_cast< const float* >( NULL ) ),
+ &fVerFill );
+
+ fHorAlign = fVerAlign = 0.5;
+ fHorFill = fVerFill = 0;
+}
+
+void SAL_CALL
+Align::allocateArea( const awt::Rectangle &rArea )
+ throw (uno::RuntimeException)
+{
+ maAllocation = rArea;
+ if ( !mxChild.is() )
+ return;
+
+ awt::Rectangle aChildArea;
+ aChildArea.Width = SAL_MIN( rArea.Width, maChildRequisition.Width );
+ aChildArea.Width += (sal_Int32) SAL_MAX(
+ 0, (rArea.Width - maChildRequisition.Width) * fHorFill );
+ aChildArea.Height = SAL_MIN( rArea.Height, maChildRequisition.Height );
+ aChildArea.Height += (sal_Int32) SAL_MAX(
+ 0, (rArea.Height - maChildRequisition.Height) * fVerFill );
+
+ aChildArea.X = rArea.X + (sal_Int32)( (rArea.Width - aChildArea.Width) * fHorAlign );
+ aChildArea.Y = rArea.Y + (sal_Int32)( (rArea.Height - aChildArea.Height) * fVerAlign );
+
+ allocateChildAt( mxChild, aChildArea );
+}
+
+bool
+Align::emptyVisible ()
+{
+ return true;
+}
+
+/* MinSize */
+
+MinSize::MinSize() : Bin()
+{
+ mnMinWidth = mnMinHeight = 0;
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "MinWidth" ),
+ ::getCppuType( static_cast< const long* >( NULL ) ),
+ &mnMinWidth );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "MinHeight" ),
+ ::getCppuType( static_cast< const long* >( NULL ) ),
+ &mnMinHeight );
+}
+
+bool
+MinSize::emptyVisible ()
+{
+ return true;
+}
+
+awt::Size SAL_CALL MinSize::getMinimumSize()
+ throw(uno::RuntimeException)
+{
+ Bin::getMinimumSize();
+ maRequisition.Width = SAL_MAX( maRequisition.Width, mnMinWidth );
+ maRequisition.Height = SAL_MAX( maRequisition.Height, mnMinHeight );
+ return maRequisition;
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/bin.hxx b/toolkit/source/layout/core/bin.hxx
new file mode 100644
index 000000000000..554f6f1bbcf9
--- /dev/null
+++ b/toolkit/source/layout/core/bin.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.
+ *
+ ************************************************************************/
+
+/* A few simple binary containers */
+
+#ifndef LAYOUT_CORE_BIN_HXX
+#define LAYOUT_CORE_BIN_HXX
+
+#include <layout/core/container.hxx>
+
+namespace layoutimpl
+{
+
+class Bin : public Container
+{
+protected:
+ // Child
+ css::awt::Size maChildRequisition;
+ css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
+
+public:
+ Bin();
+ virtual ~Bin() {}
+
+ // css::awt::XLayoutContainer
+ virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
+ virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< css::uno::Reference
+ < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
+ const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL hasHeightForWidth()
+ throw(css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
+ throw(css::uno::RuntimeException);
+
+ // css::awt::XLayoutConstrains
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException);
+};
+
+// Align gives control over child position on the allocated space.
+class Align : public Bin
+{
+ friend class AlignChildProps;
+protected:
+ // properties
+ float fHorAlign, fVerAlign;
+ float fHorFill, fVerFill;
+
+public:
+ Align();
+
+ bool emptyVisible ();
+
+ // css::awt::XLayoutContainer
+ virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException);
+};
+
+// Makes child request its or a specified size, whatever is larger.
+class MinSize : public Bin
+{
+protected:
+ // properties
+ long mnMinWidth, mnMinHeight;
+
+public:
+ MinSize();
+
+ bool emptyVisible ();
+ // css::awt::XLayoutContainer
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException);
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_BIN_HXX */
diff --git a/toolkit/source/layout/core/box-base.cxx b/toolkit/source/layout/core/box-base.cxx
new file mode 100644
index 000000000000..dbe9163e2117
--- /dev/null
+++ b/toolkit/source/layout/core/box-base.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.
+ *
+ ************************************************************************/
+
+#include "box.hxx"
+
+#include <tools/debug.hxx>
+#include <sal/macros.h>
+
+#include <com/sun/star/awt/XWindow2.hpp>
+
+// fixed point precision for distributing error
+#define FIXED_PT 16
+
+namespace layoutimpl
+{
+
+using namespace css;
+
+Box_Base::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ : mxChild( xChild )
+ , mxProps()
+ , maRequisition()
+{
+}
+
+static bool isVisible( uno::Reference< awt::XLayoutConstrains > xWidget )
+{
+ if ( !xWidget.is() )
+ {
+ DBG_ERROR( "FIXME: invalid child !" );
+ return true;
+ }
+
+ uno::Reference< awt::XWindow2 > xWindow( xWidget, uno::UNO_QUERY );
+ if ( xWindow.is() && !xWindow->isVisible() )
+ return false;
+
+ uno::Reference< awt::XLayoutContainer > xContainer( xWidget, uno::UNO_QUERY );
+ if ( xContainer.is() )
+ {
+ uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren
+ = xContainer->getChildren();
+
+ if (!aChildren.getLength ())
+ if (Container *c = dynamic_cast <Container*> (xWidget.get ()))
+ return c->emptyVisible ();
+
+ for ( int i = 0; i < aChildren.getLength(); i++ )
+ if ( isVisible( aChildren[i] ) )
+ return true;
+ return false; // this would kill flow without workaround above
+ }
+
+ return true;
+}
+
+bool Box_Base::ChildData::isVisible()
+{
+ // FIXME: call the 'isVisible' method on it ?
+ return layoutimpl::isVisible( mxChild );
+}
+
+void
+Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
+{
+ ChildData *pData = createChild (xChild);
+ maChildren.push_back (pData);
+ queueResize ();
+}
+
+void SAL_CALL
+Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> const& xChild)
+ throw (uno::RuntimeException, awt::MaxChildrenException)
+{
+ if (xChild.is ())
+ {
+ AddChild (xChild);
+ setChildParent (xChild);
+ }
+}
+
+Box_Base::ChildData*
+Box_Base::removeChildData( std::list< ChildData* > lst, css::uno::Reference< css::awt::XLayoutConstrains > const& xChild )
+{
+ for ( std::list< ChildData* >::iterator it = lst.begin();
+ it != lst.end(); it++ )
+ {
+ if ( (*it)->mxChild == xChild )
+ {
+ lst.erase( it );
+ return *it;
+ }
+ }
+ return 0;
+}
+
+void SAL_CALL
+Box_Base::removeChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
+ throw (uno::RuntimeException)
+{
+ if ( ChildData* p = removeChildData( maChildren, xChild ) )
+ {
+ delete p;
+ unsetChildParent( xChild );
+ queueResize();
+ }
+ else
+ {
+ DBG_ERROR( "Box_Base: removeChild: no such child" );
+ }
+}
+
+uno::Sequence< uno::Reference < awt::XLayoutConstrains > > SAL_CALL
+Box_Base::getChildren()
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
+ unsigned int index = 0;
+ for ( std::list< ChildData* >::iterator it = maChildren.begin();
+ it != maChildren.end(); it++, index++ )
+ children[index] = ( *it )->mxChild;
+
+ return children;
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL
+Box_Base::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& xChild )
+ throw (uno::RuntimeException)
+{
+
+ for ( std::list< ChildData * >::iterator it = maChildren.begin();
+ it != maChildren.end(); it++)
+ {
+ if ( ( *it )->mxChild == xChild )
+ {
+ if ( !( *it )->mxProps.is() )
+ {
+ PropHelper *pProps = createChildProps( *it );
+ pProps->setChangeListener( this );
+ ( *it )->mxProps = pProps;
+ }
+ return (*it)->mxProps;
+ }
+ }
+ return uno::Reference< beans::XPropertySet >();
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/box-base.hxx b/toolkit/source/layout/core/box-base.hxx
new file mode 100644
index 000000000000..4f50f55bf5c4
--- /dev/null
+++ b/toolkit/source/layout/core/box-base.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 LAYOUT_CORE_BOX_BASE_HXX
+#define LAYOUT_CORE_BOX_BASE_HXX
+
+#include <layout/core/container.hxx>
+
+#include <list>
+
+namespace layoutimpl
+{
+
+class Box_Base : public Container
+{
+public:
+ // Children properties
+ struct ChildData
+ {
+ css::uno::Reference< css::awt::XLayoutConstrains > mxChild;
+ css::uno::Reference< css::beans::XPropertySet > mxProps;
+ css::awt::Size maRequisition;
+ virtual bool isVisible();
+
+ ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ virtual ~ChildData() { };
+ };
+
+ struct ChildProps: public PropHelper
+ {
+ //ChildProps( ChildProps* );
+ };
+
+protected:
+ std::list< ChildData* > maChildren;
+
+
+ virtual ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) = 0;
+ virtual ChildProps *createChildProps( ChildData* pData ) = 0;
+
+ ChildData *removeChildData( std::list< ChildData *>, css::uno::Reference< css::awt::XLayoutConstrains > const& Child );
+
+public:
+ void AddChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child);
+
+ // css::awt::XLayoutContainer
+ virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child)
+ throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
+ virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< css::uno::Reference
+ < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
+ const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException);
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_BOX_BASE HXX */
diff --git a/toolkit/source/layout/core/box.cxx b/toolkit/source/layout/core/box.cxx
new file mode 100644
index 000000000000..a173bb5b7633
--- /dev/null
+++ b/toolkit/source/layout/core/box.cxx
@@ -0,0 +1,281 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "box.hxx"
+
+#include <tools/debug.hxx>
+#include <sal/macros.h>
+
+// fixed point precision for distributing error
+#define FIXED_PT 16
+
+namespace layoutimpl
+{
+
+using namespace css;
+
+Box::ChildProps::ChildProps( Box::ChildData *pData )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Expand" ),
+ ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
+ &(pData->mbExpand) );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Fill" ),
+ ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
+ &(pData->mbFill) );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Padding" ),
+ ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
+ &(pData->mnPadding) );
+}
+
+Box::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ : Box_Base::ChildData( xChild )
+ , mnPadding( 0 )
+ , mbExpand( true )
+ , mbFill( true )
+{
+}
+
+Box::ChildData*
+Box::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ {
+ return new ChildData( xChild );
+ }
+
+Box::ChildProps*
+Box::createChildProps( Box_Base::ChildData *pData )
+{
+ return new ChildProps( static_cast<Box::ChildData*> ( pData ) );
+}
+
+Box::Box( bool horizontal )
+ : Box_Base()
+ , mnSpacing( 0 )
+ , mbHomogeneous( false )
+ , mbHorizontal( horizontal )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
+ ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
+ &mbHomogeneous );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
+ ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
+ &mnSpacing );
+ mbHasFlowChildren = false;
+}
+
+awt::Size
+Box::calculateSize( long nWidth )
+{
+ int nVisibleChildren = 0;
+ // primary vs secundary axis (instead of a X and Y)
+ int nPrimSize = 0;
+ int nSecSize = 0;
+ int nFlowMinWidth = 0; // in case the box only has flow children
+
+ mbHasFlowChildren = false;
+
+ for ( std::list<Box_Base::ChildData *>::const_iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Box::ChildData*> ( *it );
+ if ( !child->isVisible() )
+ continue;
+
+ uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
+ bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
+
+ awt::Size aChildSize = child->maRequisition = child->mxChild->getMinimumSize();
+
+ if ( !mbHorizontal /*vertical*/ && bFlow )
+ {
+ if ( nFlowMinWidth == 0 || nFlowMinWidth > aChildSize.Width )
+ nFlowMinWidth = aChildSize.Width;
+ mbHasFlowChildren = true;
+ }
+ else
+ {
+ int size = primDim( aChildSize ) + child->mnPadding * 2;
+ if ( mbHomogeneous )
+ nPrimSize = SAL_MAX( nPrimSize, size );
+ else
+ nPrimSize += size;
+
+ nSecSize = SAL_MAX( nSecSize, secDim( aChildSize ) );
+ }
+ nVisibleChildren++;
+ }
+
+ if ( nVisibleChildren )
+ {
+ if ( mbHomogeneous )
+ nPrimSize *= nVisibleChildren;
+ nPrimSize += (nVisibleChildren - 1) * mnSpacing;
+ }
+
+ if ( mbHasFlowChildren )
+ {
+ if ( nWidth == 0 )
+ nWidth = nSecSize ? nSecSize : nFlowMinWidth;
+ for ( std::list<Box_Base::ChildData *>::const_iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Box::ChildData*> ( *it );
+ if ( !child->isVisible() )
+ continue;
+
+ uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
+ bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
+
+ if ( bFlow )
+ nPrimSize += xChildCont->getHeightForWidth( nWidth );
+ }
+ }
+
+ nPrimSize += mnBorderWidth * 2;
+ nSecSize += mnBorderWidth * 2;
+ return awt::Size( mbHorizontal ? nPrimSize : nSecSize,
+ mbHorizontal ? nSecSize : nPrimSize );
+}
+
+awt::Size SAL_CALL
+Box::getMinimumSize() throw(uno::RuntimeException)
+{
+ maRequisition = calculateSize();
+ return maRequisition;
+}
+
+sal_Bool SAL_CALL
+Box::hasHeightForWidth()
+ throw(uno::RuntimeException)
+{
+ return mbHasFlowChildren;
+}
+
+sal_Int32 SAL_CALL
+Box::getHeightForWidth( sal_Int32 nWidth )
+ throw(uno::RuntimeException)
+{
+ if ( hasHeightForWidth() )
+ return calculateSize( nWidth ).Height;
+ return maRequisition.Height;
+}
+
+void SAL_CALL
+Box::allocateArea( const awt::Rectangle &newArea )
+ throw (uno::RuntimeException)
+{
+ maAllocation = newArea;
+ int nVisibleChildren = 0, nExpandChildren = 0;
+
+ for ( std::list<Box_Base::ChildData *>::const_iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Box::ChildData*> ( *it );
+ if ( child->isVisible() )
+ {
+ nVisibleChildren++;
+ if ( child->mbExpand )
+ nExpandChildren++;
+ }
+ }
+ if ( !nVisibleChildren )
+ return;
+
+ // split rectangle for dimension helpers
+ awt::Point newPoint( newArea.X, newArea.Y );
+ awt::Size newSize( newArea.Width, newArea.Height );
+
+ int nExtraSpace;
+ if ( mbHomogeneous )
+ nExtraSpace = ( ( primDim( newSize ) - mnBorderWidth * 2 -
+ ( nVisibleChildren - 1 ) * mnSpacing )) / nVisibleChildren;
+ else if ( nExpandChildren )
+ {
+ int reqSize = primDim( maRequisition );
+ if ( !mbHorizontal && hasHeightForWidth() )
+ reqSize = getHeightForWidth( newArea.Width );
+ nExtraSpace = ( primDim( newSize ) - reqSize ) / nExpandChildren;
+ }
+ else
+ nExtraSpace = 0;
+
+ int nChildPrimPoint, nChildSecPoint, nChildPrimSize, nChildSecSize;
+
+ int nStartPoint = primDim( newPoint ) + mnBorderWidth;
+ int nBoxSecSize = SAL_MAX( 1, secDim( newSize ) - mnBorderWidth * 2 );
+
+ for ( std::list<Box_Base::ChildData *>::const_iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Box::ChildData*> ( *it );
+ if ( !child->isVisible() )
+ continue;
+
+ awt::Point aChildPos;
+ int nBoxPrimSize; // of the available box space
+
+ if ( mbHomogeneous )
+ nBoxPrimSize = nExtraSpace;
+ else
+ {
+ uno::Reference< awt::XLayoutContainer > xChildCont( child->mxChild, uno::UNO_QUERY );
+ bool bFlow = xChildCont.is() && xChildCont->hasHeightForWidth();
+ if ( !mbHorizontal && bFlow )
+ nBoxPrimSize = xChildCont->getHeightForWidth( newArea.Width );
+ else
+ nBoxPrimSize = primDim( child->maRequisition );
+ nBoxPrimSize += child->mnPadding;
+ if ( child->mbExpand )
+ nBoxPrimSize += nExtraSpace;
+ }
+
+ nChildPrimPoint = nStartPoint + child->mnPadding;
+ nChildSecPoint = secDim( newPoint ) + mnBorderWidth;
+
+ nChildSecSize = nBoxSecSize;
+ if ( child->mbFill )
+ nChildPrimSize = SAL_MAX( 1, nBoxPrimSize - child->mnPadding);
+ else
+ {
+ nChildPrimSize = primDim( child->maRequisition );
+ nChildPrimPoint += (nBoxPrimSize - nChildPrimSize) / 2;
+
+ nChildSecPoint += (nBoxSecSize - nChildSecSize) / 2;
+ }
+
+ awt::Rectangle area;
+ area.X = mbHorizontal ? nChildPrimPoint : nChildSecPoint;
+ area.Y = mbHorizontal ? nChildSecPoint : nChildPrimPoint;
+ area.Width = mbHorizontal ? nChildPrimSize : nChildSecSize;
+ area.Height = mbHorizontal ? nChildSecSize : nChildPrimSize;
+
+ allocateChildAt( child->mxChild, area );
+
+ nStartPoint += nBoxPrimSize + mnSpacing + child->mnPadding;
+ }
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/box.hxx b/toolkit/source/layout/core/box.hxx
new file mode 100644
index 000000000000..9e4652a37b2f
--- /dev/null
+++ b/toolkit/source/layout/core/box.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 LAYOUT_CORE_BOX_HXX
+#define LAYOUT_CORE_BOX_HXX
+
+#include <layout/core/box-base.hxx>
+
+#include <com/sun/star/awt/Point.hpp>
+
+namespace layoutimpl
+{
+
+class Box : public Box_Base
+{
+protected:
+ // Box properties (i.e. affect all children)
+ sal_Int32 mnSpacing;
+ sal_Bool mbHomogeneous;
+ sal_Bool mbHorizontal; // false for Vertical
+ bool mbHasFlowChildren;
+
+public:
+ // Children properties
+ struct ChildData : public Box_Base::ChildData
+ {
+ sal_Int32 mnPadding;
+ sal_Bool mbExpand;
+ sal_Bool mbFill;
+ ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ };
+
+ struct ChildProps : public Box_Base::ChildProps
+ {
+ ChildProps( ChildData *pData );
+ };
+
+protected:
+ ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ ChildProps *createChildProps( Box_Base::ChildData* pData );
+
+public:
+ Box( bool horizontal );
+
+ virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException);
+
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasHeightForWidth()
+ throw(css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
+ throw(css::uno::RuntimeException);
+
+ // helper: mix of getMinimumSize() and getHeightForWidth()
+ css::awt::Size calculateSize( long nWidth = 0 );
+
+private:
+ /* Helpers to deal with the joint Box directions. */
+ inline int primDim (const css::awt::Size &size)
+ { if (mbHorizontal) return size.Width; else return size.Height; }
+ inline int secDim (const css::awt::Size &size)
+ { if (mbHorizontal) return size.Height; else return size.Width; }
+ inline int primDim (const css::awt::Point &point)
+ { if (mbHorizontal) return point.X; else return point.Y; }
+ inline int secDim (const css::awt::Point &point)
+ { if (mbHorizontal) return point.Y; else return point.X; }
+};
+
+struct VBox : public Box
+{ VBox() : Box (false) {} };
+
+struct HBox : public Box
+{ HBox() : Box (true) {} };
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_BOX_HXX */
diff --git a/toolkit/source/layout/core/byteseq.cxx b/toolkit/source/layout/core/byteseq.cxx
new file mode 100644
index 000000000000..b49297d8b1c9
--- /dev/null
+++ b/toolkit/source/layout/core/byteseq.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include <com/sun/star/io/XInputStream.hpp>
+#include <osl/file.hxx>
+#include <comphelper/oslfile2streamwrap.hxx>
+
+using osl::File;
+using osl::FileBase;
+using namespace ::com::sun::star;
+
+namespace layoutimpl
+{
+
+uno::Reference< io::XInputStream > getFileAsStream( const rtl::OUString &rName )
+{
+ rtl::OUString sFileURL;
+ if( FileBase::E_None != FileBase::getFileURLFromSystemPath( rName, sFileURL ) )
+ sFileURL = rName; // maybe it already was a file url
+
+ File * blobFile = new File(sFileURL);
+ File::RC errorCode = blobFile->open(OpenFlag_Read);
+
+ uno::Reference<io::XInputStream> xResult;
+ switch (errorCode)
+ {
+ case osl::File::E_None: // got it
+ xResult.set( new comphelper::OSLInputStreamWrapper(blobFile,true) );
+ break;
+
+ case osl::File::E_NOENT: // no file => no stream
+ delete blobFile;
+ break;
+
+ default:
+ delete blobFile;
+/* {
+ rtl::OUStringBuffer sMsg;
+ sMsg.appendAscii("Cannot open output file \"");
+ sMsg.append(aURL);
+ sMsg.appendAscii("\" : ");
+ sMsg.append(configmgr::FileHelper::createOSLErrorString(errorCode));
+
+ throw io::IOException(sMsg.makeStringAndClear(),NULL);
+ }
+*/
+ }
+
+ return xResult;
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/container.cxx b/toolkit/source/layout/core/container.cxx
new file mode 100644
index 000000000000..43f837f32de5
--- /dev/null
+++ b/toolkit/source/layout/core/container.cxx
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "container.hxx"
+
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <tools/debug.hxx>
+
+namespace layoutimpl {
+
+using namespace css;
+
+Container::Container()
+ : Container_Base()
+ , PropHelper()
+ , mnBorderWidth( 0 )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Border" ),
+ ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
+ &mnBorderWidth );
+ setChangeListener( this );
+}
+
+bool
+Container::emptyVisible ()
+{
+ return false;
+}
+
+uno::Any
+Container::queryInterface( const uno::Type & rType ) throw (uno::RuntimeException)
+{
+ uno::Any aRet = Container_Base::queryInterface( rType );
+ return aRet.hasValue() ? aRet : PropHelper::queryInterface( rType );
+}
+
+void
+Container::allocateChildAt( const uno::Reference< awt::XLayoutConstrains > &xChild,
+ const awt::Rectangle &rArea )
+ throw( uno::RuntimeException )
+{
+ uno::Reference< awt::XLayoutContainer > xCont( xChild, uno::UNO_QUERY );
+ if ( xCont.is() )
+ xCont->allocateArea( rArea );
+ else
+ {
+ uno::Reference< awt::XWindow > xWindow( xChild, uno::UNO_QUERY );
+ if ( xWindow.is() )
+ xWindow->setPosSize( rArea.X, rArea.Y, rArea.Width, rArea.Height,
+ awt::PosSize::POSSIZE );
+ else
+ {
+ DBG_ERROR( "Error: non-sizeable child" );
+ }
+ }
+}
+
+uno::Sequence< uno::Reference< awt::XLayoutConstrains > >
+Container::getSingleChild ( uno::Reference< awt::XLayoutConstrains >const &xChildOrNil )
+{
+ uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aSeq( ( xChildOrNil.is() ? 1 : 0 ) );
+ if ( xChildOrNil.is() )
+ aSeq[0] = xChildOrNil;
+ return aSeq;
+}
+
+void
+Container::queueResize()
+{
+ if ( mxLayoutUnit.is() )
+ mxLayoutUnit->queueResize( uno::Reference< awt::XLayoutContainer >( this ) );
+}
+
+void
+Container::setChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
+{
+ uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
+ if ( xContChild.is() )
+ {
+ xContChild->setParent( uno::Reference< awt::XLayoutContainer >( this ) );
+#if 0
+ assert( !mxLayoutUnit.is() );
+ xContChild->setLayoutUnit( mxLayoutUnit );
+#endif
+ }
+}
+
+void
+Container::unsetChildParent( const uno::Reference< awt::XLayoutConstrains >& xChild )
+{
+ uno::Reference< awt::XLayoutContainer > xContChild( xChild, uno::UNO_QUERY );
+ if ( xContChild.is() )
+ {
+ xContChild->setParent( uno::Reference< awt::XLayoutContainer >() );
+#if 0
+ xContChild->setLayoutUnit( uno::Reference< awt::XLayoutUnit >() );
+#endif
+ }
+}
+
+#if 0
+std::string
+Container::getLabel() // debug label
+{
+ std::string depth;
+ uno::Reference< awt::XLayoutContainer > xContainer( this );
+ while ( xContainer.is() )
+ {
+ int node = 0; // child nb
+ uno::Reference< awt::XLayoutContainer > xParent = xContainer->getContainerParent();
+ if ( xParent.is() )
+ {
+
+ uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren;
+ aChildren = xParent->getChildren();
+ for ( node = 0; node < aChildren.getLength(); node++ )
+ if ( aChildren[ node ] == xContainer )
+ break;
+ }
+
+ char str[ 8 ];
+ snprintf( str, 8, "%d", node );
+ if ( depth.empty() )
+ depth = std::string( str );
+ else
+ depth = std::string( str ) + ":" + depth;
+
+ xContainer = xParent;
+ }
+
+ return std::string( getName() ) + " (" + depth + ")";
+}
+#endif
+
+void Container::propertiesChanged()
+{
+ // cl: why this assertion? This is also called to set properties at the top level widget which has no parent!?
+ // DBG_ASSERT( mxParent.is(), "Properties listener: error container doesn't have parent" );
+
+ if ( mxLayoutUnit.is() && mxParent.is() )
+ mxLayoutUnit->queueResize( mxParent );
+}
+
+}
diff --git a/toolkit/source/layout/core/container.hxx b/toolkit/source/layout/core/container.hxx
new file mode 100644
index 000000000000..f236139fb1cb
--- /dev/null
+++ b/toolkit/source/layout/core/container.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_CORE_CONTAINER_HXX
+#define LAYOUT_CORE_CONTAINER_HXX
+
+#include <layout/core/helper.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/awt/MaxChildrenException.hpp>
+
+namespace layoutimpl
+{
+namespace css = ::com::sun::star;
+
+typedef ::cppu::WeakImplHelper2< css::awt::XLayoutContainer,
+ css::awt::XLayoutConstrains > Container_Base;
+
+class TOOLKIT_DLLPUBLIC Container : public Container_Base, public PropHelper, public PropHelper::Listener
+{
+ friend class ChildProps;
+protected:
+ // Widget properties
+ css::uno::Reference< css::awt::XLayoutContainer > mxParent;
+ css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
+ css::awt::Size maRequisition;
+ css::awt::Rectangle maAllocation;
+
+ // Container properties
+ sal_Int32 mnBorderWidth;
+
+ // Utilities
+ void allocateChildAt( const css::uno::Reference< css::awt::XLayoutConstrains > &xChild,
+ const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException);
+ static css::uno::Sequence< css::uno::Reference< css::awt::XLayoutConstrains > >
+ getSingleChild (const css::uno::Reference< css::awt::XLayoutConstrains > &xChildOrNil);
+ void setChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
+ void unsetChildParent( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild );
+
+ void queueResize();
+ void forceRecalc() { allocateArea( maAllocation ); }
+
+public:
+ Container();
+ virtual ~Container() {}
+
+ virtual bool emptyVisible ();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw() { PropHelper::acquire(); }
+ virtual void SAL_CALL release() throw() { PropHelper::release(); }
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // css::awt::XLayoutContainer
+ virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException, css::awt::MaxChildrenException) = 0;
+ virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException) = 0;
+
+ virtual css::uno::Sequence< css::uno::Reference
+ < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
+ throw (css::uno::RuntimeException) = 0;
+
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
+ const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException) = 0;
+
+ virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException) = 0;
+
+ void SAL_CALL setLayoutUnit( const css::uno::Reference< css::awt::XLayoutUnit > &xUnit )
+ throw(css::uno::RuntimeException)
+ { mxLayoutUnit = xUnit; }
+ css::uno::Reference< css::awt::XLayoutUnit > SAL_CALL getLayoutUnit()
+ throw(css::uno::RuntimeException)
+ { return mxLayoutUnit; }
+
+ css::awt::Size SAL_CALL getRequestedSize() throw(css::uno::RuntimeException)
+ { return maRequisition; }
+ com::sun::star::awt::Rectangle SAL_CALL getAllocatedArea() throw(css::uno::RuntimeException)
+ { return maAllocation; }
+
+ virtual sal_Bool SAL_CALL hasHeightForWidth()
+ throw(css::uno::RuntimeException) = 0;
+ virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
+ throw(css::uno::RuntimeException) = 0;
+
+ // css::awt::XLayoutContainer: css::container::XChild
+ css::uno::Reference< css::uno::XInterface > SAL_CALL getParent()
+ throw (css::uno::RuntimeException)
+ { return mxParent; }
+ void SAL_CALL setParent( const css::uno::Reference< css::uno::XInterface > &xParent )
+ throw (css::uno::RuntimeException)
+ { mxParent = css::uno::Reference< css::awt::XLayoutContainer >( xParent, css::uno::UNO_QUERY ); }
+
+ // css::awt::XLayoutConstrains
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException) = 0;
+ // (not properly implemented in toolkit, ignore it.)
+ css::awt::Size SAL_CALL getPreferredSize()
+ throw(css::uno::RuntimeException) { return getMinimumSize(); } // TODO: use this for flow?
+ css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize )
+ throw(css::uno::RuntimeException) { return rNewSize; }
+
+protected:
+ void propertiesChanged();
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_CONTAINER_HXX */
diff --git a/toolkit/source/layout/core/dialogbuttonhbox.cxx b/toolkit/source/layout/core/dialogbuttonhbox.cxx
new file mode 100644
index 000000000000..4a54fcecaf8c
--- /dev/null
+++ b/toolkit/source/layout/core/dialogbuttonhbox.cxx
@@ -0,0 +1,289 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <awt/vclxbutton.hxx>
+#include <tools/debug.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <vcl/button.hxx>
+
+#include "dialogbuttonhbox.hxx"
+#include "flow.hxx"
+#include "proplist.hxx"
+
+#if TEST_LAYOUT && !defined( DBG_UTIL )
+#undef DBG_ERROR
+#define DBG_ERROR OSL_TRACE
+#undef DBG_ERROR1
+#define DBG_ERROR1 OSL_TRACE
+#undef DBG_ERROR2
+#define DBG_ERROR2 OSL_TRACE
+#endif /* TEST_LAYOUT && !DBG_UTIL */
+
+namespace layoutimpl
+{
+
+using namespace css;
+
+//FIXME: how to set platform-dependant variables?
+DialogButtonHBox::Ordering const DialogButtonHBox::DEFAULT_ORDERING =
+#if defined( MACOSX )
+ DialogButtonHBox::MACOS;
+#elif defined( SAL_W32 )
+DialogButtonHBox::WINDOWS;
+#elif defined( ENABLE_KDE )
+DialogButtonHBox::KDE;
+#else /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
+DialogButtonHBox::GNOME;
+#endif /* !MACOSX && !SAL_W32 && !ENABLE_KDE */
+
+DialogButtonHBox::DialogButtonHBox()
+ : HBox()
+ , mnOrdering( DEFAULT_ORDERING )
+ , mFlow()
+ , mpAction( 0 )
+ , mpAffirmative( 0 )
+ , mpAlternate( 0 )
+ , mpApply( 0 )
+ , mpCancel( 0 )
+ , mpFlow( createChild( uno::Reference< awt::XLayoutConstrains > ( &mFlow ) ) )
+ , mpHelp( 0 )
+ , mpReset( 0 )
+{
+ mbHomogeneous = true;
+}
+
+void
+DialogButtonHBox::setOrdering( rtl::OUString const& ordering )
+{
+ if ( ordering.equalsIgnoreAsciiCaseAscii( "GNOME" ) )
+ mnOrdering = GNOME;
+ else if ( ordering.equalsIgnoreAsciiCaseAscii( "KDE" ) )
+ mnOrdering = KDE;
+ else if ( ordering.equalsIgnoreAsciiCaseAscii( "MacOS" ) )
+ mnOrdering = MACOS;
+ else if ( ordering.equalsIgnoreAsciiCaseAscii( "Windows" ) )
+ mnOrdering = WINDOWS;
+ else
+ {
+ DBG_ERROR1( "DialogButtonHBox: no such ordering: %s", OUSTRING_CSTR( ordering ) );
+ }
+}
+
+void
+DialogButtonHBox::addChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ throw ( uno::RuntimeException, awt::MaxChildrenException )
+{
+ if ( !xChild.is() )
+ return;
+
+ ChildData *p = createChild( xChild );
+
+#define IS_BUTTON(t) dynamic_cast<VCLX##t##Button *>( xChild.get () )
+
+ /* Sort Retry as Action */
+ if ( !mpAction && IS_BUTTON( Retry ) )
+ mpAction = p;
+ else if ( !mpAffirmative && IS_BUTTON( OK ) )
+ mpAffirmative = p;
+ else if ( !mpAffirmative && IS_BUTTON( Yes ) )
+ mpAffirmative = p;
+ else if ( !mpAlternate && IS_BUTTON( No ) )
+ mpAlternate = p;
+ /* Sort Ignore as Alternate */
+ else if ( !mpAlternate && IS_BUTTON( Ignore ) )
+ mpAlternate = p;
+ else if ( !mpApply && IS_BUTTON( Apply ) )
+ mpApply = p;
+ else if ( !mpCancel && IS_BUTTON( Cancel ) )
+ mpCancel = p;
+ /* Let the user overwrite Flow */
+ else if ( /* !mpFlow && */ dynamic_cast<Flow *>( xChild.get () ) )
+ mpFlow = p;
+ else if ( !mpHelp && IS_BUTTON( Help ) )
+ mpHelp = p;
+ else if ( !mpReset && IS_BUTTON( Reset ) )
+ mpReset = p;
+ else
+ maOther.push_back( p );
+ orderChildren();
+ setChildParent( xChild );
+ queueResize();
+}
+
+void
+DialogButtonHBox::orderChildren()
+{
+ if ( mnOrdering == WINDOWS )
+ windowsOrdering();
+ else if ( mnOrdering == MACOS )
+ macosOrdering();
+ else if ( mnOrdering == KDE )
+ kdeOrdering();
+ else if ( 1 || mnOrdering == GNOME )
+ gnomeOrdering();
+}
+
+void SAL_CALL
+DialogButtonHBox::removeChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ throw ( uno::RuntimeException)
+{
+ if ( !xChild.is ())
+ return;
+
+ Box_Base::ChildData *p = 0;
+
+ if ( mpAction && mpAction->mxChild == xChild )
+ p = mpAction;
+ else if ( mpAffirmative && mpAffirmative->mxChild == xChild )
+ p = mpAffirmative;
+ else if ( mpAlternate && mpAlternate->mxChild == xChild )
+ p = mpAlternate;
+ else if ( mpApply && mpApply->mxChild == xChild )
+ p = mpApply;
+ else if ( mpCancel && mpCancel->mxChild == xChild )
+ p = mpCancel;
+ else if ( mpFlow && mpFlow->mxChild == xChild )
+ p = mpFlow;
+ else if ( mpReset && mpReset->mxChild == xChild )
+ p = mpReset;
+ else if ( mpHelp && mpHelp->mxChild == xChild )
+ p = mpHelp;
+ else
+ p = removeChildData( maOther, xChild );
+
+ if ( p )
+ {
+ delete p;
+ unsetChildParent( xChild );
+ orderChildren();
+ queueResize();
+ }
+ else
+ {
+ DBG_ERROR( "DialogButtonHBox: removeChild: no such child" );
+ }
+}
+
+void
+DialogButtonHBox::gnomeOrdering()
+{
+ std::list< Box_Base::ChildData * > ordered;
+ if ( mpHelp )
+ ordered.push_back( mpHelp );
+ if ( mpReset )
+ ordered.push_back( mpReset );
+ if ( mpFlow && ( mpHelp || mpReset ) )
+ ordered.push_back( mpFlow );
+ ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
+ if ( mpAction )
+ ordered.push_back( mpAction );
+ if ( mpApply )
+ ordered.push_back( mpApply );
+ if ( mpAlternate )
+ ordered.push_back( mpAlternate );
+ if ( mpCancel )
+ ordered.push_back( mpCancel );
+ if ( mpAffirmative )
+ ordered.push_back( mpAffirmative );
+ maChildren = ordered;
+}
+
+void
+DialogButtonHBox::kdeOrdering()
+{
+ std::list< Box_Base::ChildData * > ordered;
+ if ( mpHelp )
+ ordered.push_back( mpHelp );
+ if ( mpReset )
+ ordered.push_back( mpReset );
+ if ( mpFlow && ( mpHelp || mpReset ) )
+ ordered.push_back( mpFlow );
+ ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
+ if ( mpAction )
+ ordered.push_back( mpAction );
+ if ( mpAffirmative )
+ ordered.push_back( mpAffirmative );
+ if ( mpApply )
+ ordered.push_back( mpApply );
+ if ( mpAlternate )
+ ordered.push_back( mpAlternate );
+ if ( mpCancel )
+ ordered.push_back( mpCancel );
+ maChildren = ordered;
+}
+
+void
+DialogButtonHBox::macosOrdering()
+{
+ std::list< Box_Base::ChildData * > ordered;
+ if ( mpHelp )
+ ordered.push_back( mpHelp );
+ if ( mpReset )
+ ordered.push_back( mpReset );
+ if ( mpApply )
+ ordered.push_back( mpApply );
+ if ( mpAction )
+ ordered.push_back( mpAction );
+ ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
+ if ( mpFlow ) // Always flow? && ( maOther.size () || mpHelp || mpReset || mpAction ) )
+ ordered.push_back( mpFlow );
+ if ( mpAlternate )
+ ordered.push_back( mpAlternate );
+ if ( mpFlow && mpAlternate )
+ ordered.push_back( mpFlow );
+ if ( mpCancel )
+ ordered.push_back( mpCancel );
+ if ( mpAffirmative )
+ ordered.push_back( mpAffirmative );
+ maChildren = ordered;
+}
+
+void
+DialogButtonHBox::windowsOrdering()
+{
+ std::list< Box_Base::ChildData * > ordered;
+ if ( mpReset )
+ ordered.push_back( mpReset );
+ if ( mpReset && mpFlow )
+ ordered.push_back( mpFlow );
+ if ( mpAffirmative )
+ ordered.push_back( mpAffirmative );
+ if ( mpAlternate )
+ ordered.push_back( mpAlternate );
+ if ( mpAction )
+ ordered.push_back( mpAction );
+ if ( mpCancel )
+ ordered.push_back( mpCancel );
+ if ( mpApply )
+ ordered.push_back( mpApply );
+ ordered.insert( ordered.end(), maOther.begin(), maOther.end() );
+ if ( mpHelp )
+ ordered.push_back( mpHelp );
+ maChildren = ordered;
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/dialogbuttonhbox.hxx b/toolkit/source/layout/core/dialogbuttonhbox.hxx
new file mode 100644
index 000000000000..b1e5ca0f6ba3
--- /dev/null
+++ b/toolkit/source/layout/core/dialogbuttonhbox.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 LAYOUT_CORE_DIALOGBUTTONHBOX_HXX
+#define LAYOUT_CORE_DIALOGBUTTONHBOX_HXX
+
+#include <layout/core/box.hxx>
+#include <layout/core/flow.hxx>
+
+namespace layoutimpl
+{
+
+class DialogButtonHBox : public HBox
+{
+public:
+ DialogButtonHBox();
+
+ void setOrdering( rtl::OUString const& ordering );
+ void SAL_CALL addChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException, css::awt::MaxChildrenException );
+ void SAL_CALL removeChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild ) throw ( css::uno::RuntimeException );
+
+private:
+ enum Ordering { PLATFORM, GNOME, KDE, MACOS, WINDOWS };
+
+ void orderChildren();
+ void gnomeOrdering();
+ void kdeOrdering();
+ void macosOrdering();
+ void windowsOrdering();
+
+ static Ordering const DEFAULT_ORDERING;
+ Ordering mnOrdering;
+ Flow mFlow;
+
+ ChildData *mpAction; /* [..]?, [Retry?] */
+ ChildData *mpAffirmative; /* OK, Yes, Save */
+ ChildData *mpAlternate; /* NO, [Ignore?], Don't save, Quit without saving */
+ ChildData *mpApply; /* Deprecated? */
+ ChildData *mpCancel; /* Cancel, Close */
+ ChildData *mpFlow;
+ ChildData *mpHelp;
+ ChildData *mpReset;
+
+ std::list< Box_Base::ChildData *> maOther;
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_DIALOGBUTTONHBOX_HXX */
diff --git a/toolkit/source/layout/core/factory.cxx b/toolkit/source/layout/core/factory.cxx
new file mode 100644
index 000000000000..db9616a8cc77
--- /dev/null
+++ b/toolkit/source/layout/core/factory.cxx
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "factory.hxx"
+
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <com/sun/star/registry/InvalidRegistryException.hpp>
+#include <cppuhelper/factory.hxx>
+
+#include "root.hxx"
+
+using namespace ::com::sun::star;
+using namespace layoutimpl;
+
+void * SAL_CALL comp_Layout_component_getFactory( const char * pImplName, void * pServiceManager, void * /*registryKey*/ )
+ {
+ void * pRet = 0;
+
+ ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
+ uno::Reference< lang::XSingleServiceFactory > xFactory;
+
+ if ( pServiceManager && aImplName.equals( LayoutFactory::impl_staticGetImplementationName() ) )
+ xFactory = ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
+ LayoutFactory::impl_staticGetImplementationName(),
+ LayoutFactory::impl_staticCreateSelfInstance,
+ LayoutFactory::impl_staticGetSupportedServiceNames() );
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+ }
+
+sal_Bool SAL_CALL comp_Layout_component_writeInfo( void * /*serviceManager*/, void * pRegistryKey )
+ {
+ if ( pRegistryKey )
+ {
+ try
+ {
+ uno::Reference< registry::XRegistryKey > xKey( reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ) );
+ uno::Reference< registry::XRegistryKey > xNewKey;
+
+ xNewKey = xKey->createKey( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) +
+ LayoutFactory::impl_staticGetImplementationName() +
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) );
+
+ const uno::Sequence< ::rtl::OUString > aServices = LayoutFactory::impl_staticGetSupportedServiceNames();
+ for ( sal_Int32 i = 0; i < aServices.getLength(); i++ )
+ xNewKey->createKey( aServices.getConstArray()[i] );
+
+ return sal_True;
+ }
+ catch (registry::InvalidRegistryException &)
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+ return sal_False;
+ }
+
+// Component registration
+::rtl::OUString SAL_CALL LayoutFactory::impl_staticGetImplementationName()
+{
+ return ::rtl::OUString::createFromAscii( "com.sun.star.comp.awt.Layout" );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::impl_staticGetSupportedServiceNames()
+{
+ uno::Sequence< ::rtl::OUString > aRet(2);
+ aRet[0] = ::rtl::OUString::createFromAscii("com.sun.star.awt.Layout");
+ aRet[1] = ::rtl::OUString::createFromAscii("com.sun.star.comp.awt.Layout");
+ return aRet;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::impl_staticCreateSelfInstance(
+ const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
+{
+ return uno::Reference< uno::XInterface >( *new LayoutFactory( xServiceManager ) );
+}
+
+// XServiceInfo
+::rtl::OUString SAL_CALL LayoutFactory::getImplementationName()
+ throw ( uno::RuntimeException )
+{
+ return impl_staticGetImplementationName();
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL LayoutFactory::getSupportedServiceNames()
+ throw ( uno::RuntimeException )
+{
+ return impl_staticGetSupportedServiceNames();
+}
+
+sal_Bool SAL_CALL LayoutFactory::supportsService( const ::rtl::OUString& ServiceName )
+ throw ( uno::RuntimeException )
+{
+ uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
+ for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
+ if ( ServiceName.compareTo( aSeq[i] ) == 0 )
+ return sal_True;
+
+ return sal_False;
+}
+
+// XSingleServiceFactory
+uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstance()
+ throw ( uno::Exception,
+ uno::RuntimeException )
+{
+ return uno::Reference< uno::XInterface >(
+ static_cast< OWeakObject* >( new LayoutRoot( m_xFactory ) ),
+ uno::UNO_QUERY );
+}
+
+uno::Reference< uno::XInterface > SAL_CALL LayoutFactory::createInstanceWithArguments(
+ const uno::Sequence< uno::Any >& aArguments )
+ throw ( uno::Exception,
+ uno::RuntimeException )
+{
+ uno::Reference< uno::XInterface > layout = createInstance();
+ uno::Reference< lang::XInitialization > xInit( layout, uno::UNO_QUERY );
+ xInit->initialize( aArguments );
+ return layout;
+}
diff --git a/toolkit/source/layout/core/factory.hxx b/toolkit/source/layout/core/factory.hxx
new file mode 100644
index 000000000000..3e2af712b961
--- /dev/null
+++ b/toolkit/source/layout/core/factory.hxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_CORE_FACTORY_HXX
+#define LAYOUT_CORE_FACTORY_HXX
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <toolkit/dllapi.h>
+
+namespace layoutimpl
+{
+class Layout;
+}
+
+class TOOLKIT_DLLPUBLIC LayoutFactory : public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XSingleServiceFactory,
+ ::com::sun::star::lang::XServiceInfo >
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+
+public:
+ LayoutFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
+ : m_xFactory( xFactory )
+ {
+ OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
+ }
+
+ static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL
+ impl_staticGetSupportedServiceNames();
+
+ static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
+ impl_staticCreateSelfInstance(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+
+
+ // XSingleServiceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::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);
+
+};
+
+#endif /* LAYOUT_CORE_FACTORY_HXX */
diff --git a/toolkit/source/layout/core/flow.cxx b/toolkit/source/layout/core/flow.cxx
new file mode 100644
index 000000000000..9a573b7487f4
--- /dev/null
+++ b/toolkit/source/layout/core/flow.cxx
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "flow.hxx"
+
+#include <sal/macros.h>
+
+namespace layoutimpl
+{
+
+using namespace css;
+
+bool Flow::ChildData::isVisible()
+{
+ return xChild.is();
+}
+
+Flow::Flow()
+ : Container()
+ , mnSpacing( 0 )
+ , mbHomogeneous( false )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ),
+ ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
+ &mbHomogeneous );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Spacing" ),
+ ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
+ &mnSpacing );
+}
+
+bool
+Flow::emptyVisible ()
+{
+ return true;
+}
+
+void SAL_CALL
+Flow::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
+ throw (uno::RuntimeException, css::awt::MaxChildrenException)
+{
+ if ( xChild.is() )
+ {
+ ChildData *pData = new ChildData();
+ pData->xChild = xChild;
+ maChildren.push_back( pData );
+
+ setChildParent( xChild );
+ queueResize();
+ }
+}
+
+void SAL_CALL
+Flow::removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& xChild )
+ throw (css::uno::RuntimeException)
+{
+ for ( std::list< ChildData * >::iterator it = maChildren.begin();
+ it != maChildren.end(); it++ )
+ {
+ if ( (*it)->xChild == xChild )
+ {
+ delete *it;
+ maChildren.erase( it );
+
+ unsetChildParent( xChild );
+ queueResize();
+ break;
+ }
+ }
+}
+
+css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > SAL_CALL
+Flow::getChildren()
+ throw (css::uno::RuntimeException)
+{
+ uno::Sequence< uno::Reference< awt::XLayoutConstrains > > children( maChildren.size() );
+ unsigned int i = 0;
+ for ( std::list< ChildData * >::iterator it = maChildren.begin();
+ it != maChildren.end(); it++, i++ )
+ children[i] = (*it)->xChild;
+
+ return children;
+}
+
+uno::Reference< beans::XPropertySet > SAL_CALL
+Flow::getChildProperties( const uno::Reference< awt::XLayoutConstrains >& /*xChild*/ )
+ throw (uno::RuntimeException)
+{
+ return uno::Reference< beans::XPropertySet >();
+}
+
+css::awt::Size
+Flow::calculateSize( long nMaxWidth )
+{
+ long nNeedHeight = 0;
+
+ std::list<ChildData *>::const_iterator it;
+ mnEachWidth = 0;
+ // first pass, for homogeneous property
+ for (it = maChildren.begin(); it != maChildren.end(); it++)
+ {
+ if ( !(*it)->isVisible() )
+ continue;
+ (*it)->aRequisition = (*it)->xChild->getMinimumSize();
+ if ( mbHomogeneous )
+ mnEachWidth = SAL_MAX( mnEachWidth, (*it)->aRequisition.Width );
+ }
+
+ long nRowWidth = 0, nRowHeight = 0;
+ for (it = maChildren.begin(); it != maChildren.end(); it++)
+ {
+ if ( !(*it)->isVisible() )
+ continue;
+
+ awt::Size aChildSize = (*it)->aRequisition;
+ if ( mbHomogeneous )
+ aChildSize.Width = mnEachWidth;
+
+ if ( nMaxWidth && nRowWidth > 0 && nRowWidth + aChildSize.Width > nMaxWidth )
+ {
+ nRowWidth = 0;
+ nNeedHeight += nRowHeight;
+ nRowHeight = 0;
+ }
+ nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
+ nRowWidth += aChildSize.Width;
+ }
+ nNeedHeight += nRowHeight;
+
+ return awt::Size( nRowWidth, nNeedHeight );
+}
+
+awt::Size SAL_CALL
+Flow::getMinimumSize() throw(uno::RuntimeException)
+{
+ return maRequisition = calculateSize( 0 );
+}
+
+sal_Bool SAL_CALL
+Flow::hasHeightForWidth()
+ throw(css::uno::RuntimeException)
+{
+ return true;
+}
+
+sal_Int32 SAL_CALL
+Flow::getHeightForWidth( sal_Int32 nWidth )
+ throw(css::uno::RuntimeException)
+{
+ return calculateSize( nWidth ).Height;
+}
+
+void SAL_CALL
+Flow::allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException)
+{
+ maAllocation = rArea;
+
+ std::list<ChildData *>::const_iterator it;
+ long nX = 0, nY = 0, nRowHeight = 0;
+ for (it = maChildren.begin(); it != maChildren.end(); it++)
+ {
+ ChildData *child = *it;
+ if ( !child->isVisible() )
+ continue;
+
+ awt::Size aChildSize( child->aRequisition );
+ if ( mbHomogeneous )
+ aChildSize.Width = mnEachWidth;
+
+ if ( nX > 0 && nX + aChildSize.Width > rArea.Width )
+ {
+ nX = 0;
+ nY += nRowHeight;
+ nRowHeight = 0;
+ }
+ nRowHeight = SAL_MAX( nRowHeight, aChildSize.Height );
+
+ allocateChildAt( child->xChild,
+ awt::Rectangle( rArea.X + nX, rArea.Y + nY, aChildSize.Width, aChildSize.Height ) );
+
+ nX += aChildSize.Width;
+ }
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/flow.hxx b/toolkit/source/layout/core/flow.hxx
new file mode 100644
index 000000000000..e2b4708cf261
--- /dev/null
+++ b/toolkit/source/layout/core/flow.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 LAYOUT_CORE_FLOW_HXX
+#define LAYOUT_CORE_FLOW_HXX
+
+#include <layout/core/container.hxx>
+
+#include <list>
+
+namespace layoutimpl
+{
+
+class Flow : public Container
+{
+protected:
+ // Box properties (i.e. affect all children)
+ sal_Int32 mnSpacing;
+ sal_Bool mbHomogeneous;
+
+public:
+ // Children properties
+ struct ChildData
+ {
+ css::awt::Size aRequisition;
+ css::uno::Reference< css::awt::XLayoutConstrains > xChild;
+ css::uno::Reference< css::beans::XPropertySet > xProps;
+ bool isVisible();
+ };
+
+protected:
+ std::list< ChildData * > maChildren;
+ long mnEachWidth; // on homogeneous, the width of every child
+
+public:
+ Flow();
+
+ bool emptyVisible ();
+
+ // css::awt::XLayoutContainer
+ virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
+ virtual void SAL_CALL removeChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Sequence< css::uno::Reference
+ < css::awt::XLayoutConstrains > > SAL_CALL getChildren()
+ throw (css::uno::RuntimeException);
+
+ virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getChildProperties(
+ const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException);
+
+ virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException);
+
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasHeightForWidth()
+ throw(css::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 nWidth )
+ throw(css::uno::RuntimeException);
+
+private:
+ // shared between getMinimumSize() and getHeightForWidth()
+ css::awt::Size calculateSize( long nMaxWidth );
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_FLOW_CORE_HXX */
diff --git a/toolkit/source/layout/core/helper.cxx b/toolkit/source/layout/core/helper.cxx
new file mode 100644
index 000000000000..d18a4f615d04
--- /dev/null
+++ b/toolkit/source/layout/core/helper.cxx
@@ -0,0 +1,672 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "helper.hxx"
+
+#include <assert.h>
+#include <list>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <tools/debug.hxx>
+
+#include "proplist.hxx"
+
+#if TEST_LAYOUT && !defined( DBG_UTIL )
+#undef DBG_ERROR
+#define DBG_ERROR OSL_TRACE
+#undef DBG_ERROR1
+#define DBG_ERROR1 OSL_TRACE
+#undef DBG_ERROR2
+#define DBG_ERROR2 OSL_TRACE
+#endif /* TEST_LAYOUT && !DBG_UTIL */
+
+namespace layoutimpl
+{
+using namespace com::sun::star;
+using rtl::OUString;
+
+uno::Reference< awt::XWindowPeer >
+getParent( uno::Reference< uno::XInterface > xRef )
+{
+ do
+ {
+ uno::Reference< awt::XWindowPeer > xPeer( xRef, uno::UNO_QUERY );
+ if ( xPeer.is() )
+ return xPeer;
+
+ uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY );
+ if ( xCont.is() )
+ xRef = xCont->getParent();
+ }
+ while ( xRef.is() );
+
+ return uno::Reference< awt::XWindowPeer >();
+}
+
+#if 0
+static uno::Reference< awt::XWindowPeer >
+getToplevel( uno::Reference< uno::XInterface > xRef )
+{
+ uno::Reference< awt::XWindowPeer > xTop, i;
+ while ( ( i = uno::Reference< awt::XWindowPeer >( xRef, uno::UNO_QUERY ) ).is() )
+ {
+ xTop = i;
+
+ uno::Reference< awt::XLayoutContainer > xCont( xRef, uno::UNO_QUERY );
+ if ( xCont.is() )
+ xRef = xCont->getParent();
+ else
+ xRef = uno::Reference< awt::XWindowPeer >();
+ }
+
+ return xTop;
+}
+#endif
+
+}
+
+#include "bin.hxx"
+#include "box.hxx"
+#include "dialogbuttonhbox.hxx"
+#include "flow.hxx"
+#include "localized-string.hxx"
+#include "table.hxx"
+
+namespace layoutimpl
+{
+
+oslModule WidgetFactory::mSfx2Library = 0;
+WindowCreator WidgetFactory::mSfx2CreateWidget = 0;
+
+uno::Reference <awt::XLayoutContainer> WidgetFactory::createContainer (OUString const& name)
+{
+ uno::Reference< awt::XLayoutContainer > xPeer;
+
+ if ( name.equalsAscii( "hbox" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new HBox() );
+ else if ( name.equalsAscii( "vbox" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new VBox() );
+ else if ( name.equalsAscii( "table" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new Table() );
+ else if ( name.equalsAscii( "flow" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new Flow() );
+ else if ( name.equalsAscii( "bin" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new Bin() );
+ else if ( name.equalsAscii( "min-size" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new MinSize() );
+ else if ( name.equalsAscii( "align" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new Align() );
+ else if ( name.equalsAscii( "dialogbuttonhbox" ) )
+ xPeer = uno::Reference< awt::XLayoutContainer >( new DialogButtonHBox() );
+
+ return xPeer;
+}
+
+uno::Reference <awt::XLayoutConstrains> WidgetFactory::toolkitCreateWidget (uno::Reference <awt::XToolkit> xToolkit, uno::Reference <uno::XInterface> xParent, OUString const& name, long properties)
+{
+ uno::Reference< awt::XLayoutConstrains > xPeer;
+ bool bToplevel = !xParent.is();
+
+ // UNO Control Widget
+ awt::WindowDescriptor desc;
+ if ( bToplevel )
+ desc.Type = awt::WindowClass_TOP;
+ else
+ {
+ desc.Type = awt::WindowClass_SIMPLE;
+
+#if 0
+ // top container -- a wrapper for framewindow -- is de-coupled
+ // from awt::XWindowPeer. So, getParent() fails at it.
+ uno::Reference< awt::XWindowPeer > xWinParent = getParent( xParent );
+#else
+ uno::Reference< awt::XWindowPeer > xWinParent( xParent, uno::UNO_QUERY );
+#endif
+ assert( xParent.is() );
+ assert( xWinParent.is() );
+ /*
+ With the new three layer instarr/rpath feature, when
+ prepending toolkit/unxlngx6.pro/lib or $SOLARVER/lib to
+ LD_LIBRARY_PATH, VCLXWindow::GetImplementation returns 0x0
+ vclxtoolkit::ImplCreateWindow failing to create any widget;
+ although it succeeds here.
+
+ While developing, one now must copy libtlx.so to
+ $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program/libtklx.so
+ each time.
+ */
+ VCLXWindow* parentComponent = VCLXWindow::GetImplementation( xWinParent );
+ if ( !parentComponent )
+ throw uno::RuntimeException(
+ OUString::createFromAscii( "parent has no implementation" ),
+ uno::Reference< uno::XInterface >() );
+ desc.Parent = xWinParent;
+ }
+
+ desc.ParentIndex = 0;
+ // debugging help ...
+ desc.Bounds.X = 0;
+ desc.Bounds.Y = 0;
+ desc.Bounds.Width = 300;
+ desc.Bounds.Height = 200;
+
+ desc.WindowAttributes = properties;
+ desc.WindowServiceName = name;
+
+ uno::Reference< awt::XWindowPeer > xWinPeer;
+ try
+ {
+ OSL_TRACE("Asking toolkit: %s", OUSTRING_CSTR( desc.WindowServiceName ) );
+ xWinPeer = xToolkit->createWindow( desc );
+ if ( !xWinPeer.is() )
+ throw uno::RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot create peer" ) ),
+ uno::Reference< uno::XInterface >() );
+ xPeer = uno::Reference< awt::XLayoutConstrains >( xWinPeer, uno::UNO_QUERY );
+ }
+ catch( uno::Exception & )
+ {
+ DBG_ERROR1( "Warning: %s is not a recognized type\n", OUSTRING_CSTR( name ) );
+ return uno::Reference< awt::XLayoutConstrains >();
+ }
+
+#if 0 // This shadows the show="false" property and seems otherwise
+ // unnecessary
+
+ // default to visible, let then people change it on properties
+ if ( ! bToplevel )
+ {
+ uno::Reference< awt::XWindow> xWindow( xPeer, uno::UNO_QUERY );
+ if ( xWindow.is() )
+ xWindow->setVisible( true );
+ }
+#endif
+
+ return xPeer;
+}
+
+uno::Reference< awt::XLayoutConstrains >
+WidgetFactory::createWidget (uno::Reference< awt::XToolkit > xToolkit, uno::Reference< uno::XInterface > xParent, OUString const& name, long properties)
+{
+ uno::Reference< awt::XLayoutConstrains > xPeer;
+
+ xPeer = uno::Reference <awt::XLayoutConstrains> (createContainer (name), uno::UNO_QUERY);
+ if ( xPeer.is() )
+ return xPeer;
+
+ xPeer = implCreateWidget (xParent, name, properties);
+ if (xPeer.is ())
+ return xPeer;
+
+#define FIXED_INFO 1
+#if FIXED_INFO
+ OUString tName = name;
+ // FIXME
+ if ( name.equalsAscii( "fixedinfo" ) )
+ tName = OUString::createFromAscii( "fixedtext" );
+ xPeer = toolkitCreateWidget (xToolkit, xParent, tName, properties);
+#else
+ xPeer = toolkitCreateWidget (xToolkit, xParent, name, properties);
+#endif
+
+ return xPeer;
+}
+
+PropHelper::PropHelper() : LockHelper()
+ , cppu::OPropertySetHelper( maBrdcstHelper )
+ , pHelper( NULL )
+{
+}
+
+void
+PropHelper::addProp (const char *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
+ uno::Type aType, void *pPtr)
+{
+ // this sucks rocks for effiency ...
+ PropDetails aDetails;
+ aDetails.aName = rtl::OUString::intern( pName, nNameLen, e );
+ aDetails.aType = aType;
+ aDetails.pValue = pPtr;
+ maDetails.push_back( aDetails );
+}
+
+cppu::IPropertyArrayHelper & SAL_CALL
+PropHelper::getInfoHelper()
+{
+ if ( ! pHelper )
+ {
+ uno::Sequence< beans::Property > aProps( maDetails.size() );
+ for ( unsigned int i = 0; i < maDetails.size(); i++)
+ {
+ aProps[i].Name = maDetails[i].aName;
+ aProps[i].Type = maDetails[i].aType;
+ aProps[i].Handle = i;
+ aProps[i].Attributes = 0;
+ }
+ pHelper = new cppu::OPropertyArrayHelper( aProps, false /* fixme: faster ? */ );
+
+ }
+ return *pHelper;
+}
+
+sal_Bool SAL_CALL
+PropHelper::convertFastPropertyValue(
+ uno::Any & rConvertedValue,
+ uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const uno::Any& rValue )
+ throw (lang::IllegalArgumentException)
+{
+ OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
+
+ // FIXME: no Any::getValue ...
+ getFastPropertyValue( rOldValue, nHandle );
+ if ( rOldValue != rValue )
+ {
+ rConvertedValue = rValue;
+ return sal_True; // changed
+ }
+ else
+ {
+ rConvertedValue.clear();
+ rOldValue.clear();
+ }
+ return sal_False;
+}
+
+
+void SAL_CALL
+PropHelper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
+ const uno::Any& rValue )
+ throw (uno::Exception)
+{
+ OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
+
+ const PropDetails &rInfo = maDetails[ nHandle ];
+
+ uno_type_assignData( rInfo.pValue, rInfo.aType.getTypeLibType(),
+ rValue.pData, rValue.pType,
+ 0, 0, 0 );
+
+ if ( mpListener )
+ mpListener->propertiesChanged();
+}
+
+void SAL_CALL
+PropHelper::getFastPropertyValue( uno::Any& rValue,
+ sal_Int32 nHandle ) const
+{
+ OSL_ASSERT( nHandle >= 0 && nHandle < (sal_Int32) maDetails.size() );
+ const PropDetails &rInfo = maDetails[ nHandle ];
+#if 0
+ switch ( rInfo.aType.getTypeClass() )
+ {
+#define MAP(classtype,ctype) \
+ case uno::TypeClass_##classtype: \
+ rValue <<= *(ctype *)(rInfo.pValue); \
+ break
+ MAP( DOUBLE, double );
+ MAP( SHORT, sal_Int16 );
+ MAP( LONG, sal_Int32 );
+ MAP( UNSIGNED_SHORT, sal_uInt16 );
+ MAP( UNSIGNED_LONG, sal_uInt32 );
+ MAP( STRING, ::rtl::OUString );
+ default:
+ DBG_ERROR( "ERROR: unknown type to map!" );
+ break;
+ }
+#undef MAP
+#endif
+ rValue.setValue( rInfo.pValue, rInfo.aType );
+}
+
+::com::sun::star::uno::Any
+PropHelper::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+{
+ return OPropertySetHelper::queryInterface( rType );
+}
+
+uno::Reference <beans::XPropertySetInfo> SAL_CALL PropHelper::getPropertySetInfo () throw (uno::RuntimeException)
+{
+ return css::uno::Reference <css::beans::XPropertySetInfo> (createPropertySetInfo (getInfoHelper ()));
+}
+
+} // namespace layoutimpl
+
+#include <awt/vclxbutton.hxx>
+#include <awt/vclxdialog.hxx>
+#include <awt/vclxfixedline.hxx>
+#include <awt/vclxplugin.hxx>
+#include <awt/vclxscroller.hxx>
+#include <awt/vclxsplitter.hxx>
+#include <awt/vclxtabcontrol.hxx>
+#include <awt/vclxtabpage.hxx>
+#include <toolkit/awt/vclxtoolkit.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <vcl/button.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/unohelp.hxx>
+
+#include <layout/layout.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <vcl/lstbox.hxx>
+#include <vcl.hxx>
+
+#include <typeinfo>
+
+namespace layoutimpl
+{
+
+uno::Reference <awt::XLayoutConstrains> WidgetFactory::implCreateWidget (uno::Reference <uno::XInterface> xParent, OUString name, long attributes)
+{
+ Window* parent = 0;
+
+ if (VCLXWindow* parentComponent = VCLXWindow::GetImplementation (xParent))
+ parent = parentComponent->GetWindow ();
+
+ VCLXWindow* component = 0;
+ Window* window = 0; //sfx2CreateWindow (&component, parent, name, attributes);
+ if (!window)
+ window = layoutCreateWindow (&component, parent, name, attributes);
+
+ uno::Reference <awt::XLayoutConstrains> reference;
+ if (window)
+ {
+ window->SetCreatedWithToolkit( sal_True );
+ if ( component )
+ component->SetCreatedWithToolkit( true );
+ reference = component;
+ window->SetComponentInterface( component );
+ if ( attributes & awt::WindowAttribute::SHOW )
+ window->Show();
+ }
+
+ return reference;
+}
+
+extern "C" { static void SAL_CALL thisModule() {} }
+
+Window* WidgetFactory::sfx2CreateWindow (VCLXWindow** component, Window* parent, OUString const& name, long& attributes)
+{
+ OSL_TRACE("Asking sfx2: %s", OUSTRING_CSTR (name));
+
+ if (!mSfx2Library)
+ {
+ OUString libraryName = ::vcl::unohelper::CreateLibraryName ("sfx", TRUE);
+ mSfx2Library = osl_loadModuleRelative (&thisModule, libraryName.pData, SAL_LOADMODULE_DEFAULT);
+ if (mSfx2Library)
+ {
+ OUString functionName (RTL_CONSTASCII_USTRINGPARAM ("CreateWindow"));
+ mSfx2CreateWidget = (WindowCreator) osl_getFunctionSymbol (mSfx2Library, functionName.pData);
+ }
+ }
+
+ if (mSfx2CreateWidget)
+ return mSfx2CreateWidget (component, name, parent, attributes);
+
+ return 0;
+}
+
+Window* WidgetFactory::layoutCreateWindow (VCLXWindow** component, Window *parent, OUString const& name, long& attributes)
+{
+ Window* window = 0;
+
+ if (0)
+ {
+ ;
+ }
+ if ( name.equalsAscii( "dialog" ) )
+ {
+ if ( parent == NULL )
+ parent = DIALOG_NO_PARENT;
+ window = new Dialog( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXDialog();
+
+ attributes ^= awt::WindowAttribute::SHOW;
+ }
+ else if ( name.equalsAscii( "modaldialog" ) )
+ {
+ if ( parent == NULL )
+ parent = DIALOG_NO_PARENT;
+ window = new ModalDialog( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXDialog();
+
+ attributes ^= awt::WindowAttribute::SHOW;
+ }
+ else if ( name.equalsAscii( "modelessdialog" ) )
+ {
+ if ( parent == NULL )
+ parent = DIALOG_NO_PARENT;
+ window = new ModelessDialog (parent, ImplGetWinBits (attributes, 0));
+ *component = new layoutimpl::VCLXDialog();
+
+ attributes ^= awt::WindowAttribute::SHOW;
+ }
+ else if ( name.equalsAscii( "sfxdialog" ) )
+ {
+ if ( parent == NULL )
+ parent = DIALOG_NO_PARENT;
+ window = new ClosingDialog (parent, ImplGetWinBits (attributes, 0));
+ *component = new layoutimpl::VCLXDialog();
+
+ attributes ^= awt::WindowAttribute::SHOW;
+ }
+ else if ( name.equalsAscii( "sfxmodaldialog" ) )
+ {
+ if ( parent == NULL )
+ parent = DIALOG_NO_PARENT;
+ window = new ClosingModalDialog( parent,
+ ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXDialog();
+
+ attributes ^= awt::WindowAttribute::SHOW;
+ }
+ else if ( name.equalsAscii( "sfxmodelessdialog" ) )
+ {
+ if ( parent == NULL )
+ parent = DIALOG_NO_PARENT;
+ window = new ClosingModelessDialog (parent, ImplGetWinBits (attributes, 0));
+ *component = new layoutimpl::VCLXDialog();
+
+ attributes ^= awt::WindowAttribute::SHOW;
+ }
+ else if ( name.equalsAscii( "tabcontrol" ) )
+ {
+ window = new TabControl( parent, ImplGetWinBits( attributes, WINDOW_TABCONTROL ) );
+ *component = new layoutimpl::VCLXTabControl();
+ }
+ else if ( name.equalsAscii( "scroller" ) )
+ {
+ // used FixedImage because I just want some empty non-intrusive widget
+ window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXScroller();
+ }
+ else if ( name.equalsAscii( "hsplitter" ) || name.equalsAscii( "vsplitter" ) )
+ {
+ window = new FixedImage( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXSplitter( name.equalsAscii( "hsplitter" ) );
+ }
+ else if ( name.equalsAscii( "hfixedline" ) || name.equalsAscii( "vfixedline" ) )
+ {
+ WinBits nStyle = ImplGetWinBits( attributes, 0 );
+ nStyle ^= WB_HORZ;
+ if ( name.equalsAscii( "hfixedline" ) )
+ nStyle |= WB_HORZ;
+ else
+ nStyle |= WB_VERT;
+ window = new FixedLine( parent, nStyle );
+ *component = new layoutimpl::VCLXFixedLine();
+ }
+ else if ( name.equalsAscii( "okbutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXOKButton( window );
+ window->SetType (WINDOW_OKBUTTON);
+ }
+ else if ( name.equalsAscii( "cancelbutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXCancelButton( window );
+ window->SetType (WINDOW_CANCELBUTTON);
+ }
+ else if ( name.equalsAscii( "yesbutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXYesButton( window );
+ window->SetType (WINDOW_OKBUTTON);
+ }
+ else if ( name.equalsAscii( "nobutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ window->SetType (WINDOW_CANCELBUTTON);
+ *component = new layoutimpl::VCLXNoButton( window );
+ }
+ else if ( name.equalsAscii( "retrybutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXRetryButton( window );
+ }
+ else if ( name.equalsAscii( "ignorebutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXIgnoreButton( window );
+ }
+ else if ( name.equalsAscii( "resetbutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXResetButton( window );
+ }
+ else if ( name.equalsAscii( "applybutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXApplyButton( window );
+ }
+ else if ( name.equalsAscii( "helpbutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXHelpButton( window );
+ window->SetType (WINDOW_HELPBUTTON);
+ }
+ else if ( name.equalsAscii( "morebutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXMoreButton( window );
+ window->SetType (WINDOW_MOREBUTTON);
+ }
+ else if ( name.equalsAscii( "advancedbutton" ) )
+ {
+ window = new PushButton( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::VCLXAdvancedButton( window );
+ }
+ else if ( name.equalsAscii( "plugin" ) )
+ {
+ window = new Control( parent, ImplGetWinBits( attributes, 0 ) );
+#ifndef __SUNPRO_CC
+ OSL_TRACE( "%s: parent=%p (%s)\n", __FUNCTION__, parent, typeid( *parent ).name() );
+#endif
+ *component = new layoutimpl::VCLXPlugin( window, ImplGetWinBits( attributes, 0 ) );
+ }
+ else if ( name.equalsAscii( "tabpage" ) )
+ {
+#if 0
+ if ( !parent )
+ parent = layout::TabPage::global_parent;
+#else
+ if (layout::TabPage::global_parent)
+ parent = layout::TabPage::global_parent;
+ layout::TabPage::global_parent = 0;
+#endif
+ //window = new TabPage( parent, ImplGetWinBits( attributes, 0 ) );
+ attributes ^= awt::WindowAttribute::SHOW;
+ WinBits nStyle = ImplGetWinBits( attributes, 0 );
+ nStyle |= WB_HIDE;
+
+ if (!parent)
+ {
+ window = new Dialog( parent, nStyle );
+ *component = new VCLXDialog();
+ }
+ else
+ {
+ window = new TabPage( parent, nStyle );
+ *component = new VCLXTabPage( window );
+ }
+ }
+ else if ( name.equalsAscii( "string" ) )
+ {
+ // FIXME: move <string>s.text to simple map<string> in root?
+ attributes &= ~awt::WindowAttribute::SHOW;
+ window = new Window( parent, ImplGetWinBits( attributes, 0 ) );
+ *component = new layoutimpl::LocalizedString();
+ }
+#if 0 // parent paranoia
+ else if ( name.equalsAscii( "listbox" ) )
+ {
+ window = new ListBox (parent, ImplGetWinBits (attributes, 0));
+ *component = new VCLXListBox ();
+ }
+#endif
+ else if (name.equalsAscii ("svxfontlistbox")
+ || name.equalsAscii ("svxlanguagebox"))
+ {
+ window = new ListBox (parent, ImplGetWinBits (attributes, 0));
+ *component = new VCLXListBox ();
+ }
+ return window;
+}
+
+} // namespace layoutimpl
+
+// Avoid polluting the rest of the code with vcl linkage pieces ...
+
+#include <vcl/imagerepository.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/graph.hxx>
+
+namespace layoutimpl
+{
+
+uno::Reference< graphic::XGraphic > loadGraphic( const char *pName )
+{
+ BitmapEx aBmp;
+
+ OUString aStr( pName, strlen( pName ), RTL_TEXTENCODING_ASCII_US );
+ if ( aStr.compareToAscii( ".uno:" ) == 0 )
+ aStr = aStr.copy( 5 ).toAsciiLowerCase();
+
+ if ( !vcl::ImageRepository::loadImage( OUString::createFromAscii( pName ), aBmp, true ) )
+ return uno::Reference< graphic::XGraphic >();
+
+ return Graphic( aBmp ).GetXGraphic();
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/helper.hxx b/toolkit/source/layout/core/helper.hxx
new file mode 100644
index 000000000000..2fac41ebc493
--- /dev/null
+++ b/toolkit/source/layout/core/helper.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_CORE_HELPER_HXX
+#define LAYOUT_CORE_HELPER_HXX
+
+#include <toolkit/dllapi.h>
+#include <vector>
+
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XLayoutContainer.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/xml/input/XRoot.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <osl/module.h>
+#include <rtl/ustring.hxx>
+
+class Window;
+class VCLXWindow;
+extern "C"
+{
+ typedef Window* (SAL_CALL *WindowCreator) (VCLXWindow** component, rtl::OUString const& name, Window* parent, long& attributes);
+}
+
+namespace layoutimpl
+{
+
+namespace css = ::com::sun::star;
+
+/* ChildProps -- a helper to set child properties for the XLayoutContainer interface. */
+
+class LockHelper
+{
+public:
+ osl::Mutex maGuard;
+ cppu::OBroadcastHelper maBrdcstHelper;
+ LockHelper() : maBrdcstHelper( maGuard )
+ {
+ }
+};
+
+class PropHelper : public LockHelper
+ , public cppu::OPropertySetHelper
+ , public cppu::OWeakObject
+{
+ cppu::OPropertyArrayHelper *pHelper;
+
+ struct PropDetails
+ {
+ rtl::OUString aName;
+ css::uno::Type aType;
+ void *pValue;
+ };
+ std::vector< PropDetails > maDetails;
+
+protected:
+ void addProp( char const *pName, sal_Int32 nNameLen, rtl_TextEncoding e,
+ css::uno::Type aType, void *pPtr );
+
+public:
+ PropHelper();
+
+ // com::sun::star::uno::XInterface
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // cppu::OPropertySetHelper
+ virtual cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any &,
+ css::uno::Any &, sal_Int32 nHandle, const css::uno::Any & )
+ throw(css::lang::IllegalArgumentException);
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle,
+ const css::uno::Any& rValue ) throw (css::uno::Exception);
+ using OPropertySetHelper::getFastPropertyValue;
+ virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue,
+ sal_Int32 nHandle ) const;
+
+ virtual css::uno::Reference <css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo () throw (css::uno::RuntimeException);
+
+ struct Listener
+ {
+ virtual void propertiesChanged() = 0;
+ };
+
+ void setChangeListener( Listener *pListener )
+ {
+ mpListener = pListener;
+ }
+
+protected:
+ Listener *mpListener;
+};
+
+css::uno::Any anyFromString (const rtl::OUString &value, const css::uno::Type &type);
+
+// The native widgets wrapper hierarchy may not reflect that of the layout
+// hierarchy as some containers don't have an associated native widget.
+// Use this function to get the native parent of the given peer.
+css::uno::Reference< css::awt::XWindowPeer >
+getParent( css::uno::Reference< css::uno::XInterface > xPeer );
+
+class TOOLKIT_DLLPUBLIC WidgetFactory
+{
+public:
+ static oslModule mSfx2Library;
+ static WindowCreator mSfx2CreateWidget;
+
+ // Should use UNO services in due course
+ static css::uno::Reference <css::awt::XLayoutConstrains> toolkitCreateWidget (css::uno::Reference <css::awt::XToolkit> xToolkit, css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString const& name, long properties);
+ static css::uno::Reference< css::awt::XLayoutConstrains > createWidget( css::uno::Reference <css::awt::XToolkit > xToolkit, css::uno::Reference< css::uno::XInterface > xParent, rtl::OUString const &name, long properties);
+ static css::uno::Reference <css::awt::XLayoutContainer> createContainer (rtl::OUString const& name);
+ static css::uno::Reference <css::awt::XLayoutConstrains> implCreateWidget (css::uno::Reference <css::uno::XInterface> xParent, rtl::OUString name, long attributes);
+ static Window* sfx2CreateWindow (VCLXWindow** component, Window* parent, rtl::OUString const& name, long& attributes);
+ static Window* layoutCreateWindow (VCLXWindow** component, Window *parent, rtl::OUString const& name, long& attributes);
+};
+
+
+css::uno::Reference< css::graphic::XGraphic > loadGraphic( const char *pName );
+
+} // end namespace layoutimpl
+
+#endif /* LAYOUT_CORE_HELPER_HXX */
diff --git a/toolkit/source/layout/core/import.cxx b/toolkit/source/layout/core/import.cxx
new file mode 100644
index 000000000000..daaa8c239f50
--- /dev/null
+++ b/toolkit/source/layout/core/import.cxx
@@ -0,0 +1,336 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "import.hxx"
+
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <vcl/image.hxx>
+#include <tools/debug.hxx>
+#include <layout/layout.hxx>
+
+#include "root.hxx"
+#include "helper.hxx"
+#include "dialogbuttonhbox.hxx"
+
+
+#define XMLNS_LAYOUT_URI "http://openoffice.org/2007/layout"
+#define XMLNS_CONTAINER_URI "http://openoffice.org/2007/layout/container"
+
+namespace layoutimpl
+{
+using namespace css;
+
+using ::rtl::OUString;
+
+ElementBase::~ElementBase()
+SAL_THROW( () )
+{
+ //delete mpImport;
+ //mpImport = 0;
+}
+
+//** parser
+WidgetElement::WidgetElement ( sal_Int32 nUid, const OUString &rName,
+ uno::Reference <xml::input::XAttributes> const &attributes,
+ ElementBase *pParent,
+ ImportContext *pImport)
+SAL_THROW (())
+: ElementBase( nUid, rName, attributes, pParent, pImport )
+{
+ OUString name = rName.toAsciiLowerCase();
+
+ PropList aProps;
+ propsFromAttributes( attributes, aProps, pImport->XMLNS_LAYOUT_UID );
+
+ OUString aId;
+ findAndRemove( "id", aProps, aId );
+ OUString aLang;
+ findAndRemove( "xml-lang", aProps, aLang );
+
+ {
+//DEBUG
+ uno::Reference< awt::XLayoutConstrains > xParent;
+ if ( pParent )
+ xParent = ((WidgetElement *) pParent)->mpWidget->getPeer();
+
+
+ mpWidget = pImport->mrRoot.create( aId, name,
+ getAttributeProps( aProps ), uno::Reference< awt::XLayoutContainer >( xParent, uno::UNO_QUERY ) );
+
+ }
+
+ // TODO: handle with non-existing widgets
+
+ mpWidget->setProperties( aProps );
+
+ uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
+ if ( xDialog.is() )
+ {
+ OUString aTitle;
+ if ( findAndRemove( "title", aProps, aTitle ) )
+ {
+ OSL_TRACE("Setting title: %s", OUSTRING_CSTR( aTitle ) );
+ xDialog->setTitle( aTitle );
+ }
+ OUString aHelpId;
+ if ( findAndRemove( "help-id", aProps, aHelpId ) )
+ {
+ OSL_TRACE("Setting help-id: %s", OUSTRING_CSTR( aHelpId ) );
+ xDialog->setHelpId( aHelpId.toInt32 () );
+ }
+ } // DEBUG:
+ else if ( pParent == NULL )
+ {
+ DBG_ERROR( "Fatal error: top node isn't a dialog" );
+ }
+
+#if 0
+ // Hack moved to proplist.cxx
+ OUString aGraphic;
+ if ( findAndRemove( "graphic", aProps, aGraphic ) )
+ //if ( layout::FixedImage *i = dynamic_cast<layout::FixedImage *> ( mpWidget->getPeer().get() ) )
+ // FIXME: huh? XImageProducer::complete( XImageConsumer )
+ //i->setImage( Image( loadGraphic( OUSTRING_CSTR( aGraphic ) ) ) );
+ mpWidget->setProperty( OUString::createFromAscii( "graphic" ),
+ loadGraphic( OUSTRING_CSTR( aGraphic ) ) );
+#endif
+
+ OUString aOrdering;
+ if ( findAndRemove( "ordering", aProps, aOrdering ) )
+ if ( DialogButtonHBox *b = dynamic_cast<DialogButtonHBox *> ( mpWidget->getPeer().get() ) )
+ b->setOrdering ( aOrdering );
+
+ bool bSetRadioGroup;
+ OUString aRadioGroup;
+ bSetRadioGroup = findAndRemove( "radiogroup", aProps, aRadioGroup );
+
+ mpWidget->setProperties( aProps );
+
+ // we need to add radio buttons to the group after their properties are
+ // set, so we can check if they should be the one selected by default or not.
+ // And the state changed event isn't fired when changing properties.
+
+ uno::Reference< awt::XRadioButton > xRadio( mpWidget->getPeer(), uno::UNO_QUERY );
+ if ( xRadio.is() )
+ {
+ if (!bSetRadioGroup)
+ aRadioGroup = OUString::createFromAscii ("default");
+ pImport->mxRadioGroups.addItem( aRadioGroup, xRadio );
+ }
+}
+
+WidgetElement::~WidgetElement()
+{
+ //delete mpWidget;
+ //mpWidget = 0;
+}
+
+uno::Reference <xml::input::XElement>
+WidgetElement::startChildElement ( sal_Int32 nUid, OUString const &name,
+ uno::Reference <xml::input::XAttributes> const &attributes )
+ throw( xml::sax::SAXException, uno::RuntimeException )
+{
+ // Adding a child to the widget
+ WidgetElement *pChild = new WidgetElement ( nUid, name, attributes, this, mpImport );
+
+ if ( !mpWidget->addChild( pChild->mpWidget ) )
+ {
+ DBG_ERROR2( "ERROR: cannot add %s to container %s, container full", OUSTRING_CSTR( name ), OUSTRING_CSTR( getLocalName() ) );
+ throw xml::sax::SAXException();
+ }
+
+ PropList aProps;
+ propsFromAttributes( attributes, aProps, mpImport->XMLNS_CONTAINER_UID );
+ mpWidget->setChildProperties( pChild->mpWidget, aProps );
+
+ return pChild;
+}
+
+// Support Ivo Hinkelmann's move label/text/title attribute to CONTENT
+// transex3 hack.
+void SAL_CALL
+WidgetElement::characters( OUString const& rChars )
+ throw (xml::sax::SAXException, uno::RuntimeException)
+{
+ if ( mpWidget && rChars.trim().getLength() )
+ {
+ uno::Reference< awt::XDialog2 > xDialog( mpWidget->getPeer(), uno::UNO_QUERY );
+ uno::Reference< awt::XButton > xButton( mpWidget->getPeer(), uno::UNO_QUERY );
+ if ( xDialog.is() )
+ xDialog->setTitle( rChars );
+ else if ( xButton.is() )
+ mpWidget->setProperty( OUString::createFromAscii( "label" ), rChars );
+ else
+ mpWidget->setProperty( OUString::createFromAscii( "text" ), rChars );
+ }
+}
+// ---- ElementBase ----
+
+ElementBase::ElementBase( sal_Int32 nUid, OUString const & rLocalName,
+ uno::Reference< xml::input::XAttributes > const & xAttributes,
+ ElementBase* pParent,
+ ImportContext* pImport )
+SAL_THROW(())
+: mpImport( pImport )
+ , mpParent( pParent )
+ , mnUid( nUid )
+ , maLocalName( rLocalName )
+ , mxAttributes( xAttributes )
+{
+}
+
+// ---- ImportContext ----
+
+void ImportContext::startDocument(
+ uno::Reference< xml::input::XNamespaceMapping > const & xNamespaceMapping )
+ throw (xml::sax::SAXException, uno::RuntimeException)
+{
+ XMLNS_LAYOUT_UID = xNamespaceMapping->getUidByUri(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_LAYOUT_URI ) ) );
+ XMLNS_CONTAINER_UID = xNamespaceMapping->getUidByUri(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( XMLNS_CONTAINER_URI ) ) );
+}
+
+ToplevelElement::ToplevelElement (OUString const &rName,
+ uno::Reference <xml::input::XAttributes> const &xAttributes,
+ ImportContext *pImport)
+SAL_THROW(())
+: WidgetElement( 0, rName, xAttributes, NULL, pImport )
+{
+}
+
+ToplevelElement::~ToplevelElement()
+{
+}
+
+uno::Reference< xml::input::XElement > ImportContext::startRootElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ uno::Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, uno::RuntimeException)
+{
+ if ( XMLNS_LAYOUT_UID != nUid )
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid namespace!" ) ),
+ uno::Reference< uno::XInterface >(), uno::Any() );
+ return new ToplevelElement( rLocalName, xAttributes, this );
+}
+
+RadioGroups::RadioGroups()
+{
+}
+
+void RadioGroups::addItem( rtl::OUString id, uno::Reference< awt::XRadioButton > xRadio )
+ throw (uno::RuntimeException)
+{
+ if ( ! xRadio.is() )
+ throw uno::RuntimeException();
+
+ uno::Reference< RadioGroup > group;
+ RadioGroupsMap::iterator it = mxRadioGroups.find( id );
+ if ( it == mxRadioGroups.end() )
+ {
+ group = uno::Reference< RadioGroup > ( new RadioGroup() );
+ mxRadioGroups [id] = group;
+ }
+ else
+ group = it->second;
+ group->addItem( xRadio );
+}
+
+RadioGroups::RadioGroup::RadioGroup()
+{
+}
+
+void RadioGroups::RadioGroup::addItem( uno::Reference< awt::XRadioButton > xRadio )
+{
+ if ( ! mxSelectedRadio.is() )
+ {
+ xRadio->setState( true );
+ mxSelectedRadio = xRadio;
+ }
+ else if ( xRadio->getState() )
+ {
+#if 1
+ xRadio->setState( false );
+#else // huh, why select last added?
+ mxSelectedRadio->setState( false );
+ mxSelectedRadio = xRadio;
+#endif
+ }
+
+ // TOO late: actionPerformed is called before itemStateChanged.
+ // If client code (wrongly?) uses actionPerformed, it will see
+ // the previous RadioButtons' state.
+ xRadio->addItemListener( this );
+
+ uno::Reference< awt::XButton > xButton = uno::Reference< awt::XButton > ( xRadio, uno::UNO_QUERY );
+ xButton->addActionListener( this );
+
+ mxRadios.push_back (xRadio);
+}
+
+void RadioGroups::RadioGroup::handleSelected ()
+ throw (uno::RuntimeException)
+{
+ for ( RadioButtonsList::iterator it = mxRadios.begin();
+ it != mxRadios.end(); it++ )
+ if ( *it != mxSelectedRadio && (*it)->getState() )
+ {
+ mxSelectedRadio->setState( false );
+ mxSelectedRadio = *it;
+ break;
+ }
+}
+
+// awt::XItemListener
+void RadioGroups::RadioGroup::itemStateChanged( const awt::ItemEvent& e )
+ throw (uno::RuntimeException)
+{
+ // TOO late: actionPerformed is called before itemStateChanged.
+ // If client code (wrongly?) uses actionPerformed, it will see
+ // the previous RadioButtons' state.
+
+ // Need this for initialization, though.
+ if ( e.Selected )
+ handleSelected ();
+}
+
+// awt::XActionListener
+void RadioGroups::RadioGroup::actionPerformed( const awt::ActionEvent& )
+ throw (uno::RuntimeException)
+{
+ handleSelected ();
+}
+
+// lang::XEventListener
+void SAL_CALL RadioGroups::RadioGroup::disposing( const lang::EventObject& )
+ throw (uno::RuntimeException)
+{
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/import.hxx b/toolkit/source/layout/core/import.hxx
new file mode 100644
index 000000000000..7af8f16eb5d3
--- /dev/null
+++ b/toolkit/source/layout/core/import.hxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 LAYOUT_CORE_IMPORT_HXX
+#define LAYOUT_CORE_IMPORT_HXX
+
+#include <map>
+#include <list>
+#define _BACKWARD_BACKWARD_WARNING_H 1
+#include <hash_map>
+
+
+#include <com/sun/star/xml/input/XRoot.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XRadioButton.hpp>
+
+namespace layoutimpl
+{
+class LayoutRoot;
+class LayoutWidget;
+namespace css = ::com::sun::star;
+
+class RadioGroups
+{
+public:
+ RadioGroups();
+
+ void addItem( rtl::OUString id, css::uno::Reference< css::awt::XRadioButton > xRadio )
+ throw (css::uno::RuntimeException);
+
+private:
+ class RadioGroup : public ::cppu::WeakImplHelper1< css::awt::XItemListener >
+ , public ::cppu::WeakImplHelper1< css::awt::XActionListener >
+ {
+ public:
+ RadioGroup();
+ void addItem( css::uno::Reference< css::awt::XRadioButton > xRadio );
+
+ private:
+ typedef std::list< css::uno::Reference< css::awt::XRadioButton > > RadioButtonsList;
+ RadioButtonsList mxRadios;
+ css::uno::Reference< css::awt::XRadioButton > mxSelectedRadio;
+
+ void handleSelected ()
+ throw (css::uno::RuntimeException);
+
+ // awt::XItemListener
+ void SAL_CALL itemStateChanged( const css::awt::ItemEvent& e )
+ throw (css::uno::RuntimeException);
+
+ // awt::XActionListener
+ void SAL_CALL actionPerformed( const css::awt::ActionEvent& e )
+ throw (css::uno::RuntimeException);
+
+ // lang::XEventListener
+ void SAL_CALL disposing( const css::lang::EventObject& )
+ throw (css::uno::RuntimeException);
+ };
+
+ // each RadioGroup will stay alive after RadioGroups die with the ImportContext
+ // because they are referenced by every XRadioButton through the listener
+ typedef std::map< rtl::OUString, css::uno::Reference< RadioGroup > > RadioGroupsMap;
+ RadioGroupsMap mxRadioGroups;
+};
+
+#if 0
+// generator
+class Widget
+{
+public:
+ Widget( css::uno::Reference< css::awt::XToolkit > xToolkit,
+ css::uno::Reference< css::awt::XWindow > xToplevel,
+ rtl::OUString unoName, long attrbs );
+ virtual ~Widget();
+
+ virtual void setProperties( const PropList &rProps );
+
+ virtual bool addChild( Widget *pChild );
+ virtual void setChildProperties( Widget *pChild, const PropList &rProps );
+
+ inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer()
+ { return mxWidget; }
+
+ inline css::uno::Reference< css::awt::XLayoutConstrains > getContainer()
+ { return mxContainer; }
+
+protected:
+ css::uno::Reference< css::awt::XLayoutConstrains > mxWidget;
+ css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
+};
+
+class Root
+{
+public:
+ Root( css::uno::Reference< css::awt::XToolkit > xToolkit )
+ : mxToolkit( xToolkit ) {}
+ ~Root();
+
+ virtual Widget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs );
+
+ css::uno::Reference< css::awt::XLayoutConstrains > getById( rtl::OUString id );
+ inline css::uno::Reference< css::awt::XLayoutConstrains > getToplevel();
+
+protected:
+ css::uno::Reference< css::awt::XToolkit > mxToolkit;
+ Widget *mpToplevel;
+
+ typedef std::hash_map< rtl::OUString, css::uno::Reference< css::awt::XLayoutConstrains >,
+ rtl::OUStringHash > ItemHash;
+ ItemHash maItems;
+};
+#endif
+
+// parser
+class ImportContext : public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
+{
+public:
+ sal_Int32 XMLNS_LAYOUT_UID, XMLNS_CONTAINER_UID;
+ LayoutRoot &mrRoot; // switch to XNameContainer ref ?
+ RadioGroups mxRadioGroups;
+
+ inline ImportContext( LayoutRoot &rRoot ) SAL_THROW( () )
+ : mrRoot( rRoot ) {}
+ virtual ~ImportContext() {}
+
+ // XRoot
+ virtual void SAL_CALL startDocument(
+ css::uno::Reference< css::xml::input::XNamespaceMapping >
+ const & xNamespaceMapping )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endDocument()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException)
+ { /* ignore */ }
+ virtual void SAL_CALL processingInstruction(
+ ::rtl::OUString const & /* rTarget */, ::rtl::OUString const & /* rData */ )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException)
+ { /* ignore */ }
+ virtual void SAL_CALL setDocumentLocator(
+ css::uno::Reference< css::xml::sax::XLocator > const & /* xLocator */ )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException)
+ { /* ignore */ }
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startRootElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+};
+
+class ElementBase : public ::cppu::WeakImplHelper1< css::xml::input::XElement >
+{
+protected:
+ ImportContext *mpImport;
+/* TODO: check if all this memebers are needed. */
+ ElementBase *mpParent;
+ sal_Int32 mnUid;
+
+ ::rtl::OUString maLocalName;
+ css::uno::Reference< css::xml::input::XAttributes > mxAttributes;
+public:
+ ElementBase(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, ImportContext * pImport )
+ SAL_THROW( () );
+ virtual ~ElementBase() SAL_THROW(());
+
+ // XElement
+ virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent()
+ throw (css::uno::RuntimeException)
+ { return static_cast< css::xml::input::XElement * >( mpParent ); }
+ virtual ::rtl::OUString SAL_CALL getLocalName() throw (css::uno::RuntimeException)
+ { return maLocalName; }
+ virtual sal_Int32 SAL_CALL getUid() throw (css::uno::RuntimeException)
+ { return mnUid; }
+ virtual css::uno::Reference< css::xml::input::XAttributes >
+ SAL_CALL getAttributes() throw (css::uno::RuntimeException)
+ { return mxAttributes; }
+
+ virtual void SAL_CALL ignorableWhitespace(
+ ::rtl::OUString const & /* rWhitespaces */ )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException)
+ { /* ignore */ }
+ virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException)
+ { /* ignore */ }
+ virtual void SAL_CALL processingInstruction(
+ ::rtl::OUString const & /* Target */, ::rtl::OUString const & /* Data */ )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException)
+ { /* ignore */ }
+
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes > const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException) = 0;
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException)
+ { /* ignore */ }
+};
+
+class WidgetElement : public ElementBase
+{
+protected:
+ LayoutWidget *mpWidget;
+
+public:
+ WidgetElement( sal_Int32 nUid, rtl::OUString const &name,
+ css::uno::Reference< css::xml::input::XAttributes > const &attributes,
+ ElementBase *parent, ImportContext *import ) SAL_THROW (());
+
+ ~WidgetElement();
+
+
+ virtual css::uno::Reference< css::xml::input::XElement> SAL_CALL
+ startChildElement (sal_Int32 id, rtl::OUString const &name,
+ css::uno::Reference< css::xml::input::XAttributes > const &attributes)
+ throw( css::xml::sax::SAXException, css::uno::RuntimeException );
+ virtual void SAL_CALL characters( ::rtl::OUString const & /* rChars */ )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+};
+
+class ToplevelElement : public WidgetElement
+{
+public:
+ ToplevelElement( rtl::OUString const &name,
+ css::uno::Reference< css::xml::input::XAttributes > const &attributes,
+ ImportContext *import ) SAL_THROW (());
+ ~ToplevelElement();
+};
+
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_IMPORT_HXX */
diff --git a/toolkit/source/layout/core/localized-string.cxx b/toolkit/source/layout/core/localized-string.cxx
new file mode 100644
index 000000000000..bbf067011f6b
--- /dev/null
+++ b/toolkit/source/layout/core/localized-string.cxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "localized-string.hxx"
+
+#include <toolkit/helper/property.hxx>
+#include <vcl/window.hxx>
+
+namespace layoutimpl
+{
+
+namespace css = ::com::sun::star;
+using namespace css;
+using rtl::OUString;
+
+LocalizedString::LocalizedString()
+ : VCLXWindow()
+{
+}
+
+void LocalizedString::ImplGetPropertyIds( std::list< sal_uInt16 > &ids )
+{
+ PushPropertyIds( ids, BASEPROPERTY_TEXT, 0);
+ VCLXWindow::ImplGetPropertyIds( ids );
+}
+
+// XInterface
+uno::Any LocalizedString::queryInterface( uno::Type const& rType )
+ throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XFixedText*, this ) );
+ return (aRet.hasValue() ? aRet : VCLXWindow::queryInterface( rType ));
+}
+
+void LocalizedString::setText( OUString const& s )
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( Window *w = GetWindow() )
+ return w->SetText( s );
+}
+
+OUString LocalizedString::getText()
+ throw(uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ if ( Window *w = GetWindow() )
+ return w->GetText();
+ return OUString();
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/localized-string.hxx b/toolkit/source/layout/core/localized-string.hxx
new file mode 100644
index 000000000000..a6310336ceb6
--- /dev/null
+++ b/toolkit/source/layout/core/localized-string.hxx
@@ -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 LAYOUT_CORE_LOCALIZED_STRING_HXX
+#define LAYOUT_CORE_LOCALIZED_STRING_HXX
+
+#include <com/sun/star/awt/XFixedText.hpp>
+#include <toolkit/awt/vclxwindow.hxx>
+
+namespace layoutimpl
+{
+namespace css = ::com::sun::star;
+
+// FIXME: misuse XFixedText interface for simple string
+class LocalizedString : public css::awt::XFixedText
+ , public VCLXWindow
+{
+public:
+ LocalizedString();
+
+ // css::uno::XInterface
+ css::uno::Any SAL_CALL queryInterface( css::uno::Type const& rType )
+ throw(css::uno::RuntimeException);
+ void SAL_CALL acquire() throw() { OWeakObject::acquire(); }
+ void SAL_CALL release() throw() { OWeakObject::release(); }
+
+ // css::awt::XFixedText
+ void SAL_CALL setText( ::rtl::OUString const& s )
+ throw(css::uno::RuntimeException);
+ ::rtl::OUString SAL_CALL getText()
+ throw(css::uno::RuntimeException);
+ void SAL_CALL setAlignment( sal_Int16 )
+ throw(css::uno::RuntimeException) { }
+ sal_Int16 SAL_CALL getAlignment()
+ throw(css::uno::RuntimeException) { return 0; }
+
+ // css::awt::XLayoutConstrains
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException) { return css::awt::Size( 0, 0 ); }
+ css::awt::Size SAL_CALL getPreferredSize()
+ throw(css::uno::RuntimeException) { return getMinimumSize(); }
+ css::awt::Size SAL_CALL calcAdjustedSize( css::awt::Size const& size )
+ throw(css::uno::RuntimeException) { return size; }
+
+ static void ImplGetPropertyIds( std::list< sal_uInt16 > &ids );
+ virtual void GetPropertyIds( std::list< sal_uInt16 > &ids )
+ { return ImplGetPropertyIds( ids ); }
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_LOCALIZED_STRING_HXX */
diff --git a/toolkit/source/layout/core/makefile.mk b/toolkit/source/layout/core/makefile.mk
new file mode 100644
index 000000000000..2c90921799af
--- /dev/null
+++ b/toolkit/source/layout/core/makefile.mk
@@ -0,0 +1,65 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../../..
+PRJNAME=toolkit
+TARGET=layout-core
+ENABLE_EXCEPTIONS=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Files --------------------------------------------------------
+
+# FIXME: This is bad, hmkay
+CFLAGS+= -I$(PRJ)/source
+
+SLOFILES= \
+ $(SLO)$/bin.obj \
+ $(SLO)$/box-base.obj \
+ $(SLO)$/box.obj \
+ $(SLO)$/byteseq.obj \
+ $(SLO)$/container.obj \
+ $(SLO)$/dialogbuttonhbox.obj \
+ $(SLO)$/factory.obj \
+ $(SLO)$/flow.obj \
+ $(SLO)$/helper.obj \
+ $(SLO)$/import.obj \
+ $(SLO)$/localized-string.obj \
+ $(SLO)$/proplist.obj \
+ $(SLO)$/root.obj \
+ $(SLO)$/table.obj \
+ $(SLO)$/timer.obj \
+ $(SLO)$/translate.obj\
+ $(SLO)$/vcl.obj\
+#
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/layout/core/precompiled_xmlscript.hxx b/toolkit/source/layout/core/precompiled_xmlscript.hxx
new file mode 100644
index 000000000000..0fc538151348
--- /dev/null
+++ b/toolkit/source/layout/core/precompiled_xmlscript.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+/*
+ xmlscript/source/xml_helper/xml_byteseq.cxx compile helper.
+
+ Avoid introducing a toolkit dependency on xmlscript.
+
+ It would be nice to modify xml_byteseq.cxx making it friendlier
+ to include.
+*/
diff --git a/toolkit/source/layout/core/proplist.cxx b/toolkit/source/layout/core/proplist.cxx
new file mode 100644
index 000000000000..7cd27473a8c7
--- /dev/null
+++ b/toolkit/source/layout/core/proplist.cxx
@@ -0,0 +1,454 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "proplist.hxx"
+
+#include <rtl/ustrbuf.hxx>
+#include <toolkit/dllapi.h>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#include <tools/debug.hxx>
+
+#include "helper.hxx"
+
+#if TEST_LAYOUT && !defined( DBG_UTIL )
+#undef DBG_ERROR
+#define DBG_ERROR OSL_TRACE
+#undef DBG_ERROR1
+#define DBG_ERROR1 OSL_TRACE
+#undef DBG_ERROR2
+#define DBG_ERROR2 OSL_TRACE
+#endif /* TEST_LAYOUT && !DBG_UTIL */
+
+namespace layoutimpl
+{
+
+using namespace com::sun::star;
+using rtl::OString;
+using rtl::OUString;
+using rtl::OUStringBuffer;
+
+namespace prophlp
+{
+
+bool TOOLKIT_DLLPUBLIC
+canHandleProps( const uno::Reference< uno::XInterface > &xPeer )
+{
+ uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ return true;
+ uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
+ uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
+ return xInfo.is() && xVclPeer.is();
+}
+
+uno::Reference< beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC
+queryPropertyInfo(
+ const uno::Reference< uno::XInterface > &xPeer )
+{
+ uno::Reference< beans::XPropertySetInfo > xInfo( xPeer, uno::UNO_QUERY );
+ if ( !xInfo.is() )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
+ if ( xPropSet.is() )
+ xInfo = xPropSet->getPropertySetInfo();
+ }
+ return xInfo;
+}
+
+void TOOLKIT_DLLPUBLIC
+setProperty( const uno::Reference< uno::XInterface > &xPeer,
+ const OUString &rName, uno::Any aValue )
+{
+ uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
+ if ( xVclPeer.is() )
+ xVclPeer->setProperty( rName, aValue );
+ else
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
+ xPropSet->setPropertyValue( rName, aValue );
+ }
+}
+
+uno::Any TOOLKIT_DLLPUBLIC
+getProperty( const uno::Reference< uno::XInterface > &xPeer,
+ const OUString &rName )
+{
+ uno::Reference< awt::XVclWindowPeer> xVclPeer( xPeer, uno::UNO_QUERY );
+ if ( xVclPeer.is() )
+ return xVclPeer->getProperty( rName );
+
+ uno::Reference< beans::XPropertySet > xPropSet( xPeer, uno::UNO_QUERY );
+ return xPropSet->getPropertyValue( rName );
+}
+
+} // namespace prophlp
+
+
+/* Given a string and a type, it converts the string to the type, and returns
+ it encapsulated in Any. */
+uno::Any anyFromString( OUString const& value, uno::Type const& type )
+{
+ sal_Int16 radix = 10;
+ OUString intval = value;
+ if ( value.getLength() > 2 && value[0] == '0' && value[1] == 'x' )
+ intval = value.copy( 2 ), radix = 16;
+ else if ( value.getLength() > 1 && value[0] == '#' )
+ intval = value.copy( 1 ), radix = 16;
+ switch ( type.getTypeClass() )
+ {
+ case uno::TypeClass_CHAR:
+ return uno::makeAny( value.toChar() );
+ case uno::TypeClass_BOOLEAN:
+ if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) ) )
+ return uno::makeAny( true );
+ else if ( value == OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) )
+ return uno::makeAny( false );
+ break; // ends switch, throws exception
+ case uno::TypeClass_BYTE:
+ return uno::makeAny( ( sal_uInt8 ) intval.toInt32( radix ) );
+ case uno::TypeClass_SHORT:
+ return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
+ case uno::TypeClass_UNSIGNED_SHORT:
+ return uno::makeAny( ( sal_uInt16 ) intval.toInt32( radix ) );
+ case uno::TypeClass_ENUM:
+ return uno::makeAny( ( sal_Int16 ) intval.toInt32( radix ) );
+ case uno::TypeClass_LONG:
+ return uno::makeAny( ( sal_Int32 ) intval.toInt32( radix ) );
+ case uno::TypeClass_UNSIGNED_LONG:
+ return uno::makeAny( ( sal_uInt32 ) intval.toInt32( radix ) );
+ case uno::TypeClass_HYPER:
+ return uno::makeAny( ( sal_Int64 ) intval.toInt64( radix ) );
+ case uno::TypeClass_UNSIGNED_HYPER:
+ return uno::makeAny( ( sal_uInt16 ) intval.toInt64( radix ) );
+ case uno::TypeClass_FLOAT:
+ return uno::makeAny( value.toFloat() );
+ case uno::TypeClass_DOUBLE:
+ return uno::makeAny( value.toDouble() );
+ case uno::TypeClass_STRING:
+ return uno::makeAny( value );
+ case uno::TypeClass_CONSTANT:
+ return uno::makeAny( intval.toInt32( radix ) );
+ case uno::TypeClass_INTERFACE:
+ return uno::makeAny( loadGraphic( OUSTRING_CSTR( value ) ) );
+ case uno::TypeClass_SEQUENCE:
+ {
+ sal_Int32 i = 0;
+ bool escaped = false, first = true;
+ OUString item, token;
+ std::list< OUString > values;
+ do
+ {
+ token = value.getToken( 0, ':', i );
+
+ if ( !token.getLength() && !escaped )
+ {
+ escaped = true;
+ item += OUString( ':' );
+ }
+ else if ( escaped )
+ {
+ escaped = false;
+ item += token;
+ }
+ else
+ {
+ if ( !first )
+ values.push_back( item );
+ item = token;
+ }
+ first = false;
+ }
+ while ( i >= 0 );
+ if ( item.getLength() )
+ values.push_back( item );
+
+ uno::Sequence< OUString > seq( values.size() );
+ i = 0;
+ for ( std::list< OUString >::const_iterator it = values.begin();
+ it != values.end(); it++, i++ )
+ seq[ i ] = *it;
+
+ return uno::makeAny( seq );
+ }
+
+ default:
+ DBG_ERROR1( "ERROR: unknown property type of value: `%s'\n", OUSTRING_CSTR( value ) );
+ break;
+ }
+ throw uno::RuntimeException();
+}
+
+/* Converts the XML naming scheme to UNO's, for legacy compatibility
+ (so, ergo, "one-two-three-four" -> "OneTwoThreeFour"). */
+static OUString toUnoNaming ( OUString const &string )
+{
+ OUStringBuffer buffer( string.getLength() );
+ sal_Unicode *str = string.pData->buffer;
+ bool capitalize = true;
+
+ for ( int i = 0; i < string.getLength(); i++ )
+ {
+ if ( i == 0 && str[0] == '_' )
+ /* Skip translate-me prefix. */
+ continue;
+ if ( str[i] == '-' )
+ capitalize = true;
+ else
+ {
+ if ( capitalize && str[i] >= 'a' && str[i] <= 'z' )
+ buffer.append( (sal_Unicode ) ( str[i] - 'a' + 'A' ) );
+ else
+ buffer.append( (sal_Unicode ) str[i] );
+ capitalize = false;
+ }
+ }
+
+ return buffer.makeStringAndClear();
+}
+
+/*
+ * convert incoming XML style property names, to AWT style property names.
+ * convert the values based on introspection information.
+ * apply to either an XPropertySet or an XPropertySetInfo | XVclWindowPeer
+ * aggregate.
+ */
+void
+setProperties( uno::Reference< uno::XInterface > const& xPeer,
+ PropList const& rProps )
+{
+ if ( !prophlp::canHandleProps( xPeer ) )
+ {
+ DBG_ERROR( "Error: setProperties - bad handle ignoring props:\n" );
+ for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
+ it++ )
+ {
+ DBG_ERROR2( "%s=%s\n", OUSTRING_CSTR( it->first ), OUSTRING_CSTR( it->second ) );
+ }
+ return;
+ }
+
+ for ( PropList::const_iterator it = rProps.begin(); it != rProps.end();
+ it++ )
+ setProperty( xPeer, it->first, it->second );
+}
+
+void
+setProperty( uno::Reference< uno::XInterface > const& xPeer,
+ OUString const& attr, OUString const& value )
+{
+ OUString unoAttr = toUnoNaming( attr );
+
+ OSL_TRACE( "setting %s=%s", OUSTRING_CSTR( attr ), OUSTRING_CSTR( value ) );
+ // get a Property object
+ beans::Property prop;
+ try
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo
+ = prophlp::queryPropertyInfo( xPeer );
+ prop = xInfo->getPropertyByName( unoAttr );
+ }
+ catch( beans::UnknownPropertyException & )
+ {
+ DBG_ERROR1( "Warning: unknown attribute: `%s'\n", OUSTRING_CSTR( unoAttr ) );
+ return;
+ }
+
+ if ( prop.Name.getLength() <= 0 )
+ {
+ DBG_ERROR1( "Warning: missing prop: `%s'\n", OUSTRING_CSTR( unoAttr ) );
+ return;
+ }
+
+ // encapsulates value in an uno::Any
+ uno::Any any;
+ try
+ {
+ any = anyFromString( value, prop.Type );
+ }
+ catch( uno::RuntimeException & )
+ {
+ DBG_ERROR5( "Warning: %s( %s )( %s ) attribute is of type %s( rejected: %s )\n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ), OUSTRING_CSTR( prop.Name ), OUSTRING_CSTR( prop.Type.getTypeName() ), OUSTRING_CSTR( value ) );
+ return;
+ }
+
+ // sets value on property
+ try
+ {
+ prophlp::setProperty( xPeer, unoAttr, any );
+ }
+ catch( ... )
+ {
+ DBG_ERROR2( "Warning: cannot set attribute %s to %s \n", OUSTRING_CSTR( unoAttr ), OUSTRING_CSTR( value ) );
+ }
+}
+
+
+
+
+struct AttributesMap
+{
+ const char *name;
+ long value;
+ bool windowAttr;
+};
+static const AttributesMap attribsMap[] =
+{
+ { "autohscroll", awt::VclWindowPeerAttribute::AUTOHSCROLL, false },
+ { "autovscroll", awt::VclWindowPeerAttribute::AUTOVSCROLL, false },
+ { "center", awt::VclWindowPeerAttribute::CENTER, false },
+ { "clipchildren", awt::VclWindowPeerAttribute::CLIPCHILDREN, false },
+ { "closeable", awt::WindowAttribute::CLOSEABLE, true },
+ { "defbutton", awt::VclWindowPeerAttribute::DEFBUTTON, false },
+ { "dropdown", awt::VclWindowPeerAttribute::DROPDOWN, false },
+ { "fullsize", awt::WindowAttribute::FULLSIZE, true }, //FIXME?
+ { "group", awt::VclWindowPeerAttribute::GROUP, false },
+ { "has_border", awt::WindowAttribute::BORDER, true },
+ { "hscroll", awt::VclWindowPeerAttribute::HSCROLL, false },
+ { "left", awt::VclWindowPeerAttribute::LEFT, false },
+ { "moveable", awt::WindowAttribute::MOVEABLE, true },
+ { "noborder", awt::VclWindowPeerAttribute::NOBORDER, false },
+ { "nolabel", awt::VclWindowPeerAttribute::NOLABEL, false },
+ { "optimumsize", awt::WindowAttribute::OPTIMUMSIZE, false },
+ { "readonly", awt::VclWindowPeerAttribute::READONLY, false },
+ { "right", awt::VclWindowPeerAttribute::RIGHT, false },
+ { "show", awt::WindowAttribute::SHOW, true },
+ { "sizeable", awt::WindowAttribute::SIZEABLE, true },
+ { "sort", awt::VclWindowPeerAttribute::SORT, false },
+ { "spin", awt::VclWindowPeerAttribute::SPIN, false },
+ { "vscroll", awt::VclWindowPeerAttribute::VSCROLL, false },
+
+ // cutting on OK, YES_NO_CANCEL and related obsite attributes...
+};
+static const int attribsMapLen = sizeof( attribsMap ) / sizeof( AttributesMap );
+
+#if 0
+long getAttribute( const OUString &rName, bool bTopWindow )
+{
+
+ int min = 0, max = attribsMapLen - 1, mid, cmp;
+ do
+ {
+ mid = min +( max - min )/2;
+ cmp = rName.compareToAscii( attribsMap[ mid ].name );
+ if ( cmp > 0 )
+ min = mid+1;
+ else if ( cmp < 0 )
+ max = mid-1;
+ else
+ {
+ if ( bTopWindow || attribsMap[ mid ].value )
+ return attribsMap[ mid ].windowAttr;
+ return 0;
+ }
+ }
+ while ( min <= max );
+ return 0;
+}
+#endif
+
+void propsFromAttributes( const uno::Reference<xml::input::XAttributes> & xAttributes,
+ PropList &rProps, sal_Int32 nNamespace )
+{
+ sal_Int32 nAttrs = xAttributes->getLength();
+ for ( sal_Int32 i = 0; i < nAttrs; i++ )
+ {
+ if ( nNamespace != xAttributes->getUidByIndex( i ) )
+ continue;
+
+ std::pair< OUString, OUString > aElem
+ ( xAttributes->getLocalNameByIndex( i ),
+ xAttributes->getValueByIndex( i ) );
+
+ if ( aElem.first.getLength() > 0 ) // namespace bits ..
+ rProps.push_back( aElem );
+ }
+}
+
+bool
+findAndRemove( const char *pAttr, PropList &rProps, OUString &rValue )
+{
+ PropList::iterator it;
+ OUString aName = OUString::createFromAscii( pAttr );
+
+ for ( it = rProps.begin(); it != rProps.end(); it++ )
+ {
+ if ( it->first.equalsIgnoreAsciiCase( aName )
+ || it->first.equalsIgnoreAsciiCase( OUString::createFromAscii ("_") + aName ) )
+ {
+ rValue = it->second;
+ rProps.erase( it );
+ return true;
+ }
+ }
+ rValue = OUString();
+ return false;
+}
+
+long
+getAttributeProps( PropList &rProps )
+{
+ long nAttrs = 0;
+ OUString aValue;
+
+ OUString trueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
+
+ if ( findAndRemove( "show", rProps, aValue ) &&
+ aValue.equalsIgnoreAsciiCase(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) ) ) )
+ ;
+ else
+ nAttrs |= awt::WindowAttribute::SHOW;
+
+ for ( int i = 0; i < attribsMapLen; i++ )
+ {
+ if ( findAndRemove( attribsMap[i].name, rProps, aValue ) )
+ {
+ if ( aValue.equalsIgnoreAsciiCase( trueStr ) )
+ nAttrs |= attribsMap[i].value;
+ }
+ }
+
+ if ( findAndRemove( "align", rProps, aValue ) )
+ {
+ sal_Int32 nVal = aValue.toInt32();
+
+ if ( nVal == 0 /* PROPERTY_ALIGN_LEFT */ )
+ nAttrs |= awt::VclWindowPeerAttribute::LEFT;
+ else if ( nVal == 1 /* PROPERTY_ALIGN_CENTER */ )
+ nAttrs |= awt::VclWindowPeerAttribute::CENTER;
+ else if ( nVal == 2 )
+ nAttrs |= awt::VclWindowPeerAttribute::RIGHT;
+ }
+
+ return nAttrs;
+}
+
+}
+
diff --git a/toolkit/source/layout/core/proplist.hxx b/toolkit/source/layout/core/proplist.hxx
new file mode 100644
index 000000000000..6a98cf449df3
--- /dev/null
+++ b/toolkit/source/layout/core/proplist.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 LAYOUT_CORE_PROPLIST_HXX
+#define LAYOUT_CORE_PROPLIST_HXX
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/xml/input/XAttributes.hpp>
+#include <list>
+#include <rtl/ustring.hxx>
+#include <toolkit/dllapi.h>
+\
+namespace layoutimpl
+{
+
+namespace css = ::com::sun::star;
+
+typedef std::list< std::pair< rtl::OUString, rtl::OUString > > PropList;
+
+void propsFromAttributes( const css::uno::Reference<css::xml::input::XAttributes> & xAttributes,
+ PropList &rProps, sal_Int32 nNamespace );
+
+void setProperties( css::uno::Reference< css::uno::XInterface > const& xPeer,
+ PropList const& rProps);
+
+void setProperty( css::uno::Reference< css::uno::XInterface > const& xPeer,
+ rtl::OUString const& attr, rtl::OUString const& value );
+
+long getAttributeProps( PropList &rProps );
+bool findAndRemove( const char *pAttr, PropList &rProps, rtl::OUString &rValue);
+
+// Helpers - unfortunately VCLXWindows don't implement XPropertySet
+// but containers do - these helpers help us to hide this
+namespace prophlp
+{
+
+// can we set properties on this handle ?
+bool TOOLKIT_DLLPUBLIC canHandleProps( const css::uno::Reference< css::uno::XInterface > &xRef );
+// if so which properties ?
+css::uno::Reference< css::beans::XPropertySetInfo > TOOLKIT_DLLPUBLIC queryPropertyInfo(
+ const css::uno::Reference< css::uno::XInterface > &xRef );
+// set / get ...
+void TOOLKIT_DLLPUBLIC setProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
+ const rtl::OUString &rName,
+ css::uno::Any aValue );
+css::uno::Any TOOLKIT_DLLPUBLIC getProperty( const css::uno::Reference< css::uno::XInterface > &xRef,
+ const rtl::OUString &rName );
+} // namespace prophlp
+
+} // namespace layoutimpl
+
+
+#if !OUSTRING_CSTR_PARANOIA
+#define OUSTRING_CSTR( str ) \
+ rtl::OUStringToOString( str, RTL_TEXTENCODING_ASCII_US ).getStr()
+#else
+
+inline char const* OUSTRING_CSTR( rtl::OUString const& str )
+{
+ rtl::OString *leak
+ = new rtl::OString (rtl::OUStringToOString (str, RTL_TEXTENCODING_ASCII_US));
+ return leak->getStr();
+}
+
+#endif
+
+#endif /* LAYOUT_CORE_PROPLIST_HXX */
diff --git a/toolkit/source/layout/core/root.cxx b/toolkit/source/layout/core/root.cxx
new file mode 100644
index 000000000000..af56e77f9aac
--- /dev/null
+++ b/toolkit/source/layout/core/root.cxx
@@ -0,0 +1,409 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "root.hxx"
+
+#include <cassert>
+
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/XMessageBox.hpp>
+#include <com/sun/star/awt/MessageBoxButtons.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/awt/XMessageBoxFactory.hpp>
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/xml/sax/XParser.hpp>
+
+#include "helper.hxx"
+#include "import.hxx"
+#include "timer.hxx"
+#include "translate.hxx"
+
+namespace layoutimpl
+{
+
+using namespace css;
+using ::rtl::OUString;
+
+LayoutRoot::LayoutRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+ : mbDisposed( sal_False )
+ , mxFactory( xFactory )
+ , mpListeners( NULL )
+ , mpToplevel( NULL )
+{
+ if ( !xFactory.is() )
+ throw uno::RuntimeException();
+ mxLayoutUnit = uno::Reference< awt::XLayoutUnit >( new LayoutUnit() );
+}
+
+LayoutRoot::~LayoutRoot()
+{
+// TODO: we want to delete the top level LayoutWidget...
+ ::osl::MutexGuard aGuard( maMutex );
+ if ( !mbDisposed )
+ {
+ try
+ {
+ m_refCount++; // inhibit multiple destruction
+ dispose();
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+}
+
+void ShowMessageBox( uno::Reference< lang::XMultiServiceFactory > const& xFactory, uno::Reference< awt::XToolkit > xToolkit, OUString const& aTitle, OUString const& aMessage )
+{
+ uno::Reference< uno::XInterface > iDesktop = xFactory->createInstance
+ ( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) );
+ uno::Reference< frame::XDesktop > xDesktop ( iDesktop, uno::UNO_QUERY );
+ uno::Reference< frame::XFrame > xFrame ( xDesktop->getCurrentFrame() );
+ uno::Reference< awt::XWindow > xContainerWindow( xFrame->getContainerWindow() );
+ uno::Reference< awt::XWindowPeer > xWindowPeer( xContainerWindow, uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XMessageBoxFactory > xMessageBoxFactory( xToolkit, uno::UNO_QUERY );
+
+ awt::Rectangle aRectangle;
+ uno::Reference< awt::XMessageBox > xMessageBox
+ = xMessageBoxFactory->createMessageBox
+ ( xWindowPeer, aRectangle, OUString::createFromAscii( "errorbox" ),
+ awt::MessageBoxButtons::BUTTONS_OK, aTitle, aMessage );
+
+ if ( xMessageBox.is() )
+ xMessageBox->execute();
+ //FIXME: exceptions not caught and printed at top level??
+ //else
+ //printf( "%s\n", OUSTRING_CSTR( aMessage ) );
+}
+
+void LayoutRoot::error( OUString const& message )
+{
+ OSL_TRACE( "%s\n", OUSTRING_CSTR( message ) );
+ ShowMessageBox( mxFactory, mxToolkit,
+ OUString::createFromAscii( "Fatal error" ),
+ message );
+ throw uno::RuntimeException( message, uno::Reference< uno::XInterface >() );
+}
+
+// XInitialization
+void SAL_CALL LayoutRoot::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw ( uno::Exception,
+ uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ if ( mbDisposed )
+ throw lang::DisposedException();
+
+ if ( mxContainer.is() ) // only 1 init ...
+ throw uno::Exception();
+
+ if ( !aArguments.getLength() )
+ throw lang::IllegalArgumentException();
+
+ OSL_ENSURE( aArguments.getLength() == 1, "Wrong arg count\n" );
+
+ OUString aXMLName;
+ if ( !( aArguments[0] >>= aXMLName ) )
+ throw lang::IllegalArgumentException();
+
+ uno::Reference< xml::sax::XParser > xParser
+ ( mxFactory->createInstance(
+ OUString::createFromAscii( "com.sun.star.xml.sax.Parser" ) ),
+ uno::UNO_QUERY );
+ OSL_ASSERT( xParser.is() );
+ if (! xParser.is())
+ {
+ throw uno::RuntimeException(
+ OUString::createFromAscii( "cannot create sax-parser component" ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+ // FIXME: quite possibly we want to pass this in ...
+ uno::Reference< awt::XToolkit > xToolkit;
+
+ mxToolkit = uno::Reference< awt::XToolkit >(
+ mxFactory->createInstance(
+ OUString::createFromAscii( "com.sun.star.awt.Toolkit" ) ),
+ uno::UNO_QUERY );
+
+ if ( !mxToolkit.is() )
+ throw uno::RuntimeException(
+ OUString::createFromAscii( "failed to create toolkit!" ),
+ uno::Reference< uno::XInterface >() );
+
+ OUString aXMLFile = readRightTranslation( aXMLName );
+ uno::Reference< io::XInputStream > xStream = getFileAsStream( aXMLFile );
+ if (! xStream.is() )
+ error( OUString::createFromAscii( "Installation problem: cannot find XML file:" ) + aXMLName );
+
+ // error handler, entity resolver omitted
+
+ ImportContext *pCtx = new ImportContext( *this );
+
+ uno::Reference< xml::input::XRoot > xRoot( pCtx );
+ uno::Sequence < uno::Any > aArgs( 1 );
+ aArgs[0] <<= xRoot;
+ uno::Reference< xml::sax::XDocumentHandler > xDocHandler
+ (mxFactory->createInstanceWithArguments
+ ( OUString::createFromAscii( "com.sun.star.xml.input.SaxDocumentHandler" ),
+ aArgs ), uno::UNO_QUERY );
+
+ if (! xDocHandler.is() )
+ error( OUString::createFromAscii( "cannot find SAx handler for document type of:") + aXMLName );
+
+ xParser->setDocumentHandler( xDocHandler );
+
+ xml::sax::InputSource source;
+ source.aInputStream = xStream;
+ source.sSystemId = OUString::createFromAscii( "virtual file" );
+
+ try
+ {
+ xParser->parseStream( source );
+ }
+ catch ( xml::sax::SAXParseException& e )
+ {
+ OUString c = OUString::createFromAscii( ":" );
+ error( aXMLName
+ + c + OUString::valueOf( e.LineNumber )
+ + c + OUString::valueOf( e.ColumnNumber )
+ + c + OUString::createFromAscii( "Sax parse error" ) );
+ }
+}
+
+// XLayoutContainer
+uno::Reference< awt::XLayoutContainer > LayoutRoot::getLayoutContainer() throw (uno::RuntimeException)
+{
+ return uno::Reference< awt::XLayoutContainer >();
+}
+
+// local helper ...
+void LayoutRoot::addItem( const OUString &rName,
+ const uno::Reference< awt::XLayoutConstrains > &xRef )
+{
+ maItems[ rName ] = xRef;
+}
+
+// XNameAccess
+uno::Any SAL_CALL LayoutRoot::getByName( const OUString &rName )
+ throw ( container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ if ( mbDisposed )
+ throw lang::DisposedException();
+
+ uno::Reference< awt::XLayoutConstrains > xItem;
+ ItemHash::iterator i = maItems.find( rName );
+ if ( i != maItems.end() )
+ xItem = i->second;
+ return uno::makeAny( xItem );
+}
+
+sal_Bool SAL_CALL LayoutRoot::hasByName( const OUString &rName )
+ throw (uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ if ( mbDisposed ) throw lang::DisposedException();
+
+ ItemHash::iterator i = maItems.find( rName );
+ return i != maItems.end();
+}
+
+uno::Sequence< OUString > SAL_CALL LayoutRoot::getElementNames()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+ if ( mbDisposed ) throw lang::DisposedException();
+
+ uno::Sequence< OUString > aNames( maItems.size() );
+ sal_Int32 nPos = 0;
+
+ for ( ItemHash::const_iterator it = maItems.begin();
+ it != maItems.end(); it++ )
+ aNames[ nPos++ ] = it->first;
+
+ return aNames;
+}
+
+uno::Type SAL_CALL LayoutRoot::getElementType()
+ throw ( uno::RuntimeException )
+{
+ return getCppuType( ( const uno::Reference< awt::XLayoutConstrains >* )NULL );
+}
+
+sal_Bool SAL_CALL LayoutRoot::hasElements()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ if ( mbDisposed ) throw lang::DisposedException();
+
+ return maItems.size() > 0;
+}
+
+// XComponent
+void SAL_CALL LayoutRoot::dispose()
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ if ( mbDisposed ) throw lang::DisposedException();
+
+ if ( mpListeners )
+ {
+
+ lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >(this) );
+ mpListeners->disposeAndClear( aSource );
+ delete mpListeners;
+ mpListeners = NULL;
+ }
+
+ maItems.clear();
+ mbDisposed = sal_True;
+}
+
+void SAL_CALL LayoutRoot::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ if ( mbDisposed ) throw lang::DisposedException();
+
+ if ( !mpListeners )
+ mpListeners = new ::cppu::OInterfaceContainerHelper( maMutex );
+ mpListeners->addInterface( xListener );
+}
+
+void SAL_CALL LayoutRoot::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
+ throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( maMutex );
+
+ if ( mbDisposed ) throw lang::DisposedException();
+
+ if ( mpListeners )
+ mpListeners->removeInterface( xListener );
+}
+
+// builder
+
+LayoutWidget *LayoutRoot::create( OUString id, const OUString unoName, long attrbs,uno::Reference< awt::XLayoutContainer > xParent )
+{
+ LayoutWidget *pWidget = new LayoutWidget( mxToolkit, xParent, unoName, attrbs );
+ if ( !mpToplevel )
+ {
+ mpToplevel = pWidget;
+ mxWindow = uno::Reference< awt::XWindow >( pWidget->getPeer(), uno::UNO_QUERY );
+ mxContainer = pWidget->mxContainer;
+ }
+ if ( pWidget->mxContainer.is() )
+ pWidget->mxContainer->setLayoutUnit( mxLayoutUnit );
+ if ( id.getLength() )
+ maItems[ id ] = pWidget->getPeer();
+ return pWidget;
+}
+
+#if 0
+uno::Reference< awt::XLayoutConstrains > LayoutRoot::getToplevel()
+{
+ if ( mpToplevel )
+ return mpToplevel->getPeer();
+ return uno::Reference< awt::XLayoutConstrains > ();
+}
+
+uno::Reference< awt::XLayoutConstrains > LayoutRoot::getById( OUString id )
+{
+ uno::Reference< awt::XLayoutConstrains > rRef = 0;
+ ItemHash::iterator it = maItems.find( id );
+ if ( it != maItems.end() )
+ rRef = it->second;
+ return rRef;
+}
+#endif
+
+LayoutWidget::LayoutWidget( uno::Reference< awt::XToolkit > xToolkit,
+ uno::Reference< awt::XLayoutContainer > xParent,
+ OUString unoName, long attrbs )
+{
+ while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
+ {
+ uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
+ assert( xContainer.is() );
+ xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
+ }
+
+ mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, attrbs );
+ assert( mxWidget.is() );
+ mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
+}
+
+LayoutWidget::~LayoutWidget()
+{
+ /* should we dispose of the references...? */
+ // at least of its children... Or should root?
+}
+
+bool LayoutWidget::addChild( LayoutWidget *pChild )
+{
+ if ( !mxContainer.is() )
+ return false;
+
+ try
+ {
+ mxContainer->addChild( pChild->mxWidget );
+ }
+ catch( awt::MaxChildrenException ex )
+ {
+ return false;
+ }
+ return true;
+}
+
+void LayoutWidget::setProperties( PropList const& rProps )
+{
+ ::layoutimpl::setProperties( mxWidget, rProps );
+}
+
+void LayoutWidget::setProperty( OUString const& attr, OUString const& value )
+{
+ ::layoutimpl::setProperty( mxWidget, attr, value );
+}
+
+void LayoutWidget::setChildProperties( LayoutWidget *pChild,
+ PropList const& rProps )
+{
+ uno::Reference< beans::XPropertySet > xChildPeer;
+ xChildPeer = mxContainer->getChildProperties( pChild->mxWidget );
+
+ if ( xChildPeer.is() )
+ ::layoutimpl::setProperties( xChildPeer, rProps );
+}
+
+} // namespace layoutimpl
+
diff --git a/toolkit/source/layout/core/root.hxx b/toolkit/source/layout/core/root.hxx
new file mode 100644
index 000000000000..321c891bbe50
--- /dev/null
+++ b/toolkit/source/layout/core/root.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 LAYOUT_CORE_ROOT_HXX
+#define LAYOUT_CORE_ROOT_HXX
+
+#define _BACKWARD_BACKWARD_WARNING_H 1
+#include <hash_map>
+
+#include <com/sun/star/awt/XLayoutRoot.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <toolkit/dllapi.h>
+
+#include <layout/core/proplist.hxx>
+
+namespace layoutimpl
+{
+
+namespace css = ::com::sun::star;
+
+css::uno::Reference< css::io::XInputStream > getFileAsStream( const rtl::OUString &rName );
+
+/* Interface generation code -- to hook to a parser. */
+
+/*
+ TODO: (ricardo) I think we should cut on LayoutRoot, stripping out its widget
+ proxy interface (just make it return the root widget). Would even make it easier
+ if there was interest to support multiple toplevel widgets in the same file.
+
+ We also need to make sure the code gets diposed well... There is no need to keep
+ these objects around after initialization...
+*/
+
+
+class LayoutWidget;
+
+class TOOLKIT_DLLPUBLIC LayoutRoot : public ::cppu::WeakImplHelper3<
+ css::awt::XLayoutRoot,
+ css::lang::XInitialization,
+ css::lang::XComponent>
+{
+protected:
+ ::osl::Mutex maMutex;
+
+ typedef std::hash_map< rtl::OUString,
+ css::uno::Reference< css::awt::XLayoutConstrains >,
+ ::rtl::OUStringHash > ItemHash;
+ ItemHash maItems;
+
+ sal_Bool mbDisposed;
+ css::uno::Reference< css::lang::XMultiServiceFactory > mxFactory;
+ ::cppu::OInterfaceContainerHelper *mpListeners;
+
+ css::uno::Reference< css::awt::XWindow > mxWindow;
+ css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
+
+ css::uno::Reference< css::awt::XToolkit > mxToolkit;
+ LayoutWidget *mpToplevel;
+ css::uno::Reference< css::awt::XLayoutUnit > mxLayoutUnit;
+
+ void error( rtl::OUString const& message );
+
+public:
+ LayoutRoot( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory );
+ virtual ~LayoutRoot();
+
+ void addItem( const rtl::OUString &rName,
+ const css::uno::Reference< css::awt::XLayoutConstrains > &xRef );
+
+ void setWindow( css::uno::Reference< css::awt::XLayoutConstrains > xPeer )
+ {
+ mxWindow = css::uno::Reference< css::awt::XWindow >( xPeer, css::uno::UNO_QUERY );
+ }
+
+ // get XLayoutContainer
+ virtual css::uno::Reference< css::awt::XLayoutContainer > SAL_CALL getLayoutContainer() throw (css::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) throw (css::uno::Exception, css::uno::RuntimeException);
+
+ // XNameAccess
+ virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException);
+ virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (css::uno::RuntimeException);
+ virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) throw (css::uno::RuntimeException);
+
+ // generator
+ virtual LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName, long attrbs, css::uno::Reference< css::awt::XLayoutContainer > xParent );
+};
+
+class TOOLKIT_DLLPUBLIC LayoutWidget
+{
+ friend class LayoutRoot;
+
+public:
+ LayoutWidget() {}
+ LayoutWidget( css::uno::Reference< css::awt::XToolkit > xToolkit,
+ css::uno::Reference< css::awt::XLayoutContainer > xToplevel,
+ rtl::OUString unoName, long attrbs );
+ virtual ~LayoutWidget();
+
+ virtual void setProperties( const PropList &rProps );
+ virtual void setProperty( rtl::OUString const& attr, rtl::OUString const& value );
+
+ virtual bool addChild( LayoutWidget *pChild );
+ virtual void setChildProperties( LayoutWidget *pChild, const PropList &rProps );
+
+ inline css::uno::Reference< css::awt::XLayoutConstrains > getPeer()
+ { return mxWidget; }
+ inline css::uno::Reference< css::awt::XLayoutContainer > getContainer()
+ { return mxContainer; }
+
+protected:
+ css::uno::Reference< css::awt::XLayoutConstrains > mxWidget;
+ css::uno::Reference< css::awt::XLayoutContainer > mxContainer;
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_ROOT_HXX */
diff --git a/toolkit/source/layout/core/table.cxx b/toolkit/source/layout/core/table.cxx
new file mode 100644
index 000000000000..48156b1d730e
--- /dev/null
+++ b/toolkit/source/layout/core/table.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include <table.hxx>
+
+#include <sal/macros.h>
+#include <osl/mutex.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <tools/debug.hxx>
+
+// fixed point precision for distributing error
+#define FIXED_PT 16
+
+namespace layoutimpl
+{
+
+using namespace com::sun::star;
+
+Table::ChildProps::ChildProps( Table::ChildData *pData )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ),
+ ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
+ &( pData->mbExpand[ 0 ] ) );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ),
+ ::getCppuType( static_cast< const sal_Bool* >( NULL ) ),
+ &( pData->mbExpand[ 1 ] ) );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ),
+ ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
+ &( pData->mnColSpan ) );
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ),
+ ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
+ &( pData->mnRowSpan ) );
+}
+
+bool Table::ChildData::isVisible()
+{
+ return Box_Base::ChildData::isVisible()
+ && ( mnColSpan > 0 ) && ( mnRowSpan > 0 );
+}
+
+Table::Table()
+ : Box_Base()
+ , mnColsLen( 1 )// another default value could be 0xffff for infinite columns( = 1 row )
+{
+ addProp( RTL_CONSTASCII_USTRINGPARAM( "Columns" ),
+ ::getCppuType( static_cast< const sal_Int32* >( NULL ) ),
+ &mnColsLen );
+}
+
+Table::ChildData::ChildData( uno::Reference< awt::XLayoutConstrains > const& xChild )
+ : Box_Base::ChildData( xChild )
+// , mbExpand( { 1, 1 } )
+ , mnColSpan( 1 )
+ , mnRowSpan( 1 )
+ , mnLeftCol( 0 )
+ , mnRightCol( 0 )
+ , mnTopRow( 0 )
+ , mnBottomRow( 0 )
+{
+ mbExpand[ 0 ] = 1;
+ mbExpand[ 1 ] = 1;
+}
+
+Table::ChildData*
+Table::createChild( uno::Reference< awt::XLayoutConstrains > const& xChild )
+{
+ return new ChildData( xChild );
+}
+
+Table::ChildProps*
+Table::createChildProps( Box_Base::ChildData *pData )
+{
+ return new ChildProps( static_cast<Table::ChildData*> ( pData ) );
+}
+
+void SAL_CALL
+Table::addChild( const uno::Reference< awt::XLayoutConstrains >& xChild )
+ throw( uno::RuntimeException, awt::MaxChildrenException )
+{
+ if ( xChild.is() )
+ {
+ Box_Base::addChild( xChild );
+ // cause of flicker
+ allocateChildAt( xChild, awt::Rectangle( 0,0,0,0 ) );
+ }
+}
+
+awt::Size SAL_CALL
+Table::getMinimumSize() throw( uno::RuntimeException )
+{
+ int nRowsLen = 0;
+
+ // 1. layout the table -- adjust to cope with row-spans...
+ {
+ // temporary 1D representation of the table
+ std::vector< ChildData *> aTable;
+
+ int col = 0;
+ int row = 0;
+ for ( std::list<Box_Base::ChildData *>::iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Table::ChildData*> ( *it );
+ if ( !child->isVisible() )
+ continue;
+
+ while ( col + SAL_MIN( child->mnColSpan, mnColsLen ) > mnColsLen )
+ {
+ col = 0;
+ row++;
+
+ unsigned int i = col +( row*mnColsLen );
+ while ( aTable.size() > i && !aTable[ i ] )
+ i++;
+
+ col = i % mnColsLen;
+ row = i / mnColsLen;
+ }
+
+ child->mnLeftCol = col;
+ child->mnRightCol = SAL_MIN( col + child->mnColSpan, mnColsLen );
+ child->mnTopRow = row;
+ child->mnBottomRow = row + child->mnRowSpan;
+
+ col += child->mnColSpan;
+
+ unsigned int start = child->mnLeftCol +( child->mnTopRow*mnColsLen );
+ unsigned int end =( child->mnRightCol-1 ) +( ( child->mnBottomRow-1 )*mnColsLen );
+ if ( aTable.size() < end+1 )
+ aTable.resize( end+1, NULL );
+ for ( unsigned int i = start; i < end; i++ )
+ aTable[ i ] = child;
+
+ nRowsLen = SAL_MAX( nRowsLen, child->mnBottomRow );
+ }
+ }
+
+ // 2. calculate columns/rows sizes
+ for ( int g = 0; g < 2; g++ )
+ {
+ std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
+
+ aGroup.clear();
+ aGroup.resize( g == 0 ? mnColsLen : nRowsLen );
+
+ // 2.1 base sizes on one-column/row children
+ for ( std::list<Box_Base::ChildData *>::iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Table::ChildData*> ( *it );
+ if ( !child->isVisible() )
+ continue;
+ const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
+ const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
+
+ if ( nFirstAttach == nLastAttach-1 )
+ {
+ child->maRequisition = child->mxChild->getMinimumSize();
+ int attach = nFirstAttach;
+ int child_size = g == 0 ? child->maRequisition.Width
+ : child->maRequisition.Height;
+ aGroup[ attach ].mnSize = SAL_MAX( aGroup[ attach ].mnSize,
+ child_size );
+ if ( child->mbExpand[ g ] )
+ aGroup[ attach ].mbExpand = true;
+ }
+ }
+
+ // 2.2 make sure multiple-columns/rows children fit
+ for ( std::list<Box_Base::ChildData *>::iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Table::ChildData*> ( *it );
+ if ( !child->isVisible() )
+ continue;
+ const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
+ const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
+
+ if ( nFirstAttach != nLastAttach-1 )
+ {
+ child->maRequisition = child->mxChild->getMinimumSize();
+ int size = 0;
+ int expandables = 0;
+ for ( int i = nFirstAttach; i < nLastAttach; i++ )
+ {
+ size += aGroup[ i ].mnSize;
+ if ( aGroup[ i ].mbExpand )
+ expandables++;
+ }
+
+ int child_size = g == 0 ? child->maRequisition.Width
+ : child->maRequisition.Height;
+ int extra = child_size - size;
+ if ( extra > 0 )
+ {
+ if ( expandables )
+ extra /= expandables;
+ else
+ extra /= nLastAttach - nFirstAttach;
+
+ for ( int i = nFirstAttach; i < nLastAttach; i++ )
+ if ( expandables == 0 || aGroup[ i ].mbExpand )
+ aGroup[ i ].mnSize += extra;
+ }
+ }
+ }
+ }
+
+ // 3. Sum everything up
+ mnColExpandables =( mnRowExpandables = 0 );
+ maRequisition.Width =( maRequisition.Height = 0 );
+ for ( std::vector<GroupData>::iterator it = maCols.begin();
+ it != maCols.end(); it++ )
+ {
+ maRequisition.Width += it->mnSize;
+ if ( it->mbExpand )
+ mnColExpandables++;
+ }
+ for ( std::vector<GroupData>::iterator it = maRows.begin();
+ it != maRows.end(); it++ )
+ {
+ maRequisition.Height += it->mnSize;
+ if ( it->mbExpand )
+ mnRowExpandables++;
+ }
+
+ return maRequisition;
+}
+
+void SAL_CALL
+Table::allocateArea( const awt::Rectangle &rArea )
+ throw( uno::RuntimeException )
+{
+ maAllocation = rArea;
+ if ( maCols.size() == 0 || maRows.size() == 0 )
+ return;
+
+ int nExtraSize[ 2 ] = { SAL_MAX( rArea.Width - maRequisition.Width, 0 ),
+ SAL_MAX( rArea.Height - maRequisition.Height, 0 ) };
+ // split it
+ nExtraSize[ 0 ] /= mnColExpandables ? mnColExpandables : mnColsLen;
+ nExtraSize[ 1 ] /= mnRowExpandables ? mnRowExpandables : maRows.size();
+
+ for ( std::list<Box_Base::ChildData *>::const_iterator it
+ = maChildren.begin(); it != maChildren.end(); it++ )
+ {
+ ChildData *child = static_cast<Table::ChildData*> ( *it );
+ if ( !child->isVisible() )
+ continue;
+
+ awt::Rectangle rChildArea( rArea.X, rArea.Y, 0, 0 );
+
+ for ( int g = 0; g < 2; g++ )
+ {
+ std::vector< GroupData > &aGroup = g == 0 ? maCols : maRows;
+ const int nFirstAttach = g == 0 ? child->mnLeftCol : child->mnTopRow;
+ const int nLastAttach = g == 0 ? child->mnRightCol : child->mnBottomRow;
+
+ for ( int i = 0; i < nFirstAttach; i++ )
+ {
+ int gSize = aGroup[ i ].mnSize;
+ if ( aGroup[ i ].mbExpand )
+ gSize += nExtraSize[ g ];
+ if ( g == 0 )
+ rChildArea.X += gSize;
+ else
+ rChildArea.Y += gSize;
+ }
+ for ( int i = nFirstAttach; i < nLastAttach; i++ )
+ {
+ int gSize = aGroup[ i ].mnSize;
+ if ( aGroup[ i ].mbExpand )
+ gSize += nExtraSize[ g ];
+ if ( g == 0 )
+ rChildArea.Width += gSize;
+ else
+ rChildArea.Height += gSize;
+ }
+ }
+
+ allocateChildAt( child->mxChild, rChildArea );
+ }
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/table.hxx b/toolkit/source/layout/core/table.hxx
new file mode 100644
index 000000000000..dd05eba38c41
--- /dev/null
+++ b/toolkit/source/layout/core/table.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 LAYOUT_CORE_TABLE_HXX
+#define LAYOUT_CORE_TABLE_HXX
+
+#include <layout/core/box-base.hxx>
+
+namespace layoutimpl
+{
+
+class Table : public Box_Base
+{
+public:
+ // Children properties
+ struct ChildData : public Box_Base::ChildData
+ {
+ sal_Bool mbExpand[ 2 ];
+ sal_Int32 mnColSpan;
+ sal_Int32 mnRowSpan;
+ int mnLeftCol;
+ int mnRightCol;
+ int mnTopRow;
+ int mnBottomRow;
+
+ ChildData( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ bool isVisible();
+ };
+
+ struct ChildProps : public Box_Base::ChildProps
+ {
+ ChildProps( ChildData *pData );
+ };
+
+protected:
+
+ // a group of children; either a column or a row
+ struct GroupData
+ {
+ sal_Bool mbExpand;
+ int mnSize; // request size (width or height)
+ GroupData() : mbExpand( false ), mnSize( 0 ) {}
+ };
+
+ // Table properties
+ sal_Int32 mnColsLen;
+ std::vector< GroupData > maCols;
+ std::vector< GroupData > maRows;
+ int mnColExpandables, mnRowExpandables;
+
+ ChildData *createChild( css::uno::Reference< css::awt::XLayoutConstrains > const& xChild );
+ ChildProps *createChildProps( Box_Base::ChildData* pData );
+
+public:
+ Table();
+
+ // css::awt::XLayoutContainer
+ virtual void SAL_CALL addChild( const css::uno::Reference< css::awt::XLayoutConstrains >& Child )
+ throw (css::uno::RuntimeException, css::awt::MaxChildrenException);
+
+ virtual void SAL_CALL allocateArea( const css::awt::Rectangle &rArea )
+ throw (css::uno::RuntimeException);
+
+ virtual css::awt::Size SAL_CALL getMinimumSize()
+ throw(css::uno::RuntimeException);
+
+ // unimplemented:
+ virtual sal_Bool SAL_CALL hasHeightForWidth()
+ throw(css::uno::RuntimeException)
+ { return false; }
+ virtual sal_Int32 SAL_CALL getHeightForWidth( sal_Int32 /*nWidth*/ )
+ throw(css::uno::RuntimeException)
+ { return maRequisition.Height; }
+};
+
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_TABLE_HXX */
diff --git a/toolkit/source/layout/core/timer.cxx b/toolkit/source/layout/core/timer.cxx
new file mode 100644
index 000000000000..f0975fd3f76b
--- /dev/null
+++ b/toolkit/source/layout/core/timer.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "timer.hxx"
+
+#include <vector>
+#include <list>
+#include <vcl/timer.hxx>
+#include <com/sun/star/awt/XLayoutContainer.hpp>
+
+namespace layoutimpl
+{
+using namespace ::com::sun::star;
+
+class AllocateTimer : public Timer
+{
+ typedef std::list< uno::Reference< awt::XLayoutContainer > > ContainerList;
+ ContainerList mxContainers;
+ uno::Reference< awt::XLayoutContainer > mxLastAdded;
+
+public:
+ AllocateTimer()
+ {
+ // timer set to 0 -- just process it as soon as it gets idle
+ SetTimeout( 0 );
+ }
+
+ static inline bool isParentOf( uno::Reference< awt::XLayoutContainer > xParent,
+ uno::Reference< awt::XLayoutContainer > xWidget )
+ {
+ while ( xWidget.is() )
+ {
+ if ( xWidget == xParent )
+ return true;
+ xWidget = uno::Reference< awt::XLayoutContainer >( xWidget->getParent(), uno::UNO_QUERY );
+ }
+ return false;
+ }
+
+ static inline void eraseChildren( ContainerList::iterator &it, ContainerList &list )
+ {
+ ContainerList::iterator jt = list.begin();
+ while ( jt != list.end() )
+ {
+ if ( it != jt && isParentOf( *it, *jt ) )
+ jt = list.erase( jt );
+ else
+ jt++;
+ }
+ }
+
+ static inline bool isContainerDamaged( uno::Reference< awt::XLayoutContainer > xContainer )
+ {
+ uno::Reference< awt::XLayoutConstrains > xConstrains( xContainer, uno::UNO_QUERY );
+ awt::Size lastReq( xContainer->getRequestedSize() );
+ awt::Size curReq( xConstrains->getMinimumSize() );
+ return lastReq.Width != curReq.Width || lastReq.Height != curReq.Height;
+ }
+
+ void add( const uno::Reference< awt::XLayoutContainer > &xContainer )
+ {
+ // small optimization
+ if ( mxLastAdded == xContainer )
+ return;
+ mxLastAdded = xContainer;
+
+ mxContainers.push_back( xContainer );
+ }
+
+ virtual void Timeout()
+ {
+ mxLastAdded = uno::Reference< awt::XLayoutContainer >();
+
+ // 1. remove duplications and children
+ for ( ContainerList::iterator it = mxContainers.begin();
+ it != mxContainers.end(); it++ )
+ eraseChildren( it, mxContainers );
+
+ // 2. check damage extent
+ for ( ContainerList::iterator it = mxContainers.begin();
+ it != mxContainers.end(); it++ )
+ {
+ uno::Reference< awt::XLayoutContainer > xContainer = *it;
+ while ( xContainer->getParent().is() && isContainerDamaged( xContainer ) )
+ {
+ xContainer = uno::Reference< awt::XLayoutContainer >(
+ xContainer->getParent(), uno::UNO_QUERY );
+ }
+
+ if ( *it != xContainer )
+ {
+ // 2.2 replace it with parent
+ *it = xContainer;
+
+ // 2.3 remove children of new parent
+ eraseChildren( it, mxContainers );
+ }
+ }
+
+ // 3. force re-calculations
+ for ( ContainerList::iterator it = mxContainers.begin();
+ it != mxContainers.end(); it++ )
+ (*it)->allocateArea( (*it)->getAllocatedArea() );
+ }
+};
+
+static void AddResizeTimeout( const uno::Reference< awt::XLayoutContainer > &xCont )
+{
+ static AllocateTimer timer;
+ timer.add( xCont );
+ timer.Start();
+}
+
+LayoutUnit::LayoutUnit() : LayoutUnit_Base()
+{
+}
+
+void SAL_CALL LayoutUnit::queueResize( const uno::Reference< awt::XLayoutContainer > &xContainer )
+ throw( uno::RuntimeException )
+{
+ AddResizeTimeout( xContainer );
+}
+
+}
diff --git a/toolkit/source/layout/core/timer.hxx b/toolkit/source/layout/core/timer.hxx
new file mode 100644
index 000000000000..f8432141c2f1
--- /dev/null
+++ b/toolkit/source/layout/core/timer.hxx
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 LAYOUT_CORE_TIMER_HXX
+#define LAYOUT_CORE_TIMER_HXX
+
+#include <com/sun/star/awt/XLayoutUnit.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace layoutimpl
+{
+
+typedef ::cppu::WeakImplHelper1< com::sun::star::awt::XLayoutUnit > LayoutUnit_Base;
+
+class LayoutUnit : public LayoutUnit_Base
+{
+public:
+ LayoutUnit();
+ void SAL_CALL queueResize( const com::sun::star::uno::Reference< com::sun::star::awt::XLayoutContainer > &xContainer )
+ throw( com::sun::star::uno::RuntimeException );
+};
+
+}
+
+#endif /* LAYOUT_CORE_TIMER_HXX */
diff --git a/toolkit/source/layout/core/translate.cxx b/toolkit/source/layout/core/translate.cxx
new file mode 100644
index 000000000000..fa09d02190d2
--- /dev/null
+++ b/toolkit/source/layout/core/translate.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "translate.hxx"
+
+#include <list>
+#if TEST_LAYOUT
+#include <cstdio>
+#include "tools/getprocessworkingdir.hxx"
+#endif
+
+#include <unotools/bootstrap.hxx>
+#include <unotools/localfilehelper.hxx>
+#include <unotools/ucbhelper.hxx>
+#include <vcl/svapp.hxx>
+
+#include "proplist.hxx"
+
+namespace layoutimpl
+{
+namespace css = ::com::sun::star;
+using namespace css;
+using ::rtl::OUString;
+using ::utl::LocalFileHelper;
+using ::utl::UCBContentHelper;
+using ::utl::Bootstrap;
+
+static std::list<OUString>
+getLocaleSubdirList( lang::Locale const& rLocale )
+{
+ std::list<OUString> aSubdirs;
+ aSubdirs.push_front( OUString::createFromAscii( "." ) );
+ aSubdirs.push_front( OUString::createFromAscii( "en-US" ) );
+ if ( rLocale.Language.getLength() )
+ aSubdirs.push_front( rLocale.Language );
+ if ( rLocale.Country.getLength() )
+ {
+ OUString aLocaleCountry = rLocale.Language
+ + OUString::createFromAscii( "-" )
+ + rLocale.Country;
+ aSubdirs.push_front( aLocaleCountry );
+ if ( rLocale.Variant.getLength() )
+ aSubdirs.push_front( aLocaleCountry
+ + OUString::createFromAscii( "." )
+ + rLocale.Variant );
+ }
+ return aSubdirs;
+}
+
+static bool
+fileExists( String const& aFile )
+{
+ String aUrl;
+ LocalFileHelper::ConvertPhysicalNameToURL( aFile, aUrl );
+ return UCBContentHelper::Exists( aUrl );
+}
+
+static OUString
+getFirstExisting( OUString const& aDir, std::list<OUString> const& aSubDirs,
+ OUString const& aXMLName )
+{
+ static OUString const aSlash = OUString::createFromAscii( "/" );
+ String aResult;
+ for ( std::list<OUString>::const_iterator i = aSubDirs.begin();
+ i != aSubDirs.end(); i++ )
+ {
+ String aFile = aDir + aSlash + *i + aSlash + aXMLName;
+ OSL_TRACE( "testing: %s", OUSTRING_CSTR( aFile ) );
+ if ( fileExists( aFile ) )
+ return aFile;
+ }
+ return OUString();
+}
+
+/* FIXME: IWBN to share code with impimagetree.cxx, also for reading
+ from zip files. */
+OUString
+readRightTranslation( OUString const& aXMLName )
+{
+ String aXMLFile;
+ std::list<OUString> aSubdirs
+ = getLocaleSubdirList( Application::GetSettings().GetUILocale() );
+#if TEST_LAYOUT // read from cwd first
+ OUString aCurrentWorkingUrl;
+ tools::getProcessWorkingDir( &aCurrentWorkingUrl );
+ String aCurrentWorkingDir;
+ LocalFileHelper::ConvertURLToPhysicalName( aCurrentWorkingUrl, aCurrentWorkingDir );
+ aXMLFile = getFirstExisting( aCurrentWorkingDir, aSubdirs, aXMLName );
+ if ( aXMLFile.Len() )
+ ;
+ else
+#endif /* TEST_LAYOUT */
+ {
+ OUString aShareUrl;
+ Bootstrap::locateSharedData( aShareUrl );
+ OUString aXMLUrl = aShareUrl + OUString::createFromAscii( "/layout" );
+ String aXMLDir;
+ LocalFileHelper::ConvertURLToPhysicalName( aXMLUrl, aXMLDir );
+ aXMLFile = getFirstExisting( aXMLDir, aSubdirs, aXMLName );
+ }
+
+ OSL_TRACE( "FOUND:%s", OUSTRING_CSTR ( OUString (aXMLFile) ) );
+ return aXMLFile;
+}
+
+} // namespace layoutimpl
diff --git a/toolkit/source/layout/core/translate.hxx b/toolkit/source/layout/core/translate.hxx
new file mode 100644
index 000000000000..597b4a88530e
--- /dev/null
+++ b/toolkit/source/layout/core/translate.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_CORE_TRANSLATE_HXX
+#define LAYOUT_CORE_TRANSLATE_HXX
+
+namespace rtl {
+class OUString;
+} // namespace rtl
+
+namespace layoutimpl
+{
+::rtl::OUString readRightTranslation( ::rtl::OUString const& aXMLName );
+} // namespace layoutimpl
+
+#endif /* LAYOUT_CORE_TRANSLATE_HXX */
diff --git a/toolkit/source/layout/core/vcl.cxx b/toolkit/source/layout/core/vcl.cxx
new file mode 100644
index 000000000000..2b8d910584e9
--- /dev/null
+++ b/toolkit/source/layout/core/vcl.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include <vcl.hxx>
+
+#include <sal/types.h>
+#include <vcl/button.hxx>
+
+static PushButton* get_button (Dialog const* dialog, sal_uInt32 type)
+{
+ Window* child = dialog->GetWindow (WINDOW_FIRSTCHILD);
+ while (child)
+ {
+ if (child->GetType () == type)
+ return static_cast <PushButton*> (child);
+ child = child->GetWindow (WINDOW_NEXT);
+ }
+
+ return 0;
+}
+
+#define IMPLEMENT_CLOSING_DIALOG(cls)\
+ Closing##cls::Closing##cls (Window* parent, WinBits bits)\
+ : cls (parent, bits)\
+ , mClosing (false)\
+ {\
+ }\
+ BOOL Closing##cls::Close ()\
+ {\
+ if (mClosing)\
+ EndDialog (false);\
+ else if (PushButton *cancel = get_button (this, WINDOW_CANCELBUTTON))\
+ cancel->Click ();\
+ else if (PushButton *ok = get_button (this, WINDOW_OKBUTTON))\
+ ok->Click ();\
+ mClosing = true;\
+ return false;\
+ }
+
+IMPLEMENT_CLOSING_DIALOG (Dialog);
+IMPLEMENT_CLOSING_DIALOG (ModelessDialog);
+IMPLEMENT_CLOSING_DIALOG (ModalDialog);
diff --git a/toolkit/source/layout/core/vcl.hxx b/toolkit/source/layout/core/vcl.hxx
new file mode 100644
index 000000000000..20cc77dc7f82
--- /dev/null
+++ b/toolkit/source/layout/core/vcl.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_CORE_VCL_HXX
+#define LAYOUT_CORE_VCL_HXX
+
+#include <vcl/dialog.hxx>
+
+#define DECLARE_CLOSING_DIALOG(cls)\
+ class Closing##cls : public cls\
+ {\
+ public:\
+ bool mClosing;\
+ Closing##cls (Window* parent, WinBits bits);\
+ virtual BOOL Close ();\
+ }
+
+DECLARE_CLOSING_DIALOG (Dialog);
+DECLARE_CLOSING_DIALOG (ModalDialog);
+DECLARE_CLOSING_DIALOG (ModelessDialog);
+
+#undef DECLARE_CLOSING_DIALOG
+
+#endif /* LAYOUT_CORE_VCL_HXX */
diff --git a/toolkit/source/layout/vcl/makefile.mk b/toolkit/source/layout/vcl/makefile.mk
new file mode 100644
index 000000000000..529ddc31d97e
--- /dev/null
+++ b/toolkit/source/layout/vcl/makefile.mk
@@ -0,0 +1,52 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../../..
+PRJNAME=toolkit
+TARGET=layout-vcl
+ENABLE_EXCEPTIONS=true
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(COMNAME)" == "gcc3"
+CFLAGS+=-Wall -fno-default-inline
+.ENDIF
+
+# --- Files --------------------------------------------------------
+
+SLOFILES= \
+ $(SLO)$/wrapper.obj \
+ $(SLO)$/wbutton.obj \
+ $(SLO)$/wcontainer.obj \
+ $(SLO)$/wfield.obj
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/toolkit/source/layout/vcl/wbutton.cxx b/toolkit/source/layout/vcl/wbutton.cxx
new file mode 100644
index 000000000000..26d4410ccf9a
--- /dev/null
+++ b/toolkit/source/layout/vcl/wbutton.cxx
@@ -0,0 +1,681 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "wrapper.hxx"
+
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XActionListener.hpp>
+#include <com/sun/star/awt/XButton.hpp>
+#include <com/sun/star/awt/XCheckBox.hpp>
+#include <com/sun/star/awt/XRadioButton.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <vcl/button.hxx>
+#include <vcl/event.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+
+#include <list>
+
+#include <layout/core/helper.hxx>
+
+using namespace ::com::sun::star;
+
+using rtl::OUString;
+
+namespace layout
+{
+
+class ImageImpl
+{
+ public:
+ uno::Reference< graphic::XGraphic > mxGraphic;
+ ImageImpl( const char *pName )
+ : mxGraphic( layoutimpl::loadGraphic( pName ) )
+ {
+ if ( !mxGraphic.is() )
+ {
+ DBG_ERROR1( "ERROR: failed to load image: `%s'\n", pName );
+ }
+ }
+};
+
+Image::Image( const char *pName )
+ : pImpl( new ImageImpl( pName ) )
+{
+}
+
+Image::~Image()
+{
+ delete pImpl;
+}
+
+class ButtonImpl : public ControlImpl
+ , public ::cppu::WeakImplHelper1< awt::XActionListener >
+{
+ Link maClickHdl;
+
+public:
+ uno::Reference< awt::XButton > mxButton;
+ ButtonImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ControlImpl( context, peer, window )
+ , mxButton( peer, uno::UNO_QUERY )
+ {
+ /* We have default action when clicked, always listen. */
+ mxButton->addActionListener( this );
+ }
+
+ ~ButtonImpl()
+ {
+ }
+
+ virtual void Click() { /* make me pure virtual? */ };
+
+ Link& GetClickHdl ()
+ {
+ return maClickHdl;
+ }
+
+ virtual void SetClickHdl( Link const& link )
+ {
+ maClickHdl = link;
+ }
+
+ void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+ {
+ mxButton->removeActionListener( this );
+ ControlImpl::disposing (e);
+ mxButton.clear ();
+ }
+
+ virtual void SAL_CALL actionPerformed( const awt::ActionEvent& )
+ throw (uno::RuntimeException)
+ {
+ if ( !maClickHdl )
+ Click();
+ else
+ maClickHdl.Call( static_cast<Window *>( mpWindow ) );
+ }
+
+ bool SetModeImage( uno::Reference< graphic::XGraphic > xGraph )
+ {
+ setProperty( "Graphic", uno::Any( xGraph ) );
+ return true;
+ }
+};
+
+Button::~Button ()
+{
+}
+
+String Button::GetStandardText (sal_uInt16 button_type)
+{
+ return ::Button::GetStandardText (button_type);
+}
+
+void Button::SetText( OUString const& rStr )
+{
+ if ( !getImpl().mxButton.is() )
+ return;
+ getImpl().mxButton->setLabel( rStr );
+}
+
+void Button::SetClickHdl( const Link& link )
+{
+ if (&getImpl () && getImpl().mxButton.is ())
+ getImpl().SetClickHdl( link );
+}
+
+Link& Button::GetClickHdl ()
+{
+ return getImpl().GetClickHdl ();
+}
+
+bool Button::SetModeImage (Image const& image)
+{
+ return getImpl().SetModeImage (image.getImpl().mxGraphic);
+}
+
+bool Button::SetModeImage (::Image const& image, BmpColorMode mode)
+{
+ return GetButton ()->SetModeImage (image, mode);
+}
+
+void Button::SetImageAlign( ImageAlign eAlign )
+{
+ getImpl().setProperty( "ImageAlign", uno::Any( (sal_Int16) eAlign ) );
+}
+
+void Button::Click()
+{
+}
+
+IMPL_GET_IMPL( Button );
+IMPL_CONSTRUCTORS( Button, Control, "button" );
+IMPL_GET_WINDOW (Button);
+
+class PushButtonImpl : public ButtonImpl
+ , public ::cppu::WeakImplHelper1< awt::XItemListener >
+{
+ Link maToggleHdl;
+public:
+ PushButtonImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ButtonImpl( context, peer, window )
+ {
+ }
+
+ void SetToggleHdl( const Link& link )
+ {
+ // XButton doesn't have an explicit event for Toggle. Anyway, it is a
+ // superset of the clicks: all clicks, and explicit toggles
+ if (!link && !!maToggleHdl)
+ mxButton->removeActionListener( this );
+ else if (!!link && !maToggleHdl)
+ mxButton->addActionListener( this );
+ maToggleHdl = link;
+ }
+ void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+ {
+ ButtonImpl::disposing (e);
+ }
+ virtual void SAL_CALL actionPerformed( awt::ActionEvent const& e )
+ throw (uno::RuntimeException)
+ {
+ ButtonImpl::actionPerformed( e );
+ fireToggle();
+ }
+ virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
+ throw (uno::RuntimeException)
+ {
+ maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
+ }
+ void fireToggle()
+ {
+ maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
+ }
+
+};
+
+PushButton::~PushButton ()
+{
+ SetToggleHdl (Link ());
+}
+
+void PushButton::Check( bool bCheck )
+{
+ getImpl().setProperty( "State", uno::Any( (sal_Int16) !!bCheck ) );
+ // XButton doesn't have explicit toggle event
+ getImpl().fireToggle();
+}
+
+bool PushButton::IsChecked() const
+{
+ return !!( getImpl().getProperty( "State" ).get< sal_Int16 >() );
+}
+
+void PushButton::Toggle()
+{
+ Check( true );
+}
+
+void PushButton::SetToggleHdl( const Link& link )
+{
+ if (&getImpl () && getImpl().mxButton.is ())
+ getImpl().SetToggleHdl( link );
+}
+
+IMPL_GET_IMPL( PushButton );
+IMPL_CONSTRUCTORS( PushButton, Button, "pushbutton" );
+IMPL_GET_WINDOW (PushButton);
+
+class RadioButtonImpl : public ButtonImpl
+ , public ::cppu::WeakImplHelper1< awt::XItemListener >
+{
+ Link maToggleHdl;
+public:
+ uno::Reference< awt::XRadioButton > mxRadioButton;
+ RadioButtonImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ButtonImpl( context, peer, window )
+ , mxRadioButton( peer, uno::UNO_QUERY )
+ {
+ }
+
+ void Check( bool bCheck )
+ {
+ if ( !mxRadioButton.is() )
+ return;
+
+#if 1
+ // Have setState fire item event for
+ // RadioGroups::RadioGroup::itemStateChanged ()
+ ::RadioButton *r = static_cast<RadioButton*>(mpWindow)->GetRadioButton ();
+ bool state = r->IsRadioCheckEnabled ();
+ r->EnableRadioCheck();
+ mxRadioButton->setState( !!bCheck );
+ r->EnableRadioCheck (state);
+#else
+ mxRadioButton->setState( !!bCheck );
+#endif
+ fireToggle();
+ }
+
+ bool IsChecked()
+ {
+ if ( !mxRadioButton.is() )
+ return false;
+ return mxRadioButton->getState();
+ }
+
+ void SetToggleHdl( const Link& link )
+ {
+ if (!link && !!maToggleHdl)
+ mxRadioButton->removeItemListener( this );
+ else if (!!link && !maToggleHdl)
+ mxRadioButton->addItemListener( this );
+ maToggleHdl = link;
+ }
+
+ inline void fireToggle()
+ {
+ maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
+ }
+
+ virtual void SetClickHdl( const Link& link )
+ {
+ // Keep RadioGroups::RadioGroup's actionListener at HEAD
+ // of list. This way, it can handle RadioGroup's button
+ // states before all other callbacks and make sure the
+ // client code has the right state.
+
+ // IWBN to add an XRadioButton2 and layout::VCLXRadioButton
+ // with {get,set}RadioGroup() (and a "radiogroup" property
+ // even) and handle the grouping here in RadioButtonImpl.
+ uno::Reference< uno::XInterface > x = static_cast<VCLXRadioButton*> (mpWindow->GetVCLXWindow ())->getFirstActionListener ();
+ uno::Reference< awt::XActionListener > a = uno::Reference< awt::XActionListener> (x ,uno::UNO_QUERY );
+ mxButton->removeActionListener (a);
+ ButtonImpl::SetClickHdl (link);
+ mxButton->addActionListener (a);
+ }
+
+ void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+ {
+ ButtonImpl::disposing (e);
+ }
+
+ virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
+ throw (uno::RuntimeException)
+ {
+ maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
+ }
+};
+
+RadioButton::~RadioButton ()
+{
+ SetToggleHdl (Link ());
+}
+
+void RadioButton::Check( bool bCheck )
+{
+ getImpl().Check( bCheck );
+}
+
+bool RadioButton::IsChecked() const
+{
+ return getImpl().IsChecked();
+}
+
+void RadioButton::SetToggleHdl( const Link& link )
+{
+ if (&getImpl () && getImpl().mxRadioButton.is ())
+ getImpl().SetToggleHdl( link );
+}
+
+IMPL_GET_IMPL( RadioButton );
+IMPL_GET_WINDOW( RadioButton );
+IMPL_GET_VCLXWINDOW( RadioButton );
+IMPL_CONSTRUCTORS( RadioButton, Button, "radiobutton" );
+
+class CheckBoxImpl : public ButtonImpl
+ , public ::cppu::WeakImplHelper1< awt::XItemListener >
+{
+ Link maToggleHdl;
+ public:
+ uno::Reference< awt::XCheckBox > mxCheckBox;
+ CheckBoxImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ButtonImpl( context, peer, window )
+ , mxCheckBox( peer, uno::UNO_QUERY )
+ {
+ }
+
+ void SetToggleHdl( const Link& link )
+ {
+ if (!link && !!maToggleHdl)
+ mxCheckBox->removeItemListener( this );
+ else if (!!link && !maToggleHdl)
+ mxCheckBox->addItemListener( this );
+ maToggleHdl = link;
+ }
+ void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+ {
+ ButtonImpl::disposing (e);
+ }
+ virtual void SAL_CALL itemStateChanged( const awt::ItemEvent& )
+ throw (uno::RuntimeException)
+ {
+ maToggleHdl.Call( static_cast<Window *>( mpWindow ) );
+ }
+};
+
+CheckBox::~CheckBox ()
+{
+ SetToggleHdl (Link ());
+}
+
+void CheckBox::Check( bool bCheck )
+{
+ if ( !getImpl().mxCheckBox.is() )
+ return;
+ getImpl().mxCheckBox->setState( !!bCheck );
+}
+
+bool CheckBox::IsChecked() const
+{
+ if ( !getImpl().mxCheckBox.is() )
+ return false;
+ return getImpl().mxCheckBox->getState() != 0;
+}
+
+void CheckBox::SetToggleHdl( const Link& link )
+{
+ if (&getImpl () && getImpl().mxCheckBox.is ())
+ getImpl().SetToggleHdl( link );
+}
+
+IMPL_GET_IMPL( CheckBox );
+IMPL_CONSTRUCTORS( CheckBox, Button, "checkbox" );
+
+#define BUTTON_IMPL(t, parent, response) \
+ class t##Impl : public parent##Impl \
+ { \
+ public: \
+ t##Impl( Context *context, PeerHandle const& peer, Window *window ) \
+ : parent##Impl( context, peer, window ) \
+ { \
+ } \
+ void Click() \
+ { \
+ if (Dialog *d = static_cast<Dialog *> (mpCtx)) \
+ d->EndDialog( response ); \
+ } \
+ }
+
+/* Common button types currently unavailable in OOo: */
+/* mpReset */
+/* mpApply */
+/* mpAction */
+#define RET_RESET 6
+#define RET_APPLY 7
+#define BUTTONID_RESET RET_RESET
+#define BUTTONID_APPLY RET_APPLY
+
+BUTTON_IMPL( OKButton, PushButton, BUTTONID_OK );
+BUTTON_IMPL( CancelButton, PushButton, BUTTONID_CANCEL );
+BUTTON_IMPL( YesButton, PushButton, BUTTONID_YES );
+BUTTON_IMPL( NoButton, PushButton, BUTTONID_NO );
+BUTTON_IMPL( RetryButton, PushButton, BUTTONID_RETRY );
+BUTTON_IMPL( IgnoreButton, PushButton, BUTTONID_IGNORE );
+BUTTON_IMPL( ResetButton, PushButton, BUTTONID_RESET );
+BUTTON_IMPL( ApplyButton, PushButton, BUTTONID_APPLY ); /* Deprecated? */
+BUTTON_IMPL( HelpButton, PushButton, BUTTONID_HELP );
+
+IMPL_CONSTRUCTORS( OKButton, PushButton, "okbutton" );
+IMPL_CONSTRUCTORS( CancelButton, PushButton, "cancelbutton" );
+IMPL_CONSTRUCTORS( YesButton, PushButton, "yesbutton" );
+IMPL_CONSTRUCTORS( NoButton, PushButton, "nobutton" );
+IMPL_CONSTRUCTORS( RetryButton, PushButton, "retrybutton" );
+IMPL_CONSTRUCTORS( IgnoreButton, PushButton, "ignorebutton" );
+IMPL_CONSTRUCTORS( ResetButton, PushButton, "resetbutton" );
+IMPL_CONSTRUCTORS( ApplyButton, PushButton, "applybutton" ); /* Deprecated? */
+IMPL_CONSTRUCTORS( HelpButton, PushButton, "helpbutton" );
+
+IMPL_IMPL (ImageButton, PushButton)
+
+
+IMPL_CONSTRUCTORS( ImageButton, PushButton, "imagebutton" );
+
+class AdvancedButtonImpl : public PushButtonImpl
+{
+protected:
+ bool bAdvancedMode;
+ std::list< Window*> maAdvanced;
+ std::list< Window*> maSimple;
+
+public:
+ rtl::OUString mAdvancedLabel;
+ rtl::OUString mSimpleLabel;
+
+protected:
+ Window* Remove( std::list< Window*> lst, Window* w )
+ {
+ for ( std::list< Window*>::iterator it = maAdvanced.begin();
+ it != maAdvanced.end(); it++ )
+ if ( *it == w )
+ {
+ lst.erase( it );
+ return *it;
+ }
+ return 0;
+ }
+
+public:
+ AdvancedButtonImpl( Context *context, PeerHandle const& peer, Window *window )
+ : PushButtonImpl( context, peer, window )
+ , bAdvancedMode( false )
+ // TODO: i18n
+ // Button::GetStandardText( BUTTON_ADVANCED );
+ // Button::GetStandardText( BUTTON_SIMPLE );
+ , mAdvancedLabel( rtl::OUString::createFromAscii( "Advanced..." ) )
+ , mSimpleLabel( rtl::OUString::createFromAscii( "Simple..." ) )
+ {
+ }
+ void Click()
+ {
+ bAdvancedMode = !bAdvancedMode;
+ if ( bAdvancedMode )
+ advancedMode();
+ else
+ simpleMode();
+ }
+ void setAlign ()
+ {
+ ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
+ b->SetSymbolAlign (SYMBOLALIGN_RIGHT);
+ b->SetSmallSymbol ();
+ //mpWindow->SetStyle (mpWindow->GetStyle() | WB_CENTER);
+ }
+ void advancedMode()
+ {
+ ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
+ b->SetSymbol (SYMBOL_PAGEUP);
+ setAlign ();
+ if (mSimpleLabel.getLength ())
+ b->SetText (mSimpleLabel);
+ for ( std::list< Window*>::iterator it = maAdvanced.begin();
+ it != maAdvanced.end(); it++ )
+ ( *it )->Show();
+ for ( std::list< Window*>::iterator it = maSimple.begin();
+ it != maSimple.end(); it++ )
+ ( *it )->Hide();
+
+ redraw ();
+ }
+ void simpleMode()
+ {
+ //mxButton->setLabel( mSimpleLabel );
+ ::PushButton *b = static_cast<PushButton*> (mpWindow)->GetPushButton ();
+ b->SetSymbol (SYMBOL_PAGEDOWN);
+ if (mAdvancedLabel.getLength ())
+ b->SetText (mAdvancedLabel);
+ setAlign ();
+ for ( std::list< Window*>::iterator it = maAdvanced.begin();
+ it != maAdvanced.end(); it++ )
+ ( *it )->Hide();
+ for ( std::list< Window*>::iterator it = maSimple.begin();
+ it != maSimple.end(); it++ )
+ ( *it )->Show();
+
+ redraw (true);
+ }
+ void AddAdvanced( Window* w )
+ {
+ maAdvanced.push_back( w );
+ if ( !bAdvancedMode )
+ w->Hide();
+ }
+ void AddSimple( Window* w )
+ {
+ maSimple.push_back( w );
+ if ( bAdvancedMode )
+ w->Hide();
+ }
+ void RemoveAdvanced( Window* w )
+ {
+ Remove( maAdvanced, w );
+ }
+ void RemoveSimple( Window* w )
+ {
+ Remove( maSimple, w );
+ }
+};
+
+void AdvancedButton::AddAdvanced( Window* w )
+{
+ getImpl().AddAdvanced( w );
+}
+
+void AdvancedButton::AddSimple( Window* w )
+{
+ getImpl().AddSimple( w );
+}
+
+void AdvancedButton::RemoveAdvanced( Window* w )
+{
+ getImpl().RemoveAdvanced( w );
+}
+
+void AdvancedButton::RemoveSimple( Window* w )
+{
+ getImpl().RemoveSimple( w );
+}
+
+void AdvancedButton::SetAdvancedText (rtl::OUString const& text)
+{
+ if (text.getLength ())
+ getImpl ().mAdvancedLabel = text;
+}
+
+void AdvancedButton::SetSimpleText (rtl::OUString const& text)
+{
+ if (text.getLength ())
+ getImpl ().mSimpleLabel = text;
+}
+
+rtl::OUString AdvancedButton::GetAdvancedText () const
+{
+ return getImpl ().mAdvancedLabel;
+}
+
+rtl::OUString AdvancedButton::GetSimpleText () const
+{
+ return getImpl ().mSimpleLabel;
+}
+
+void AdvancedButton::SetDelta (int)
+{
+}
+
+IMPL_CONSTRUCTORS_BODY( AdvancedButton, PushButton, "advancedbutton", getImpl().simpleMode () );
+IMPL_GET_IMPL( AdvancedButton );
+
+
+class MoreButtonImpl : public AdvancedButtonImpl
+{
+public:
+ MoreButtonImpl( Context *context, PeerHandle const& peer, Window *window )
+ : AdvancedButtonImpl( context, peer, window)
+ {
+ mSimpleLabel = Button::GetStandardText( BUTTON_MORE );
+ mAdvancedLabel = Button::GetStandardText( BUTTON_LESS );
+ }
+ void AddWindow( Window* w ) { AddAdvanced( w ); }
+ void RemoveWindow( Window* w ) { RemoveAdvanced( w ); }
+};
+
+// TODO
+//BUTTON_IMPL( MoreButton, PushButton, 0 );
+IMPL_CONSTRUCTORS_BODY( MoreButton, AdvancedButton, "morebutton", getImpl().simpleMode () );
+IMPL_GET_IMPL( MoreButton );
+
+void MoreButton::AddWindow( Window* w )
+{
+ getImpl().AddWindow( w );
+}
+
+void MoreButton::RemoveWindow( Window* w )
+{
+ getImpl().RemoveWindow( w );
+}
+
+void MoreButton::SetMoreText (rtl::OUString const& text)
+{
+ SetAdvancedText (text);
+}
+
+void MoreButton::SetLessText (rtl::OUString const& text)
+{
+ SetSimpleText (text);
+}
+
+rtl::OUString MoreButton::GetMoreText () const
+{
+ return GetAdvancedText ();
+}
+
+rtl::OUString MoreButton::GetLessText () const
+{
+ return GetSimpleText ();
+}
+
+} // namespace layout
diff --git a/toolkit/source/layout/vcl/wcontainer.cxx b/toolkit/source/layout/vcl/wcontainer.cxx
new file mode 100644
index 000000000000..712aae19934d
--- /dev/null
+++ b/toolkit/source/layout/vcl/wcontainer.cxx
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "wrapper.hxx"
+
+#include <com/sun/star/awt/XLayoutRoot.hpp>
+#include <com/sun/star/awt/XLayoutContainer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <layout/core/helper.hxx>
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+
+namespace layout
+{
+
+Container::Container( Context const* context, char const* pId )
+ : mxContainer( context->GetPeerHandle( pId ), uno::UNO_QUERY )
+{
+ if ( !mxContainer.is() )
+ {
+ DBG_ERROR1( "Error: failed to associate container with '%s'", pId );
+ }
+}
+
+Container::Container( rtl::OUString const& rName, sal_Int32 nBorder )
+{
+ mxContainer = layoutimpl::WidgetFactory::createContainer( rName );
+
+ uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Border" ) ),
+ uno::Any( nBorder ) );
+}
+
+void Container::Add( Window *pChild )
+{
+ if ( pChild )
+ {
+ uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
+ mxContainer->addChild( xChild );
+ }
+}
+
+void Container::Add( Container *pChild )
+{
+ if ( pChild )
+ {
+ uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
+ mxContainer->addChild( xChild );
+ }
+}
+
+void Container::Remove( Window *pChild )
+{
+ if ( pChild )
+ {
+ uno::Reference< awt::XLayoutConstrains > xChild( pChild->GetPeer(), uno::UNO_QUERY );
+ mxContainer->removeChild( xChild );
+ }
+}
+
+void Container::Remove( Container *pChild )
+{
+ if ( pChild )
+ {
+ uno::Reference< awt::XLayoutConstrains > xChild( pChild->getImpl(), uno::UNO_QUERY );
+ mxContainer->removeChild( xChild );
+ }
+}
+
+void Container::Clear()
+{
+ css::uno::Sequence< css::uno::Reference < css::awt::XLayoutConstrains > > children;
+ children = mxContainer->getChildren();
+ for (int i = 0; i < children.getLength(); i++)
+ mxContainer->removeChild( children[i] );
+}
+
+void Container::ShowAll( bool bShow )
+{
+ struct inner
+ {
+ static void setChildrenVisible( uno::Reference < awt::XLayoutContainer > xCont,
+ bool bVisible ) /* auxiliary */
+ {
+ if ( xCont.is() )
+ {
+ uno::Sequence< uno::Reference < awt::XLayoutConstrains > > aChildren;
+ aChildren = xCont->getChildren();
+ for (int i = 0; i < aChildren.getLength(); i++)
+ {
+ uno::Reference < awt::XLayoutConstrains > xChild( aChildren[ i ] );
+
+ uno::Reference< awt::XWindow > xWin( xChild, uno::UNO_QUERY);
+ if ( xWin.is() )
+ xWin->setVisible( bVisible );
+
+ uno::Reference < awt::XLayoutContainer > xChildCont(
+ xChild, uno::UNO_QUERY );
+ setChildrenVisible( xChildCont, bVisible );
+ }
+ }
+ }
+ };
+
+ inner::setChildrenVisible( mxContainer, bShow );
+}
+
+void Container::Show()
+{
+ ShowAll( true );
+}
+
+void Container::Hide()
+{
+ ShowAll( false );
+}
+
+Table::Table( sal_Int32 nBorder, sal_Int32 nColumns )
+ : Container( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "table" ) ), nBorder )
+{
+ uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ) ),
+ uno::Any( nColumns ) );
+}
+
+void Table::Add( Window *window, bool bXExpand, bool bYExpand,
+ sal_Int32 nXSpan, sal_Int32 nYSpan )
+{
+ if ( !window )
+ return;
+ WindowImpl &rImpl = window->getImpl();
+ uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
+ uno::UNO_QUERY );
+ mxContainer->addChild( xChild );
+ setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
+}
+
+void Table::Add( Container *pContainer, bool bXExpand, bool bYExpand,
+ sal_Int32 nXSpan, sal_Int32 nYSpan )
+{
+ if ( !pContainer )
+ return;
+ uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
+ uno::UNO_QUERY );
+ mxContainer->addChild( xChild );
+ setProps( xChild, bXExpand, bYExpand, nXSpan, nYSpan );
+}
+
+void Table::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
+ bool bXExpand, bool bYExpand, sal_Int32 nXSpan, sal_Int32 nYSpan )
+{
+ uno::Reference< beans::XPropertySet > xProps
+ ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "XExpand" ) ),
+ uno::Any( bXExpand ) );
+ xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "YExpand" ) ),
+ uno::Any( bYExpand ) );
+ xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "ColSpan" ) ),
+ uno::Any( nXSpan ) );
+ xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "RowSpan" ) ),
+ uno::Any( nYSpan ) );
+}
+
+Box::Box( rtl::OUString const& rName, sal_Int32 nBorder, bool bHomogeneous )
+ : Container( rName, nBorder )
+{
+ uno::Reference< beans::XPropertySet > xProps( mxContainer, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Homogeneous" ) ),
+ uno::Any( bHomogeneous ) );
+}
+
+void Box::Add( Window *window, bool bExpand, bool bFill, sal_Int32 nPadding)
+{
+ if ( !window )
+ return;
+ WindowImpl &rImpl = window->getImpl();
+ uno::Reference< awt::XLayoutConstrains > xChild( rImpl.mxWindow,
+ uno::UNO_QUERY );
+
+ mxContainer->addChild( xChild );
+ setProps( xChild, bExpand, bFill, nPadding );
+}
+
+void Box::Add( Container *pContainer, bool bExpand, bool bFill, sal_Int32 nPadding)
+{
+ if ( !pContainer )
+ return;
+
+ uno::Reference< awt::XLayoutConstrains > xChild( pContainer->getImpl(),
+ uno::UNO_QUERY );
+ mxContainer->addChild( xChild );
+ setProps( xChild, bExpand, bFill, nPadding );
+}
+
+void Box::setProps( uno::Reference< awt::XLayoutConstrains > xChild,
+ bool bExpand, bool bFill, sal_Int32 nPadding )
+{
+ uno::Reference< beans::XPropertySet > xProps
+ ( mxContainer->getChildProperties( xChild ), uno::UNO_QUERY_THROW );
+
+ xProps->setPropertyValue( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Expand" ) ),
+ uno::Any( bExpand ) );
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Fill" ) ),
+ uno::Any( bFill ) );
+ xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Padding" ) ),
+ uno::Any( nPadding ) );
+}
+
+Table::Table( Context const* context, char const* pId )
+ : Container( context, pId )
+{
+}
+
+Box::Box( Context const* context, char const* pId )
+ : Container( context, pId )
+{
+}
+
+HBox::HBox( sal_Int32 nBorder, bool bHomogeneous )
+ : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hbox" ) ),
+ nBorder, bHomogeneous )
+{
+}
+
+HBox::HBox( Context const* context, char const* pId )
+ : Box( context, pId )
+{
+}
+
+VBox::VBox( sal_Int32 nBorder, bool bHomogeneous )
+ : Box( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vbox" ) ),
+ nBorder, bHomogeneous )
+{
+}
+
+VBox::VBox( Context const* context, char const* pId )
+ : Box( context, pId )
+{
+}
+
+} // namespace layout
diff --git a/toolkit/source/layout/vcl/wfield.cxx b/toolkit/source/layout/vcl/wfield.cxx
new file mode 100644
index 000000000000..fb26d04a478b
--- /dev/null
+++ b/toolkit/source/layout/vcl/wfield.cxx
@@ -0,0 +1,792 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "wrapper.hxx"
+
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/awt/XMetricField.hpp>
+#include <com/sun/star/awt/XNumericField.hpp>
+#include <com/sun/star/awt/XTextComponent.hpp>
+#include <com/sun/star/awt/XListBox.hpp>
+#include <com/sun/star/awt/XComboBox.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/awt/XActionListener.hpp>
+#include <com/sun/star/awt/XItemListener.hpp>
+#include <com/sun/star/awt/XMouseListener.hpp>
+#include <vcl/combobox.hxx>
+#include <vcl/lstbox.hxx>
+
+#include <toolkit/awt/vclxwindows.hxx>
+
+using namespace ::com::sun::star;
+using rtl::OUString;
+
+#define LAYOUT_API_CALLS_HANDLER 0
+
+namespace layout
+{
+
+class EditImpl : public ControlImpl
+ , public ::cppu::WeakImplHelper1< awt::XTextListener >
+{
+public:
+ Link maModifyHdl;
+
+ uno::Reference< awt::XTextComponent > mxEdit;
+ EditImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ControlImpl( context, peer, window )
+ , mxEdit( peer, uno::UNO_QUERY )
+ {
+ }
+
+ ~EditImpl ();
+
+ virtual void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException);
+
+ virtual void SetModifyHdl( Link const& link );
+
+ void SAL_CALL textChanged( const awt::TextEvent& /* rEvent */ )
+ throw (uno::RuntimeException)
+ {
+ maModifyHdl.Call( mpWindow );
+ }
+};
+
+EditImpl::~EditImpl ()
+{
+}
+
+void SAL_CALL EditImpl::disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+{
+ ControlImpl::disposing (e);
+ mxEdit.clear ();
+}
+
+void EditImpl::SetModifyHdl( Link const& link )
+{
+ if (!link && !!maModifyHdl)
+ mxEdit->removeTextListener( this );
+ else if (!!link && !maModifyHdl)
+ mxEdit->addTextListener( this );
+ maModifyHdl = link;
+}
+
+Edit::~Edit ()
+{
+ SetModifyHdl (Link ());
+}
+
+void Edit::SetSelection( Selection const& rSelection )
+{
+#if LAYOUT_API_CALLS_HANDLER
+ if ( !getImpl().mxEdit.is() )
+ getImpl().mxEdit->setSelection( awt::Selection( rSelection.Min(), rSelection.Max() ) );
+#else /* !LAYOUT_API_CALLS_HANDLER */
+ GetEdit ()->SetSelection (rSelection);
+#endif /* !LAYOUT_API_CALLS_HANDLER */
+}
+
+void Edit::SetText( OUString const& rStr )
+{
+#if LAYOUT_API_CALLS_HANDLER
+ if ( getImpl().mxEdit.is() )
+ /// this calls handlers; endless loop in numfmt.cxx
+ getImpl().mxEdit->setText( rStr );
+#else /* !LAYOUT_API_CALLS_HANDLER */
+ GetEdit ()->SetText (rStr);
+#endif /* !LAYOUT_API_CALLS_HANDLER */
+}
+
+String Edit::GetText() const
+{
+ if ( !getImpl().mxEdit.is() )
+ return getImpl().mxEdit->getText();
+ return OUString();
+}
+
+void Edit::SetModifyHdl( const Link& link )
+{
+ if (&getImpl () && getImpl().mxEdit.is ())
+ getImpl().SetModifyHdl( link );
+}
+
+IMPL_CONSTRUCTORS( Edit, Control, "edit" );
+IMPL_GET_IMPL( Edit );
+IMPL_GET_WINDOW (Edit);
+
+class MultiLineEditImpl : public EditImpl
+{
+public:
+ MultiLineEditImpl( Context *context, const PeerHandle &peer, Window *window )
+ : EditImpl( context, peer, window )
+ {
+ }
+};
+
+IMPL_CONSTRUCTORS( MultiLineEdit, Edit, "multilineedit" );
+IMPL_GET_IMPL( MultiLineEdit );
+
+class SpinFieldImpl : public EditImpl
+{
+ public:
+ SpinFieldImpl( Context *context, const PeerHandle &peer, Window *window )
+ : EditImpl( context, peer, window )
+ {
+ }
+};
+
+IMPL_CONSTRUCTORS( SpinField, Edit, "spinfield" );
+
+class NumericFieldImpl : public SpinFieldImpl
+{
+ public:
+ NumericFieldImpl( Context *context, const PeerHandle &peer, Window *window )
+ : SpinFieldImpl( context, peer, window )
+ {
+ }
+};
+
+class MetricFieldImpl : public SpinFieldImpl
+{
+ public:
+ MetricFieldImpl( Context *context, const PeerHandle &peer, Window *window )
+ : SpinFieldImpl( context, peer, window )
+ {
+ }
+};
+
+IMPL_GET_IMPL( SpinField );
+IMPL_GET_IMPL( NumericField );
+IMPL_GET_IMPL( MetricField );
+
+class FormatterBaseImpl
+{
+ protected:
+ PeerHandle mpeer;
+ public:
+ explicit FormatterBaseImpl( const PeerHandle &peer )
+ : mpeer( peer )
+ {
+ };
+};
+
+FormatterBase::FormatterBase( FormatterBaseImpl *pFormatImpl )
+ : mpFormatImpl( pFormatImpl )
+{
+}
+
+class NumericFormatterImpl : public FormatterBaseImpl
+{
+ public:
+ uno::Reference< awt::XNumericField > mxField;
+ explicit NumericFormatterImpl( const PeerHandle &peer )
+ : FormatterBaseImpl( peer )
+ , mxField( peer, uno::UNO_QUERY )
+ {
+ }
+
+ // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
+ double valueToDouble( sal_Int64 nValue )
+ {
+ sal_Int16 nDigits = mxField->getDecimalDigits();
+ double n = (double)nValue;
+ for ( sal_uInt16 d = 0; d < nDigits; d++ )
+ n /= 10;
+ return n;
+ } // FIXME: burn that CPU ! cut/paste from vclxwindows.cxx
+ sal_Int64 doubleToValue( double nValue )
+ {
+ sal_Int16 nDigits = mxField->getDecimalDigits();
+ double n = nValue;
+ for ( sal_uInt16 d = 0; d < nDigits; d++ )
+ n *= 10;
+ return (sal_Int64) n;
+ }
+};
+
+class MetricFormatterImpl : public FormatterBaseImpl
+{
+ public:
+ uno::Reference< awt::XMetricField > mxField;
+ explicit MetricFormatterImpl( const PeerHandle &peer )
+ : FormatterBaseImpl( peer )
+ , mxField( peer, uno::UNO_QUERY )
+ {
+ }
+};
+
+NumericFormatter::NumericFormatter( FormatterBaseImpl *pImpl )
+ : FormatterBase( pImpl )
+{
+}
+
+NumericFormatterImpl& NumericFormatter::getFormatImpl() const
+{
+ return *( static_cast<NumericFormatterImpl *>( mpFormatImpl ) );
+}
+
+#define SET_IMPL(vclmethod, idlmethod) \
+ void NumericFormatter::vclmethod( sal_Int64 nValue ) \
+ { \
+ if ( !getFormatImpl().mxField.is() ) \
+ return; \
+ getFormatImpl().mxField->idlmethod( getFormatImpl().valueToDouble( nValue ) ); \
+ }
+
+SET_IMPL( SetMin, setMin )
+SET_IMPL( SetMax, setMax )
+SET_IMPL( SetLast, setLast )
+SET_IMPL( SetFirst, setFirst )
+SET_IMPL( SetValue, setValue )
+SET_IMPL( SetSpinSize, setSpinSize )
+
+sal_Int64 NumericFormatter::GetValue() const
+{
+ if ( !getFormatImpl().mxField.is() )
+ return 0;
+ return getFormatImpl().doubleToValue( getFormatImpl().mxField->getValue() );
+}
+
+#undef SET_IMPL
+
+IMPL_CONSTRUCTORS_2( NumericField, SpinField, NumericFormatter, "numericfield" );
+
+MetricFormatter::MetricFormatter( FormatterBaseImpl *pImpl )
+ : FormatterBase( pImpl )
+{
+}
+MetricFormatterImpl& MetricFormatter::getFormatImpl() const
+{ return *( static_cast<MetricFormatterImpl *>( mpFormatImpl ) ); }
+
+#define MetricUnitVclToUno(a) ((sal_uInt16)(a))
+
+#define SET_IMPL(vclmethod, idlmethod) \
+ void MetricFormatter::vclmethod( sal_Int64 nValue, FieldUnit nUnit ) \
+ { \
+ if ( !getFormatImpl().mxField.is() ) \
+ return; \
+ getFormatImpl().mxField->idlmethod( nValue, MetricUnitVclToUno( nUnit ) ); \
+ }
+
+SET_IMPL( SetMin, setMin )
+SET_IMPL( SetMax, setMax )
+SET_IMPL( SetLast, setLast )
+SET_IMPL( SetFirst, setFirst )
+SET_IMPL( SetValue, setValue )
+
+#undef SET_IMPL
+
+void MetricFormatter::SetSpinSize( sal_Int64 nValue )
+{
+ if ( !getFormatImpl().mxField.is() )
+ return;
+ getFormatImpl().mxField->setSpinSize( nValue );
+}
+
+sal_Int64 MetricFormatter::GetValue( FieldUnit nUnit ) const
+{
+ if ( !getFormatImpl().mxField.is() )
+ return 0;
+ return getFormatImpl().mxField->getValue( MetricUnitVclToUno( nUnit ) );
+}
+
+IMPL_CONSTRUCTORS_2( MetricField, SpinField, MetricFormatter, "metricfield" );
+
+class ComboBoxImpl : public EditImpl
+ , public ::cppu::WeakImplHelper1< awt::XActionListener >
+ , public ::cppu::WeakImplHelper1< awt::XItemListener >
+{
+public:
+ uno::Reference< awt::XComboBox > mxComboBox;
+
+ Link maClickHdl;
+ Link maSelectHdl;
+
+ Window *parent;
+
+ ComboBoxImpl( Context *context, const PeerHandle &peer, Window *window )
+ : EditImpl( context, peer, window )
+ , mxComboBox( peer, uno::UNO_QUERY )
+ {
+ }
+
+ ~ComboBoxImpl ();
+
+ sal_uInt16 InsertEntry( OUString const& rStr, sal_uInt16 nPos )
+ {
+ if ( nPos == COMBOBOX_APPEND )
+ nPos = GetEntryCount();
+ mxComboBox->addItem( rtl::OUString( rStr ), nPos );
+ return nPos;
+ }
+
+ void RemoveEntry( sal_uInt16 nPos )
+ {
+ mxComboBox->removeItems( nPos, 1 );
+ }
+
+ sal_uInt16 GetEntryPos( String const& rStr ) const
+ {
+ uno::Sequence< rtl::OUString> aItems( mxComboBox->getItems() );
+ rtl::OUString rKey( rStr );
+ sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength());
+ for (sal_uInt16 i = 0; i < n; i++)
+ {
+ if ( aItems[ i ] == rKey )
+ return i;
+ }
+ return COMBOBOX_ENTRY_NOTFOUND;
+ }
+
+ OUString GetEntry( sal_uInt16 nPos ) const
+ {
+ return OUString( mxComboBox->getItem( nPos ) );
+ }
+
+ sal_uInt16 GetEntryCount() const
+ {
+ return mxComboBox->getItemCount();
+ }
+
+ void SetClickHdl( Link const& link )
+ {
+ if (!link && !!maClickHdl)
+ mxComboBox->removeActionListener( this );
+ else if (!!link && !maClickHdl)
+ mxComboBox->addActionListener( this );
+ maClickHdl = link;
+ }
+
+ void SetSelectHdl( Link const& link )
+ {
+ if (!link && !!maSelectHdl)
+ mxComboBox->removeItemListener( this );
+ else if (!!link && !maSelectHdl)
+ mxComboBox->addItemListener( this );
+ maSelectHdl = link;
+ }
+
+ void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException);
+
+ void SAL_CALL actionPerformed (const awt::ActionEvent&)
+ throw (uno::RuntimeException)
+ {
+ ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
+ if ( !pComboBox )
+ return;
+ maClickHdl.Call( pComboBox );
+ }
+
+ void SAL_CALL itemStateChanged( awt::ItemEvent const&)
+ throw (uno::RuntimeException)
+ {
+ ComboBox* pComboBox = static_cast<ComboBox*>( mpWindow );
+ if ( !pComboBox )
+ return;
+ maSelectHdl.Call( pComboBox );
+ }
+};
+
+ComboBox::~ComboBox ()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: deleting ComboBox for window: %p", __FUNCTION__, GetWindow ());
+#endif
+}
+
+ComboBoxImpl::~ComboBoxImpl ()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: deleting ComboBoxImpl for window: %p", __FUNCTION__, mpWindow ? mpWindow->GetWindow () : 0);
+ OSL_TRACE ("%s: deleting ComboBoxImpl for listener: %p", __FUNCTION__, static_cast<XFocusListener*> (this));
+#endif
+}
+
+void ComboBoxImpl::disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+{
+ EditImpl::disposing (e);
+ mxComboBox.clear ();
+}
+
+sal_uInt16 ComboBox::InsertEntry( String const& rStr, sal_uInt16 nPos )
+{
+ return getImpl().InsertEntry( rStr, nPos );
+}
+
+void ComboBox::RemoveEntry( String const& rStr )
+{
+ getImpl().RemoveEntry( GetEntryPos( rStr ) );
+}
+
+void ComboBox::RemoveEntry( sal_uInt16 nPos )
+{
+ getImpl().RemoveEntry( nPos );
+}
+
+void ComboBox::Clear()
+{
+ uno::Sequence< rtl::OUString> aNoItems;
+ getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
+}
+
+sal_uInt16 ComboBox::GetEntryPos( String const& rStr ) const
+{
+ return getImpl().GetEntryPos( rStr );
+}
+
+String ComboBox::GetEntry( sal_uInt16 nPos ) const
+{
+ rtl::OUString rItem = getImpl().mxComboBox->getItem( nPos );
+ return OUString( rItem );
+}
+
+sal_uInt16 ComboBox::GetEntryCount() const
+{
+ return getImpl().GetEntryCount();
+}
+
+void ComboBox::SetClickHdl( const Link& link )
+{
+ if (&getImpl () && getImpl().mxComboBox.is ())
+ getImpl().SetClickHdl( link );
+}
+
+void ComboBox::SetSelectHdl( const Link& link )
+{
+ if (&getImpl () && getImpl().mxComboBox.is ())
+ getImpl().SetSelectHdl( link );
+}
+
+void ComboBox::EnableAutocomplete (bool enable, bool matchCase)
+{
+ GetComboBox ()->EnableAutocomplete (enable, matchCase);
+}
+
+IMPL_CONSTRUCTORS_BODY( ComboBox, Edit, "combobox", getImpl().parent = parent; );
+IMPL_GET_WINDOW (ComboBox);
+/// IMPL_GET_IMPL( ComboBox );
+
+static ComboBoxImpl* null_combobox_impl = 0;
+
+ComboBoxImpl &ComboBox::getImpl () const
+{
+ if (ComboBoxImpl* c = static_cast<ComboBoxImpl *>(mpImpl))
+ return *c;
+ return *null_combobox_impl;
+}
+
+class ListBoxImpl : public ControlImpl
+ , public ::cppu::WeakImplHelper1< awt::XActionListener >
+ , public ::cppu::WeakImplHelper1< awt::XItemListener >
+ , public ::cppu::WeakImplHelper1< awt::XMouseListener >
+{
+ Link maClickHdl;
+ Link maSelectHdl;
+ Link maDoubleClickHdl;
+
+public:
+ uno::Reference< awt::XListBox > mxListBox;
+ ListBoxImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ControlImpl( context, peer, window )
+ , mxListBox( peer, uno::UNO_QUERY )
+ {
+ SelectEntryPos (0, true);
+ }
+
+ sal_uInt16 InsertEntry (String const& rStr, sal_uInt16 nPos)
+ {
+ if ( nPos == LISTBOX_APPEND )
+ nPos = mxListBox->getItemCount();
+ mxListBox->addItem( rtl::OUString( rStr ), nPos );
+ return nPos;
+ }
+
+ void RemoveEntry( sal_uInt16 nPos )
+ {
+ mxListBox->removeItems( nPos, 1 );
+ }
+
+ sal_uInt16 RemoveEntry( String const& rStr, sal_uInt16 nPos)
+ {
+ if ( nPos == LISTBOX_APPEND )
+ nPos = mxListBox->getItemCount();
+ mxListBox->addItem( rtl::OUString( rStr ), nPos );
+ return nPos;
+ }
+
+ sal_uInt16 GetEntryPos( String const& rStr ) const
+ {
+ uno::Sequence< rtl::OUString> aItems( mxListBox->getItems() );
+ rtl::OUString rKey( rStr );
+ sal_uInt16 n = sal::static_int_cast< sal_uInt16 >(aItems.getLength());
+ for (sal_uInt16 i = 0; i < n; i++)
+ {
+ if ( aItems[ i ] == rKey )
+ return i;
+ }
+ return LISTBOX_ENTRY_NOTFOUND;
+ }
+
+ OUString GetEntry( sal_uInt16 nPos ) const
+ {
+ return mxListBox->getItem( nPos );
+ }
+
+ sal_uInt16 GetEntryCount() const
+ {
+ return mxListBox->getItemCount();
+ }
+
+ void SelectEntryPos( sal_uInt16 nPos, bool bSelect )
+ {
+ mxListBox->selectItemPos( nPos, bSelect );
+ }
+
+ sal_uInt16 GetSelectEntryCount() const
+ {
+ return sal::static_int_cast< sal_uInt16 >( mxListBox->getSelectedItems().getLength() );
+ }
+
+ sal_uInt16 GetSelectEntryPos( sal_uInt16 nSelIndex ) const
+ {
+ sal_uInt16 nSelected = 0;
+ if ( mxListBox->isMutipleMode() )
+ {
+ uno::Sequence< short > aItems( mxListBox->getSelectedItemsPos() );
+ if ( nSelIndex < aItems.getLength() )
+ nSelected = aItems[ nSelIndex ];
+ }
+ else
+ nSelected = mxListBox->getSelectedItemPos();
+ return nSelected;
+ }
+
+ virtual void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+ {
+ ControlImpl::disposing (e);
+ mxListBox.clear ();
+ }
+
+ Link& GetClickHdl ()
+ {
+ return maClickHdl;
+ }
+
+ void SetClickHdl( Link const& link )
+ {
+ if (!link && !!maClickHdl)
+ mxListBox->removeActionListener( this );
+ else if (!!link && !maClickHdl)
+ mxListBox->addActionListener( this );
+ maClickHdl = link;
+ }
+
+ void SAL_CALL actionPerformed( const awt::ActionEvent& /* rEvent */ )
+ throw (uno::RuntimeException)
+ {
+ maClickHdl.Call( mpWindow );
+ }
+
+ Link& GetSelectHdl ()
+ {
+ return maSelectHdl;
+ }
+
+ void SetSelectHdl( Link const& link )
+ {
+ if (!link && !!maSelectHdl)
+ mxListBox->removeItemListener( this );
+ else if (!!link && !maSelectHdl)
+ mxListBox->addItemListener( this );
+ maSelectHdl = link;
+ }
+
+ void SAL_CALL itemStateChanged (awt::ItemEvent const&)
+ throw (uno::RuntimeException)
+ {
+ maSelectHdl.Call (static_cast <ListBox*> (mpWindow));
+ }
+
+ Link& GetDoubleClickHdl ()
+ {
+ return maDoubleClickHdl;
+ }
+
+ void SetDoubleClickHdl (Link const& link)
+ {
+ if (!link && !!maDoubleClickHdl)
+ mxWindow->removeMouseListener (this);
+ else if (!!link && !maSelectHdl)
+ mxWindow->addMouseListener (this);
+ maDoubleClickHdl = link;
+ }
+
+ void SAL_CALL mousePressed (awt::MouseEvent const&) throw (uno::RuntimeException)
+ {
+ }
+ void SAL_CALL mouseReleased (awt::MouseEvent const& e) throw (uno::RuntimeException)
+ {
+ if (e.ClickCount == 2)
+ maDoubleClickHdl.Call (mpWindow);
+ }
+ void SAL_CALL mouseEntered (awt::MouseEvent const&) throw (uno::RuntimeException)
+ {
+ }
+ void SAL_CALL mouseExited (awt::MouseEvent const&) throw (uno::RuntimeException)
+ {
+ }
+};
+
+ListBox::~ListBox ()
+{
+}
+
+sal_uInt16 ListBox::InsertEntry (String const& rStr, sal_uInt16 nPos)
+{
+ return getImpl().InsertEntry(rStr, nPos);
+}
+
+void ListBox::RemoveEntry( sal_uInt16 nPos )
+{
+ return getImpl().RemoveEntry( nPos );
+}
+
+void ListBox::RemoveEntry( String const& rStr )
+{
+ return getImpl().RemoveEntry( GetEntryPos( rStr ) );
+}
+
+void ListBox::Clear()
+{
+ uno::Sequence< rtl::OUString> aNoItems;
+ getImpl().setProperty( "StringItemList", uno::Any( aNoItems ) );
+}
+
+sal_uInt16 ListBox::GetEntryPos( String const& rStr ) const
+{
+ return getImpl().GetEntryPos( rStr );
+}
+
+String ListBox::GetEntry( sal_uInt16 nPos ) const
+{
+ return getImpl().GetEntry( nPos );
+}
+
+sal_uInt16 ListBox::GetEntryCount() const
+{
+ return getImpl().GetEntryCount();
+}
+
+void ListBox::SelectEntryPos( sal_uInt16 nPos, bool bSelect )
+{
+#if LAYOUT_API_CALLS_HANDLER
+ getImpl().SelectEntryPos( nPos, bSelect );
+#else /* !LAYOUT_API_CALLS_HANDLER */
+ GetListBox ()->SelectEntryPos (nPos, bSelect);
+#endif /* !LAYOUT_API_CALLS_HANDLER */
+}
+
+void ListBox::SelectEntry( String const& rStr, bool bSelect )
+{
+ SelectEntryPos( GetEntryPos( rStr ), bSelect );
+}
+
+sal_uInt16 ListBox::GetSelectEntryCount() const
+{
+ return getImpl().GetSelectEntryCount();
+}
+
+sal_uInt16 ListBox::GetSelectEntryPos( sal_uInt16 nSelIndex ) const
+{
+ return getImpl().GetSelectEntryPos( nSelIndex );
+}
+
+String ListBox::GetSelectEntry( sal_uInt16 nSelIndex ) const
+{
+ return GetEntry( GetSelectEntryPos( nSelIndex ) );
+}
+
+Link& ListBox::GetSelectHdl ()
+{
+ return getImpl ().GetSelectHdl ();
+}
+
+void ListBox::SetSelectHdl( Link const& link )
+{
+ getImpl().SetSelectHdl( link );
+}
+
+Link& ListBox::GetClickHdl ()
+{
+ return getImpl ().GetSelectHdl ();
+}
+
+void ListBox::SetClickHdl( Link const& link )
+{
+ if (&getImpl () && getImpl().mxListBox.is ())
+ getImpl().SetClickHdl( link );
+}
+
+Link& ListBox::GetDoubleClickHdl ()
+{
+ return getImpl ().GetSelectHdl ();
+}
+
+void ListBox::SetDoubleClickHdl( Link const& link )
+{
+ getImpl().SetDoubleClickHdl( link );
+}
+
+void ListBox::SetEntryData( sal_uInt16 pos, void* data)
+{
+ GetListBox ()->SetEntryData (pos, data);
+}
+
+void* ListBox::GetEntryData( sal_uInt16 pos) const
+{
+ return GetListBox ()->GetEntryData (pos);
+}
+
+void ListBox::SetNoSelection ()
+{
+ GetListBox ()->SetNoSelection ();
+}
+
+IMPL_CONSTRUCTORS (ListBox, Control, "listbox");
+IMPL_GET_IMPL (ListBox);
+IMPL_GET_WINDOW (ListBox);
+
+IMPL_IMPL (MultiListBox, ListBox)
+IMPL_CONSTRUCTORS_BODY( MultiListBox, ListBox, "multilistbox", GetMultiListBox()->EnableMultiSelection( true ); );
+IMPL_GET_IMPL( MultiListBox );
+IMPL_GET_WINDOW( MultiListBox );
+} // namespace layout
diff --git a/toolkit/source/layout/vcl/wrapper.cxx b/toolkit/source/layout/vcl/wrapper.cxx
new file mode 100644
index 000000000000..a8133250eb58
--- /dev/null
+++ b/toolkit/source/layout/vcl/wrapper.cxx
@@ -0,0 +1,1626 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/rc.h>
+//#define RESOURCE_PUBLISH_PROTECTED 1
+#if RESOURCE_PUBLISH_PROTECTED
+// ugh, override non-helpful proctection
+#define protected public
+#endif /* RESOURCE_PUBLISH_PROTECTED */
+#include <tools/rc.hxx>
+#undef protected
+
+
+#include "wrapper.hxx"
+
+#include <awt/vclxplugin.hxx>
+#include <awt/vclxtabcontrol.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <com/sun/star/awt/XProgressBar.hpp>
+#include <com/sun/star/awt/XSimpleTabController.hpp>
+#include <com/sun/star/awt/XTabListener.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <comphelper/processfactory.hxx>
+#include <layout/core/factory.hxx>
+#include <layout/core/localized-string.hxx>
+#include <layout/core/root.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+#include <vcl/ctrl.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/image.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/window.hxx>
+
+using namespace ::com::sun::star;
+using rtl::OUString;
+
+namespace layout
+{
+
+// Context bits ...
+class ContextImpl
+{
+ uno::Reference< awt::XLayoutRoot > mxRoot;
+ uno::Reference< container::XNameAccess > mxNameAccess;
+ PeerHandle mxTopLevel;
+
+public:
+ ContextImpl( char const *pPath )
+ {
+ uno::Sequence< uno::Any > aParams( 1 );
+ aParams[0] <<= OUString( pPath, strlen( pPath ), RTL_TEXTENCODING_UTF8 );
+
+ uno::Reference< lang::XSingleServiceFactory > xFactory(
+ comphelper::createProcessComponent(
+ OUString::createFromAscii( "com.sun.star.awt.Layout" ) ),
+ uno::UNO_QUERY );
+ if ( !xFactory.is() )
+ {
+ throw uno::RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ),
+ uno::Reference< uno::XInterface >() );
+ }
+ mxRoot = uno::Reference< awt::XLayoutRoot >(
+ xFactory->createInstanceWithArguments( aParams ),
+ uno::UNO_QUERY );
+
+ mxNameAccess = uno::Reference< container::XNameAccess >( mxRoot, uno::UNO_QUERY );
+ }
+
+ ~ContextImpl()
+ {
+ }
+
+ PeerHandle getByName( const OUString &rName )
+ {
+ uno::Any val = mxNameAccess->getByName( rName );
+ PeerHandle xRet;
+ val >>= xRet;
+ return xRet;
+ }
+ PeerHandle getTopLevel()
+ {
+ return mxTopLevel;
+ }
+ void setTopLevel( PeerHandle xToplevel )
+ {
+ mxTopLevel = xToplevel;
+ }
+ PeerHandle getRoot()
+ {
+ return mxRoot;
+ }
+};
+
+Context::Context( const char *pPath )
+ : pImpl( new ContextImpl( pPath ) )
+{
+}
+Context::~Context()
+{
+ delete pImpl;
+ pImpl = NULL;
+}
+
+void Context::setToplevel( PeerHandle xToplevel )
+{
+ pImpl->setTopLevel( xToplevel );
+}
+
+PeerHandle Context::getToplevel()
+{
+ return pImpl->getTopLevel();
+}
+PeerHandle Context::getRoot()
+{
+ return pImpl->getRoot();
+}
+
+PeerHandle Context::GetPeerHandle( const char *id, sal_uInt32 nId ) const
+{
+ PeerHandle xHandle;
+ xHandle = pImpl->getByName( OUString( id, strlen( id ), RTL_TEXTENCODING_UTF8 ) );
+ if ( !xHandle.is() )
+ {
+ DBG_ERROR1( "Failed to fetch widget '%s'", id );
+ }
+
+ if ( nId != 0 )
+ {
+ rtl::OString aStr = rtl::OString::valueOf( (sal_Int32) nId );
+ xHandle = GetPeerHandle( aStr, 0 );
+ }
+ return xHandle;
+}
+
+WindowImpl::WindowImpl (Context *context, const PeerHandle &peer, Window *window)
+ : mpWindow (window)
+ , mpCtx (context)
+ , mxWindow (peer, uno::UNO_QUERY)
+ , mxVclPeer (peer, uno::UNO_QUERY)
+ , mvclWindow (0)
+ , bFirstTimeVisible (true)
+{
+}
+
+WindowImpl::~WindowImpl ()
+{
+ if (mpWindow)
+ mpWindow->mpImpl = 0;
+ if (mvclWindow)
+ {
+ VCLXWindow *v = mvclWindow->GetWindowPeer ();
+ v->SetWindow (0);
+ mvclWindow->SetComponentInterface (uno::Reference <awt::XWindowPeer> ());
+ mvclWindow->SetWindowPeer (uno::Reference <awt::XWindowPeer> (), 0);
+ delete mvclWindow;
+ mvclWindow = 0;
+ }
+}
+
+void WindowImpl::wrapperGone ()
+{
+ mvclWindow = 0;
+ mpWindow->mpImpl = 0;
+ mpWindow = 0;
+ mpCtx = 0;
+ if ( mxWindow.is() )
+ {
+ uno::Reference< lang::XComponent > xComp( mxWindow, uno::UNO_QUERY );
+ mxWindow.clear ();
+ if ( xComp.is() )
+ xComp->dispose();
+ }
+}
+
+void SAL_CALL WindowImpl::disposing (lang::EventObject const&)
+ throw (uno::RuntimeException)
+{
+ if (mxWindow.is ())
+ mxWindow.clear ();
+}
+
+uno::Any WindowImpl::getProperty (char const* name)
+{
+ if ( !this || !mxVclPeer.is() )
+ return css::uno::Any();
+ return mxVclPeer->getProperty
+ ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ) );
+}
+
+void WindowImpl::setProperty (char const *name, uno::Any any)
+{
+ if ( !this || !mxVclPeer.is() )
+ return;
+ mxVclPeer->setProperty
+ ( rtl::OUString( name, strlen( name ), RTL_TEXTENCODING_ASCII_US ), any );
+}
+
+void WindowImpl::redraw (bool resize)
+{
+ uno::Reference <awt::XWindow> ref (mxWindow, uno::UNO_QUERY);
+ ::Window* window = VCLXWindow::GetImplementation (ref)->GetWindow ();
+ ::Window* parent = window->GetParent();
+ ::Rectangle r = Rectangle (parent->GetPosPixel (),
+ parent->GetSizePixel ());
+ parent->Invalidate (r, INVALIDATE_CHILDREN | INVALIDATE_NOCHILDREN );
+ if (resize)
+ parent->SetPosSizePixel (0, 0, 1, 1, awt::PosSize::SIZE);
+ else
+ parent->SetPosSizePixel (0, 0, r.nRight - r.nLeft, r.nBottom - r.nTop,
+ awt::PosSize::SIZE);
+}
+
+Window::Window( WindowImpl *pImpl )
+ : mpImpl( pImpl )
+{
+ mpImpl->mvclWindow = GetVCLXWindow () ? GetWindow () : 0;
+}
+
+Window::~Window()
+{
+ /* likely to be an UNO object - with floating references */
+ if (mpImpl)
+ mpImpl->wrapperGone ();
+ mpImpl = 0;
+}
+
+///IMPL_GET_IMPL( Control );
+
+static ControlImpl* null_control_impl = 0;
+
+ControlImpl &Control::getImpl () const
+{
+ if (ControlImpl* c = static_cast<ControlImpl *>(mpImpl))
+ return *c;
+ return *null_control_impl;
+}
+
+Control::~Control ()
+{
+ SetGetFocusHdl (Link ());
+ SetLoseFocusHdl (Link ());
+}
+
+void Window::setRes (ResId const& res)
+{
+#if RESOURCE_PUBLISH_PROTECTED
+ // Resources are shut-off from use. Is that really necessary?
+ Resource &r = *GetWindow ();
+ r.GetRes (res);
+#else /* !RESOURCE_PUBLISH_PROTECTED */
+ //We *must* derive. Is this also really necessary?
+ //Resource r (res);
+
+ // ugh, I wonder which solution is cleaner...
+ class Resource_open_up : public Resource
+ {
+ public:
+ Resource_open_up (ResId const& r)
+ : Resource (r)
+ {
+ }
+ static sal_Int32 GetLongRes (void *p)
+ {
+ return Resource::GetLongRes (p);
+ }
+ void* GetClassRes ()
+ {
+ return Resource::GetClassRes ();
+ }
+ sal_Int32 ReadLongRes ()
+ {
+ return Resource::ReadLongRes ();
+ }
+ UniString ReadStringRes ()
+ {
+ return Resource::ReadStringRes ();
+ }
+ };
+
+ Resource_open_up r (res);
+#endif /* !RESOURCE_PUBLISH_PROTECTED */
+ if (sal_uInt32 help_id = (sal_uInt32)r.GetLongRes (static_cast<char *> (r.GetClassRes ()) + 12))
+ SetHelpId (help_id);
+ sal_uInt32 mask = r.ReadLongRes ();
+ if ( mask & WINDOW_TEXT )
+ SetText( r.ReadStringRes ());
+}
+
+void Window::SetParent( ::Window *parent )
+{
+ uno::Reference <awt::XWindow> ref( GetPeer(), uno::UNO_QUERY );
+ if (VCLXWindow *vcl = VCLXWindow::GetImplementation( ref ))
+ if (::Window *window = vcl->GetWindow())
+ window->SetParent( parent );
+}
+
+void Window::SetParent( Window *parent )
+{
+ /* Let's hear it for C++: poor man's dynamic binding. */
+ parent->ParentSet (this);
+}
+
+void Window::ParentSet (Window *window)
+{
+ window->SetParent (GetWindow ());
+}
+
+Context *Window::getContext()
+{
+ return this && mpImpl ? mpImpl->mpCtx : NULL;
+}
+
+PeerHandle Window::GetPeer() const
+{
+ if ( !mpImpl )
+ return PeerHandle();
+ return mpImpl->mxWindow;
+}
+
+uno::Reference<awt::XWindow> Window::GetRef() const
+{
+ return uno::Reference <awt::XWindow> ( GetPeer(), uno::UNO_QUERY );
+}
+
+VCLXWindow* Window::GetVCLXWindow() const
+{
+ return VCLXWindow::GetImplementation( GetRef() );
+}
+
+::Window* Window::GetWindow() const
+{
+ return GetVCLXWindow()->GetWindow();
+}
+
+::Window* Window::GetParent() const
+{
+ return GetWindow()->GetParent();
+}
+
+void Window::SetHelpId( sal_uIntPtr id )
+{
+ GetWindow()->SetHelpId( id );
+}
+
+sal_uIntPtr Window::GetHelpId() const
+{
+ return GetWindow()->GetHelpId();
+}
+
+void Window::SetSmartHelpId( SmartId const& id, SmartIdUpdateMode mode )
+{
+ GetWindow()->SetSmartHelpId( id, mode );
+}
+
+SmartId Window::GetSmartHelpId() const
+{
+ return GetWindow()->GetSmartHelpId();
+}
+
+void Window::EnterWait ()
+{
+ GetWindow()->EnterWait ();
+}
+void Window::LeaveWait ()
+{
+ GetWindow()->LeaveWait ();
+}
+bool Window::IsWait () const
+{
+ return GetWindow()->IsWait ();
+}
+
+bool Window::IsVisible () const
+{
+ if (GetWindow ())
+ return GetWindow()->IsVisible ();
+ return false;
+}
+
+bool Window::HasChildPathFocus (bool systemWindow) const
+{
+ return GetWindow()->HasChildPathFocus (systemWindow);
+}
+
+void Window::SetPosPixel (Point const&)
+{
+}
+
+Point Window::GetPosPixel () const
+{
+ return Point ();
+}
+
+void Window::SetSizePixel (Size const&)
+{
+}
+
+void Window::SetPosSizePixel (Point const&, Size const&)
+{
+}
+
+Size Window::GetSizePixel () const
+{
+ return Size ();
+}
+
+// void Window::Enable (bool enable, bool child);
+// {
+// GetWindow ()->Enable (enable, child);
+// }
+
+// void Window::Disable (bool child)
+// {
+// GetWindow ()->Disable (child);
+// }
+
+bool Window::IsEnabled () const
+{
+ return GetWindow ()->IsEnabled ();
+// if (getImpl().mxWindow.is ())
+// return getImpl ().mxWindow->isEnabled ();
+// return false;
+}
+
+void Window::EnableInput (bool enable, bool child)
+{
+ GetWindow ()->EnableInput (enable, child);
+}
+
+bool Window::IsInputEnabled () const
+{
+ return GetWindow ()->IsInputEnabled ();
+}
+
+bool Window::HasFocus () const
+{
+ return GetWindow ()->HasFocus ();
+}
+
+Font& Window::GetFont () const
+{
+ return const_cast <Font&> (GetWindow ()->GetFont ());
+}
+
+void Window::SetFont (Font const& font)
+{
+ GetWindow ()->SetFont (font);
+}
+
+void Window::Invalidate (sal_uInt8 flags)
+{
+ GetWindow ()->Invalidate (flags);
+}
+
+struct ToolkitVclPropsMap
+{
+ WinBits vclStyle;
+ long initAttr;
+ const char *propName;
+
+ // the value to give the prop to enable/disable it -- not the most brilliant
+ // type declaration and storage, but does the work... properties are
+ // either a boolean or a short since they are either a directly wrappers for
+ // a WinBit, or aggregates related (like Align for WB_LEFT, _RIGHT and _CENTER).
+ bool isBoolean;
+ short enableProp, disableProp;
+};
+
+#define TYPE_BOOL true
+#define TYPE_SHORT false
+#define NOTYPE 0
+static const ToolkitVclPropsMap toolkitVclPropsMap[] =
+{
+ { WB_BORDER, awt::WindowAttribute::BORDER, "Border", TYPE_SHORT, 1, 0 },
+ { WB_NOBORDER, awt::VclWindowPeerAttribute::NOBORDER, "Border", TYPE_SHORT, 0, 1 },
+ { WB_SIZEABLE, awt::WindowAttribute::SIZEABLE, NULL, NOTYPE, 0, 0 },
+ { WB_MOVEABLE, awt::WindowAttribute::MOVEABLE, NULL, NOTYPE, 0, 0 },
+ { WB_CLOSEABLE, awt::WindowAttribute::CLOSEABLE, NULL, NOTYPE, 0, 0 },
+
+ { WB_HSCROLL, awt::VclWindowPeerAttribute::HSCROLL, NULL, NOTYPE, 0, 0 },
+ { WB_VSCROLL, awt::VclWindowPeerAttribute::VSCROLL, NULL, NOTYPE, 0, 0 },
+ { WB_LEFT, awt::VclWindowPeerAttribute::LEFT, "Align", TYPE_SHORT, 0, 0 },
+ { WB_CENTER, awt::VclWindowPeerAttribute::CENTER, "Align", TYPE_SHORT, 1, 0 },
+ { WB_RIGHT, awt::VclWindowPeerAttribute::RIGHT, "Align", TYPE_SHORT, 2, 0 },
+ { WB_SPIN, awt::VclWindowPeerAttribute::SPIN, NULL, NOTYPE, 0, 0 },
+ { WB_SORT, awt::VclWindowPeerAttribute::SORT, NULL, NOTYPE, 0, 0 },
+ { WB_DROPDOWN, awt::VclWindowPeerAttribute::DROPDOWN, "Dropdown", TYPE_BOOL, 1, 0 },
+ { WB_DEFBUTTON, awt::VclWindowPeerAttribute::DEFBUTTON, "DefaultButton", TYPE_BOOL, 1, 0 },
+ { WB_READONLY, awt::VclWindowPeerAttribute::READONLY, NULL, NOTYPE, 0, 0 },
+ { WB_CLIPCHILDREN, awt::VclWindowPeerAttribute::CLIPCHILDREN, NULL, NOTYPE, 0, 0 },
+ { WB_GROUP, awt::VclWindowPeerAttribute::GROUP, NULL, NOTYPE, 0, 0 },
+
+ { WB_OK, awt::VclWindowPeerAttribute::OK, NULL, NOTYPE, 0, 0 },
+ { WB_OK_CANCEL, awt::VclWindowPeerAttribute::OK_CANCEL, NULL, NOTYPE, 0, 0 },
+ { WB_YES_NO, awt::VclWindowPeerAttribute::YES_NO, NULL, NOTYPE, 0, 0 },
+ { WB_YES_NO_CANCEL, awt::VclWindowPeerAttribute::YES_NO_CANCEL, NULL, NOTYPE, 1, 0 },
+ { WB_RETRY_CANCEL, awt::VclWindowPeerAttribute::RETRY_CANCEL, NULL, NOTYPE, 1, 0 },
+ { WB_DEF_OK, awt::VclWindowPeerAttribute::DEF_OK, NULL, NOTYPE, 0, 0 },
+ { WB_DEF_CANCEL, awt::VclWindowPeerAttribute::DEF_CANCEL, NULL, NOTYPE, 1, 0 },
+ { WB_DEF_RETRY, awt::VclWindowPeerAttribute::DEF_RETRY, NULL, NOTYPE, 0, 0 },
+ { WB_DEF_YES, awt::VclWindowPeerAttribute::DEF_YES, NULL, NOTYPE, 0, 0 },
+ { WB_DEF_NO, awt::VclWindowPeerAttribute::DEF_NO, NULL, NOTYPE, 0, 0 },
+
+ { WB_AUTOHSCROLL, awt::VclWindowPeerAttribute::AUTOHSCROLL, "AutoHScroll", TYPE_BOOL, 1, 0 },
+ { WB_AUTOVSCROLL, awt::VclWindowPeerAttribute::AUTOVSCROLL, "AutoVScroll", TYPE_BOOL, 1, 0 },
+
+ { WB_WORDBREAK, 0, "MultiLine", TYPE_BOOL, 1, 0 },
+ { WB_NOPOINTERFOCUS, 0, "FocusOnClick", TYPE_BOOL, 1, 0 },
+ { WB_TOGGLE, 0, "Toggle", TYPE_BOOL, 1, 0 },
+ { WB_REPEAT, 0, "Repeat", TYPE_BOOL, 1, 0 },
+ { WB_NOHIDESELECTION, 0, "HideInactiveSelection", TYPE_BOOL, 1, 0 },
+};
+#undef TYPE_BOOL
+#undef TYPE_SHORT
+#undef NOTYPE
+
+static const int toolkitVclPropsMapLen =
+ sizeof( toolkitVclPropsMap ) / sizeof( ToolkitVclPropsMap );
+
+void Window::SetStyle( WinBits nStyle )
+{
+ uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer;
+ for (int i = 0; i < toolkitVclPropsMapLen; i++)
+ {
+ if ( toolkitVclPropsMap[ i ].propName )
+ {
+ short nValue;
+ if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
+ nValue = toolkitVclPropsMap[ i ].enableProp;
+ else
+ nValue = toolkitVclPropsMap[ i ].disableProp;
+ uno::Any aValue;
+ if ( toolkitVclPropsMap[ i ].isBoolean )
+ aValue = uno::makeAny( (bool) nValue );
+ else
+ aValue = uno::makeAny( (short) nValue );
+ mpImpl->setProperty( toolkitVclPropsMap[ i ].propName, aValue );
+ }
+ }
+}
+
+WinBits Window::GetStyle()
+{
+ uno::Reference< awt::XVclWindowPeer > xPeer = mpImpl->mxVclPeer;
+ WinBits ret = 0;
+ for (int i = 0; i < toolkitVclPropsMapLen; i++)
+ {
+ if ( toolkitVclPropsMap[ i ].propName )
+ {
+ short nValue = 0;
+ if ( toolkitVclPropsMap[ i ].isBoolean )
+ {
+ bool bValue = false;
+ mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= bValue;
+ nValue = bValue ? 1 : 0;
+ }
+ else
+ mpImpl->getProperty( toolkitVclPropsMap[ i ].propName ) >>= nValue;
+ if ( nValue == toolkitVclPropsMap[ i ].enableProp )
+ ret |= toolkitVclPropsMap[i].vclStyle;
+ }
+ }
+ return ret;
+}
+
+/* Unpleasant way to get an xToolkit pointer ... */
+uno::Reference< awt::XToolkit > getToolkit()
+{
+ static uno::Reference< awt::XToolkit > xToolkit;
+ if (!xToolkit.is())
+ {
+ // Urgh ...
+ xToolkit = uno::Reference< awt::XToolkit >(
+ ::comphelper::getProcessServiceFactory()->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ),
+ uno::UNO_QUERY );
+ if ( !xToolkit.is() )
+ throw uno::RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "failed to create toolkit!") ),
+ uno::Reference< uno::XInterface >() );
+ }
+ return xToolkit;
+}
+
+PeerHandle Window::CreatePeer( Window *parent, WinBits nStyle, const char *pName)
+{
+ long nWinAttrbs = 0;
+ for (int i = 0; i < toolkitVclPropsMapLen; i++)
+ if ( nStyle & toolkitVclPropsMap[ i ].vclStyle )
+ nWinAttrbs |= toolkitVclPropsMap[ i ].initAttr;
+
+ return layoutimpl::WidgetFactory::createWidget (getToolkit(), parent->GetPeer(), OUString::createFromAscii( pName ), nWinAttrbs);
+}
+
+void Window::Enable( bool bEnable )
+{
+ if ( !getImpl().mxWindow.is() )
+ return;
+ getImpl().mxWindow->setEnable( bEnable );
+}
+
+void Window::Show( bool bVisible )
+{
+ if ( !getImpl().mxWindow.is() )
+ return;
+ getImpl().mxWindow->setVisible( bVisible );
+ if (!bVisible)
+ getImpl ().bFirstTimeVisible = true;
+ else if (GetParent() && getImpl().bFirstTimeVisible)
+ {
+ getImpl().redraw ();
+ getImpl().bFirstTimeVisible = false;
+ }
+}
+
+void Window::GrabFocus()
+{
+ if ( !getImpl().mxWindow.is() )
+ return;
+ getImpl().mxWindow->setFocus();
+}
+
+void Window::SetUpdateMode(bool mode)
+{
+ GetWindow()->SetUpdateMode( mode );
+}
+
+void Window::SetPointer( Pointer const& pointer )
+{
+ GetWindow()->SetPointer( pointer );
+}
+
+Pointer const& Window::GetPointer() const
+{
+ return GetWindow()->GetPointer();
+}
+
+void Window::SetText( OUString const& str )
+{
+ GetWindow()->SetText( str );
+}
+
+String Window::GetText() const
+{
+ return GetWindow()->GetText();
+}
+
+sal_Int32 Window::GetCtrlTextWidth (OUString const&) const
+{
+ return 0;
+}
+
+sal_Int32 Window::GetTextHeight () const
+{
+ return 0;
+}
+
+Size Window::LogicToPixel( Size const& size, MapMode const&) const
+{
+ return size;
+}
+
+ControlImpl::ControlImpl (Context *context, const PeerHandle &peer, Window *window)
+ : WindowImpl( context, peer, window )
+{
+}
+
+ControlImpl::~ControlImpl ()
+{
+ if ((!!mGetFocusHdl || !!mLoseFocusHdl) && mxWindow.is ())
+ /* Disposing will be done @ VCLXWindow::dispose () maFocusListeners.disposeAndClear()
+ don't do it twice */
+ mxWindow.clear ();
+}
+
+void ControlImpl::SetGetFocusHdl (Link const& link)
+{
+ if (!mLoseFocusHdl || !link)
+ UpdateListening (link);
+ mGetFocusHdl = link;
+}
+
+Link& ControlImpl::GetGetFocusHdl ()
+{
+ return mGetFocusHdl;
+}
+
+void ControlImpl::SetLoseFocusHdl (Link const& link)
+{
+ if (!mGetFocusHdl || !link)
+ UpdateListening (link);
+ mLoseFocusHdl = link;
+}
+
+Link& ControlImpl::GetLoseFocusHdl ()
+{
+ return mGetFocusHdl;
+}
+
+void ControlImpl::UpdateListening (Link const& link)
+{
+ if (!link && (!!mGetFocusHdl || !!mLoseFocusHdl)
+ && (!mGetFocusHdl || !mLoseFocusHdl))
+ mxWindow->removeFocusListener (this);
+ else if (!!link && !mGetFocusHdl && !mLoseFocusHdl)
+ mxWindow->addFocusListener (this);
+}
+
+void SAL_CALL ControlImpl::disposing (lang::EventObject const&)
+ throw (uno::RuntimeException)
+{
+/// mxWindow.clear ();
+}
+
+void SAL_CALL ControlImpl::focusGained (awt::FocusEvent const&)
+ throw (uno::RuntimeException)
+{
+ mGetFocusHdl.Call (mpWindow);
+}
+
+void SAL_CALL ControlImpl::focusLost (awt::FocusEvent const&)
+ throw (uno::RuntimeException)
+{
+ mLoseFocusHdl.Call (mpWindow);
+}
+
+Link& Control::GetGetFocusHdl ()
+{
+ return getImpl ().GetGetFocusHdl ();
+}
+
+void Control::SetGetFocusHdl (Link const& link)
+{
+ if (&getImpl () && getImpl().mxWindow.is ())
+ getImpl ().SetGetFocusHdl (link);
+}
+
+Link& Control::GetLoseFocusHdl ()
+{
+ return getImpl ().GetLoseFocusHdl ();
+}
+
+void Control::SetLoseFocusHdl (Link const& link)
+{
+ if (&getImpl () && getImpl().mxWindow.is ())
+ getImpl ().SetLoseFocusHdl (link);
+}
+
+class DialogImpl : public WindowImpl
+{
+public:
+ uno::Reference< awt::XDialog2 > mxDialog;
+ DialogImpl( Context *context, PeerHandle const &peer, Window *window );
+};
+
+DialogImpl::DialogImpl( Context *context, const PeerHandle &peer, Window *window )
+ : WindowImpl( context, peer, window )
+ , mxDialog( peer, uno::UNO_QUERY )
+{
+}
+
+Dialog::Dialog( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
+ : Context( xml_file )
+ , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
+ , bConstruct (true)
+{
+ if ( parent )
+ SetParent( parent );
+}
+
+Dialog::Dialog( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId )
+ : Context( xml_file )
+ , Window( new DialogImpl( this, Context::GetPeerHandle( id, nId ), this ) )
+{
+ if ( parent )
+ SetParent( parent );
+}
+
+Dialog::~Dialog ()
+{
+}
+
+IMPL_GET_WINDOW (Dialog);
+IMPL_GET_IMPL (Dialog);
+
+#define MX_DIALOG if (getImpl ().mxDialog.is ()) getImpl ().mxDialog
+#define RETURN_MX_DIALOG if (getImpl ().mxDialog.is ()) return getImpl ().mxDialog
+
+short Dialog::Execute()
+{
+ RETURN_MX_DIALOG->execute ();
+ return -1;
+}
+
+void Dialog::EndDialog( long result )
+{
+ MX_DIALOG->endDialog (result);
+}
+
+void Dialog::SetText( OUString const& str )
+{
+ SetTitle (str);
+}
+
+void Dialog::SetTitle( OUString const& str )
+{
+ MX_DIALOG->setTitle (str);
+}
+
+bool Dialog::Close ()
+{
+ EndDialog (false);
+ return true;
+}
+
+long Dialog::Notify (NotifyEvent& event)
+{
+ return GetDialog ()->Notify (event);
+}
+
+void Dialog::Initialize (SfxChildWinInfo*)
+{
+}
+
+#define MESSAGE_BOX_MEMBER_INIT\
+ Dialog (parent, xml_file, id)\
+ , imageError (this, "FI_ERROR")\
+ , imageInfo (this, "FI_INFO")\
+ , imageQuery (this, "FI_QUERY")\
+ , imageWarning (this, "FI_WARNING")\
+ , messageText (this, "FT_MESSAGE")\
+ , cancelButton (this, "BTN_CANCEL")\
+ , helpButton (this, "BTN_HELP")\
+ , ignoreButton (this, "BTN_IGNORE")\
+ , noButton (this, "BTN_NO")\
+ , retryButton (this, "BTN_RETRY")\
+ , yesButton (this, "BTN_YES")
+
+MessageBox::MessageBox (::Window *parent, char const* message,
+ char const* yes, char const* no, sal_uIntPtr help_id,
+ char const* xml_file, char const* id)
+ : MESSAGE_BOX_MEMBER_INIT
+{
+ ignoreButton.Hide ();
+ retryButton.Hide ();
+ init (message, yes, no, help_id);
+}
+
+MessageBox::MessageBox (::Window *parent, OUString const& message,
+ OUString yes, OUString no, sal_uIntPtr help_id,
+ char const* xml_file, char const* id)
+ : MESSAGE_BOX_MEMBER_INIT
+{
+ ignoreButton.Hide ();
+ retryButton.Hide ();
+ init (message, yes, no, help_id);
+}
+
+#if !defined (__GNUC__)
+#define __PRETTY_FUNCTION__ __FUNCTION__
+#endif /* !__GNUC__ */
+
+MessageBox::MessageBox (::Window *parent, WinBits bits, char const* message,
+ char const* yes, char const* no, sal_uIntPtr help_id,
+ char const* xml_file, char const* id)
+ : MESSAGE_BOX_MEMBER_INIT
+{
+ // HIG suggests using verbs instead of yes/no/retry etc.
+ // This constructor provides client-code compatibility: Client code should be fixed.
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
+#endif
+ bits_init (bits, OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
+}
+
+MessageBox::MessageBox (::Window *parent, WinBits bits, OUString const& message,
+ OUString yes, OUString no, sal_uIntPtr help_id,
+ char const* xml_file, char const* id)
+ : MESSAGE_BOX_MEMBER_INIT
+{
+ // HIG suggests using verbs instead of yes/no/retry etc.
+ // This constructor provides client-code compatibility: Client code should be fixed.
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s: warning, deprecated vcl/Messbox compatibility", __PRETTY_FUNCTION__);
+#endif
+ bits_init (bits, message, yes, no, help_id);
+}
+
+void MessageBox::bits_init (WinBits bits, OUString const& message,
+ OUString yes, OUString no, sal_uIntPtr help_id)
+{
+ if ( bits & ( WB_OK_CANCEL | WB_OK ))
+ yes = Button::GetStandardText ( BUTTON_OK );
+ if ( bits & (WB_YES_NO | WB_YES_NO_CANCEL ))
+ {
+ yes = Button::GetStandardText ( BUTTON_YES );
+ no = Button::GetStandardText ( BUTTON_NO );
+ }
+ if (! (bits & (WB_RETRY_CANCEL | WB_YES_NO_CANCEL | WB_ABORT_RETRY_IGNORE )))
+ cancelButton.Hide ();
+ if (! (bits & (WB_RETRY_CANCEL | WB_ABORT_RETRY_IGNORE)))
+ retryButton.Hide ();
+ if ( bits & WB_ABORT_RETRY_IGNORE )
+ cancelButton.SetText ( Button::GetStandardText (BUTTON_ABORT));
+ else
+ ignoreButton.Hide ();
+ if ( !(bits & ( WB_OK | WB_OK_CANCEL | WB_YES_NO | WB_YES_NO_CANCEL)))
+ yesButton.Hide ();
+ if ( !(bits & ( WB_YES_NO | WB_YES_NO_CANCEL)))
+ noButton.Hide ();
+
+ init (message, yes, no, help_id);
+}
+
+void MessageBox::init (char const* message, char const* yes, char const* no, sal_uIntPtr help_id)
+{
+ init ( OUString::createFromAscii (message), OUString::createFromAscii (yes), OUString::createFromAscii (no), help_id);
+}
+
+void MessageBox::init (OUString const& message, OUString const& yes, OUString const& no, sal_uIntPtr help_id)
+{
+ imageError.Hide ();
+ imageInfo.Hide ();
+ imageQuery.Hide ();
+ imageWarning.Hide ();
+ if (message.getLength ())
+ messageText.SetText (message);
+ if (yes.getLength ())
+ {
+ yesButton.SetText (yes);
+ if (yes != OUString (Button::GetStandardText (BUTTON_OK))
+ && yes != OUString (Button::GetStandardText (BUTTON_YES)))
+ SetTitle (yes);
+ if (no.getLength ())
+ noButton.SetText (no);
+ else
+ noButton.Hide ();
+ }
+ if (help_id)
+ SetHelpId (help_id);
+ else
+ helpButton.Hide ();
+}
+
+#undef MESSAGE_BOX_IMPL
+#define MESSAGE_BOX_IMPL(Name)\
+ Name##Box::Name##Box (::Window *parent, char const* message,\
+ char const* yes, char const* no, sal_uIntPtr help_id,\
+ char const* xml_file, char const* id)\
+ : MessageBox (parent, message, yes, no, help_id, xml_file, id)\
+ {\
+ image##Name.Show ();\
+ }\
+ Name##Box::Name##Box (::Window *parent, OUString const& message,\
+ OUString yes, OUString no, sal_uIntPtr help_id,\
+ char const* xml_file, char const* id)\
+ : MessageBox (parent, message, yes, no, help_id, xml_file, id)\
+ {\
+ image##Name.Show ();\
+ }\
+ Name##Box::Name##Box (::Window *parent, WinBits bits, char const* message,\
+ char const* yes, char const* no, sal_uIntPtr help_id,\
+ char const* xml_file, char const* id)\
+ : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\
+ {\
+ image##Name.Show ();\
+ }\
+ Name##Box::Name##Box (::Window *parent, WinBits bits, OUString const& message,\
+ OUString yes, OUString no, sal_uIntPtr help_id,\
+ char const* xml_file, char const* id)\
+ : MessageBox (parent, bits, message, yes, no, help_id, xml_file, id)\
+ {\
+ image##Name.Show ();\
+ }
+
+MESSAGE_BOX_IMPL (Error);
+MESSAGE_BOX_IMPL (Info);
+MESSAGE_BOX_IMPL (Query);
+MESSAGE_BOX_IMPL (Warning);
+
+class TabControlImpl
+ : public ControlImpl
+ , public ::cppu::WeakImplHelper1 <awt::XTabListener>
+{
+ Link mActivatePageHdl;
+ Link mDeactivatePageHdl;
+
+public:
+ uno::Reference <awt::XSimpleTabController> mxTabControl;
+ TabControlImpl (Context *context, const PeerHandle &peer, Window *window)
+ : ControlImpl (context, peer, window)
+ , mxTabControl (peer, uno::UNO_QUERY)
+ {
+ }
+
+ virtual void SAL_CALL disposing (lang::EventObject const& e)
+ throw (uno::RuntimeException)
+ {
+ ControlImpl::disposing (e);
+ mxTabControl.clear ();
+ }
+
+ Link& GetActivatePageHdl ()
+ {
+ return mActivatePageHdl;
+ }
+
+ void SetActivatePageHdl (Link const& link)
+ {
+ if (!mDeactivatePageHdl || !link)
+ UpdateListening (link);
+ mActivatePageHdl = link;
+ }
+
+ Link& GetDeactivatePageHdl ()
+ {
+ return mDeactivatePageHdl;
+ }
+
+ void SetDeactivatePageHdl (Link const& link)
+ {
+ if (!mActivatePageHdl || !link)
+ UpdateListening (link);
+ mDeactivatePageHdl = link;
+ }
+
+ void UpdateListening (Link const& link)
+ {
+ if (!link && (!!mActivatePageHdl || !!mDeactivatePageHdl))
+ mxTabControl->removeTabListener (this);
+ else if (!!link && !mActivatePageHdl && !mDeactivatePageHdl)
+ mxTabControl->addTabListener (this);
+ }
+
+ void SAL_CALL activated (sal_Int32)
+ throw (uno::RuntimeException)
+ {
+ mActivatePageHdl.Call (mpWindow);
+ }
+
+ void SAL_CALL deactivated (sal_Int32)
+ throw (uno::RuntimeException)
+ {
+ mDeactivatePageHdl.Call (mpWindow);
+ }
+
+ void SAL_CALL inserted (sal_Int32)
+ throw (uno::RuntimeException)
+ {
+ }
+
+ void SAL_CALL removed (sal_Int32)
+ throw (uno::RuntimeException)
+ {
+ }
+
+ void SAL_CALL changed (sal_Int32, uno::Sequence <beans::NamedValue> const&)
+ throw (uno::RuntimeException)
+ {
+ }
+};
+
+IMPL_GET_WINDOW (TabControl);
+IMPL_GET_LAYOUT_VCLXWINDOW (TabControl);
+
+#define MX_TABCONTROL if (getImpl ().mxTabControl.is ()) getImpl ().mxTabControl
+#define RETURN_MX_TABCONTROL if (getImpl ().mxTabControl.is ()) return getImpl ().mxTabControl
+
+TabControl::~TabControl ()
+{
+ SetActivatePageHdl (Link ());
+ SetDeactivatePageHdl (Link ());
+}
+
+void TabControl::InsertPage (sal_uInt16 id, OUString const& title, sal_uInt16 pos)
+{
+ (void) pos;
+// GetTabControl ()->InsertPage (id, title, pos);
+// GetTabControl ()->SetTabPage (id, new ::TabPage (GetTabControl ()));
+
+ MX_TABCONTROL->insertTab ();
+ SetCurPageId (id);
+
+#if 1 // colour me loc productive -- NOT
+#define ADD_PROP( seq, i, name, val )\
+ { \
+ beans::NamedValue value; \
+ value.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( name ) ); \
+ value.Value = uno::makeAny( val ); \
+ seq[i] = value; \
+ }
+
+ uno::Sequence< beans::NamedValue > seq (1);
+ ADD_PROP ( seq, 0, "Title", OUString (title) );
+ MX_TABCONTROL->setTabProps (id, seq);
+#else
+ GetTabPage (id)->SetText (title);
+#endif
+
+#if 0
+ /// This so seems the right solution, but it makes the buttons of the
+ /// tabdialog move up
+
+ ::TabPage *page = GetTabPage (id);
+ if (Window *w = dynamic_cast <Window*> (page))
+ {
+ w->SetParent (this);
+ //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
+ //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
+ //GetVCLXTabControl ()->AddChild (w);
+ //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
+ //uno::Reference <uno::XInterface> x (page->GetWindowPeer());
+ //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->::Window::GetWindowPeer (), uno::UNO_QUERY));
+ //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY));
+ }
+ getImpl ().redraw ();
+#endif
+}
+void TabControl::RemovePage (sal_uInt16 id)
+{
+ GetTabControl ()->RemovePage (id);
+}
+sal_uInt16 TabControl::GetPageCount () const
+{
+ return GetTabControl ()->GetPageCount ();
+}
+sal_uInt16 TabControl::GetPageId (sal_uInt16 pos) const
+{
+ return GetTabControl ()->GetPageId (pos);
+}
+sal_uInt16 TabControl::GetPagePos (sal_uInt16 id) const
+{
+ getImpl ().redraw ();
+ return GetTabControl ()->GetPagePos (id);
+}
+void TabControl::SetCurPageId (sal_uInt16 id)
+{
+ getImpl ().redraw ();
+ GetTabControl ()->SetCurPageId (id);
+}
+sal_uInt16 TabControl::GetCurPageId () const
+{
+ return GetTabControl ()->GetCurPageId ();
+}
+void TabControl::SetTabPage (sal_uInt16 id, ::TabPage* page)
+{
+ GetTabControl ()->SetTabPage (id, page);
+
+#if 0
+ /// This so seems the right solution, but it makes the buttons of the
+ /// tabdialog move up
+ if (Window *w = dynamic_cast <Window*> (page))
+ {
+ w->SetParent (this);
+ //GetVCLXTabControl ()->Box_Base::addChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
+ //GetVCLXTabControl ()->Box_Base::AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
+ //GetVCLXTabControl ()->AddChild (w);
+ //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (w->GetPeer (), uno::UNO_QUERY));
+ //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetWindowPeer (), uno::UNO_QUERY));
+ //GetVCLXTabControl ()->AddChild (uno::Reference <awt::XLayoutConstrains> (page->GetComponentInterface (), uno::UNO_QUERY));
+ }
+#endif
+ getImpl ().redraw ();
+}
+::TabPage* TabControl::GetTabPage (sal_uInt16 id) const
+{
+ return GetTabControl ()->GetTabPage (id);
+}
+void TabControl::SetActivatePageHdl (Link const& link)
+{
+ if (&getImpl () && getImpl().mxTabControl.is ())
+ getImpl ().SetActivatePageHdl (link);
+}
+Link& TabControl::GetActivatePageHdl () const
+{
+ return getImpl ().GetActivatePageHdl ();
+}
+void TabControl::SetDeactivatePageHdl (Link const& link)
+{
+ if (&getImpl () && getImpl().mxTabControl.is ())
+ getImpl ().SetDeactivatePageHdl (link);
+}
+Link& TabControl::GetDeactivatePageHdl () const
+{
+ return getImpl ().GetDeactivatePageHdl ();
+}
+void TabControl::SetTabPageSizePixel (Size const& size)
+{
+ GetTabControl ()->SetTabPageSizePixel (size);
+// GetParent()->SetSizePixel (size);
+// GetWindow()->SetSizePixel (size);
+ //GetVCLXTabControl->SetTabSize (size);
+}
+Size TabControl::GetTabPageSizePixel () const
+{
+#if 0
+ //return GetTabControl ()->GetTabPageSizePixel ();
+ static size_t const tab_page_first_index = 1;
+ for (size_t i = 0; i < GetPageCount (); i++)
+ {
+ ::TabPage *p = GetTabPage (i + tab_page_first_index);
+ //if (dynamic_cast<Windowt*> (p))
+ if (i) // URG
+ return p->GetOptimalSize (WINDOWSIZE_MINIMUM);
+ }
+#endif
+ return GetTabControl ()->GetTabPageSizePixel ();
+}
+
+IMPL_CONSTRUCTORS (TabControl, Control, "tabcontrol");
+IMPL_GET_IMPL (TabControl);
+
+class TabPageImpl : public WindowImpl
+{
+public:
+ uno::Reference< awt::XWindow > mxTabPage;
+ TabPageImpl( Context *context, const PeerHandle &peer, Window *window )
+ : WindowImpl( context, peer, window )
+ , mxTabPage( peer, uno::UNO_QUERY )
+ {
+ }
+};
+
+::Window* TabPage::global_parent = 0;
+TabControl* TabPage::global_tabcontrol = 0;
+
+IMPL_GET_IMPL( TabPage );
+
+TabPage::TabPage( Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
+ : Context( xml_file )
+ , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
+{
+ if ( parent )
+ SetParent( parent );
+}
+
+TabPage::TabPage( ::Window *parent, const char *xml_file, const char *id, sal_uInt32 nId)
+ : Context( xml_file )
+ , Window( new TabPageImpl( this, Context::GetPeerHandle( id, nId ), this ) )
+{
+ if ( parent )
+ SetParent( parent );
+}
+
+TabPage::~TabPage()
+{
+ delete GetTabPage();
+}
+
+IMPL_GET_WINDOW( TabPage );
+
+void TabPage::ActivatePage()
+{
+}
+
+void TabPage::DeactivatePage()
+{
+}
+
+class FixedLineImpl : public ControlImpl
+{
+public:
+ FixedLineImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ControlImpl( context, peer, window )
+ {
+ }
+};
+
+IMPL_CONSTRUCTORS( FixedLine, Control, "hfixedline" );
+IMPL_GET_IMPL( FixedLine );
+
+bool FixedLine::IsEnabled() const
+{
+ //FIXME
+ return true;
+}
+
+class FixedTextImpl : public ControlImpl
+{
+public:
+ uno::Reference< awt::XFixedText > mxFixedText;
+ FixedTextImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ControlImpl( context, peer, window )
+ , mxFixedText( peer, uno::UNO_QUERY )
+ {
+ }
+
+ ~FixedTextImpl ();
+
+ virtual void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException);
+};
+
+FixedTextImpl::~FixedTextImpl ()
+{
+}
+
+void SAL_CALL FixedTextImpl::disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+{
+ ControlImpl::disposing (e);
+ mxFixedText.clear ();
+}
+
+FixedText::~FixedText ()
+{
+}
+
+IMPL_CONSTRUCTORS( FixedText, Control, "fixedtext" );
+IMPL_GET_IMPL( FixedText );
+
+void FixedText::SetText( OUString const& rStr )
+{
+ if ( !getImpl().mxFixedText.is() )
+ return;
+ getImpl().mxFixedText->setText( rStr );
+}
+
+class FixedInfoImpl : public FixedTextImpl
+{
+public:
+ FixedInfoImpl( Context *context, const PeerHandle &peer, Window *window )
+ : FixedTextImpl( context, peer, window )
+ {
+ }
+};
+
+IMPL_CONSTRUCTORS( FixedInfo, FixedText, "fixedinfo" );
+IMPL_GET_IMPL( FixedInfo );
+
+class ProgressBarImpl : public ControlImpl
+{
+public:
+ uno::Reference< awt::XProgressBar > mxProgressBar;
+ ProgressBarImpl( Context *context, const PeerHandle &peer, Window *window )
+ : ControlImpl( context, peer, window )
+ , mxProgressBar( peer, uno::UNO_QUERY )
+ {
+ }
+
+ virtual void SAL_CALL disposing( lang::EventObject const& e )
+ throw (uno::RuntimeException)
+ {
+ ControlImpl::disposing (e);
+ mxProgressBar.clear ();
+ }
+};
+
+
+class FixedImageImpl: public ControlImpl
+{
+public:
+ uno::Reference< graphic::XGraphic > mxGraphic;
+ FixedImageImpl( Context *context, const PeerHandle &peer, Window *window)
+// const char *pName )
+ : ControlImpl( context, peer, window )
+ //, mxGraphic( layoutimpl::loadGraphic( pName ) )
+ , mxGraphic( peer, uno::UNO_QUERY )
+ {
+ if ( !mxGraphic.is() )
+ {
+ DBG_ERROR( "ERROR: failed to load image: `%s'" /*, pName*/ );
+ }
+#if 0
+ else
+ getImpl().mxGraphic->...();
+#endif
+ }
+};
+
+IMPL_CONSTRUCTORS( FixedImage, Control, "fixedimage" );
+IMPL_GET_IMPL( FixedImage )
+
+void FixedImage::setImage( ::Image const& i )
+{
+ (void) i;
+ if ( !getImpl().mxGraphic.is() )
+ return;
+ //FIXME: hack moved to proplist
+ //getImpl().mxGraphic =
+}
+
+#if 0
+
+FixedImage::FixedImage( const char *pName )
+ : pImpl( new FixedImageImpl( pName ) )
+{
+}
+
+FixedImage::~FixedImage()
+{
+ delete pImpl;
+}
+
+#endif
+
+
+IMPL_CONSTRUCTORS( ProgressBar, Control, "ProgressBar" );
+IMPL_GET_IMPL( ProgressBar );
+
+void ProgressBar::SetForegroundColor( util::Color color )
+{
+ if ( !getImpl().mxProgressBar.is() )
+ return;
+ getImpl().mxProgressBar->setForegroundColor( color );
+}
+
+void ProgressBar::SetBackgroundColor( util::Color color )
+{
+ if ( !getImpl().mxProgressBar.is() )
+ return;
+ getImpl().mxProgressBar->setBackgroundColor( color );
+}
+
+void ProgressBar::SetValue( sal_Int32 i )
+{
+ if ( !getImpl().mxProgressBar.is() )
+ return;
+ getImpl().mxProgressBar->setValue( i );
+}
+
+void ProgressBar::SetRange( sal_Int32 min, sal_Int32 max )
+{
+ if ( !getImpl().mxProgressBar.is() )
+ return;
+ getImpl().mxProgressBar->setRange( min, max );
+}
+
+sal_Int32 ProgressBar::GetValue()
+{
+ if ( !getImpl().mxProgressBar.is() )
+ return 0;
+ return getImpl().mxProgressBar->getValue();
+}
+
+class PluginImpl: public ControlImpl
+{
+public:
+ ::Control *mpPlugin;
+
+ PluginImpl( Context *context, const PeerHandle &peer, Window *window, :: Control *plugin )
+ : ControlImpl( context, peer, window )
+ , mpPlugin( plugin )
+ {
+ uno::Reference <awt::XWindow> ref( mxWindow, uno::UNO_QUERY );
+ layoutimpl::VCLXPlugin *vcl
+ = static_cast<layoutimpl::VCLXPlugin*>( VCLXWindow::GetImplementation( ref ) );
+ ::Window *parent = vcl->mpWindow->GetParent();
+ vcl->SetWindow( plugin );
+ vcl->SetPlugin( mpPlugin );
+ plugin->SetParent( parent );
+ plugin->SetStyle( vcl->mStyle );
+ plugin->SetCreatedWithToolkit( true );
+ plugin->SetComponentInterface( vcl );
+ plugin->Show();
+ }
+};
+
+Plugin::Plugin( Context *context, char const *id, ::Control *plugin )
+ : Control( new PluginImpl( context, context->GetPeerHandle( id, 0 ), this, plugin ) )
+ , mpPlugin( plugin )
+{
+}
+
+IMPL_GET_IMPL( Plugin );
+
+class LocalizedStringImpl : public WindowImpl
+{
+public:
+ layoutimpl::LocalizedString *mpString;
+ OUString maString;
+ LocalizedStringImpl( Context *context, const PeerHandle &peer, Window *window )
+ : WindowImpl( context, peer, window )
+ , mpString( static_cast<layoutimpl::LocalizedString*>( VCLXWindow::GetImplementation( uno::Reference <awt::XWindow> ( mxWindow, uno::UNO_QUERY ) ) ) )
+ , maString ()
+ {
+ }
+ OUString getText()
+ {
+ if (mpString)
+ maString = mpString->getText ();
+ return maString;
+ }
+ void setText( OUString const& s )
+ {
+ if (mpString)
+ mpString->setText( s );
+ }
+};
+
+IMPL_GET_IMPL( LocalizedString );
+
+LocalizedString::LocalizedString( Context *context, char const* id )
+ : Window( new LocalizedStringImpl( context, context->GetPeerHandle( id, 0 ), this ) )
+{
+}
+
+String LocalizedString::getString ()
+{
+ return getImpl ().getText ();
+}
+
+OUString LocalizedString::getOUString ()
+{
+ return getImpl ().getText ();
+}
+
+LocalizedString::operator OUString ()
+{
+ return getOUString ();
+}
+
+LocalizedString::operator OUString const& ()
+{
+ getOUString ();
+ return getImpl ().maString;
+}
+
+LocalizedString::operator String()
+{
+ getOUString ();
+ return getImpl ().maString;
+}
+
+String LocalizedString::GetToken (USHORT i, sal_Char c)
+{
+ return getString ().GetToken (i, c);
+}
+
+OUString LocalizedString::operator= (OUString const& s)
+{
+ getImpl().setText( s );
+ return getImpl().getText();
+}
+
+OUString LocalizedString::operator+= (OUString const& b)
+{
+ OUString a = getImpl ().getText ();
+ a += b;
+ getImpl ().setText (a);
+ return getImpl ().getText ();
+}
+
+OUString LocalizedString::operator+= (sal_Unicode const b)
+{
+ String a = getImpl ().getText ();
+ a += b;
+ getImpl ().setText (a);
+ return getImpl ().getText ();
+}
+
+class InPlugImpl : public WindowImpl
+{
+public:
+ InPlugImpl (Context *context, const PeerHandle &peer, Window *window)
+ : WindowImpl (context, peer, window)
+ {
+ }
+};
+
+IMPL_GET_IMPL (InPlug);
+
+static char const *FIXME_set_parent (::Window *parent, char const *xml_file)
+{
+ layout::TabPage::global_parent = parent;
+ return xml_file;
+}
+
+InPlug::InPlug (Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
+ : Context (FIXME_set_parent (parent ? parent->GetWindow () : 0, xml_file))
+ , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
+{
+ if (parent)
+ SetParent (parent);
+ if (::Window *w = dynamic_cast< ::Window* > (this))
+ w->SetComponentInterface (GetVCLXWindow ());
+}
+
+InPlug::InPlug (::Window *parent, char const* xml_file, char const* id, sal_uInt32 nId)
+ : Context (FIXME_set_parent (parent, xml_file))
+ , layout::Window (new InPlugImpl (this, Context::GetPeerHandle (id, nId), this))
+{
+ if (parent)
+ layout::Window::SetParent (parent);
+ if (::Window *w = dynamic_cast< ::Window* > (this))
+ w->SetComponentInterface (GetVCLXWindow ());
+}
+
+void InPlug::ParentSet (Window *window)
+{
+ window->SetParent (dynamic_cast< ::Window* > (this));
+
+ /// FIXME: for standalone run of layout::SfxTabDialog
+ SetParent (window->GetParent ());
+}
+
+} // namespace layout
diff --git a/toolkit/source/layout/vcl/wrapper.hxx b/toolkit/source/layout/vcl/wrapper.hxx
new file mode 100644
index 000000000000..2f7e24211150
--- /dev/null
+++ b/toolkit/source/layout/vcl/wrapper.hxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef LAYOUT_VCL_WRAPPER_HXX
+#define LAYOUT_VCL_WRAPPER_HXX
+
+#include <layout/layout.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+#include <cstring>
+
+namespace layout
+{
+
+namespace css = com::sun::star;
+
+class WindowImpl
+{
+public:
+ Window *mpWindow;
+ Context *mpCtx;
+ css::uno::Reference< css::awt::XWindow > mxWindow;
+ css::uno::Reference< css::awt::XVclWindowPeer > mxVclPeer;
+ ::Window *mvclWindow;
+ bool bFirstTimeVisible;
+
+ WindowImpl (Context *context, PeerHandle const &peer, Window *window);
+ virtual ~WindowImpl ();
+
+ void wrapperGone();
+ css::uno::Any getProperty (char const *name);
+ void setProperty (char const *name, css::uno::Any any);
+ void redraw (bool resize=false);
+
+ // XFocusListener
+ virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
+};
+
+class ControlImpl : public WindowImpl
+ , public ::cppu::WeakImplHelper1 <css::awt::XFocusListener>
+{
+public:
+ Link mGetFocusHdl;
+ Link mLoseFocusHdl;
+
+ ControlImpl( Context *context, PeerHandle const& peer, Window *window );
+ ~ControlImpl ();
+
+ virtual void SetGetFocusHdl (Link const& link);
+ Link& GetGetFocusHdl ();
+ virtual void SetLoseFocusHdl (Link const& link);
+ Link& GetLoseFocusHdl ();
+ virtual void UpdateListening (Link const& link);
+
+ // XFocusListener
+ virtual void SAL_CALL disposing (css::lang::EventObject const&) throw (css::uno::RuntimeException);
+ void SAL_CALL focusGained (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
+ void SAL_CALL focusLost (css::awt::FocusEvent const& e) throw (css::uno::RuntimeException);
+};
+
+inline WindowImpl &Window::getImpl() const{ return *(static_cast< WindowImpl * >( mpImpl )); }
+
+// Helpers for defining boiler-plate constructors ...
+// Could in-line in top-level but not with safe static_casts.
+#define IMPL_GET_IMPL(t) \
+ inline t##Impl &t::getImpl() const \
+ { \
+ return *(static_cast<t##Impl *>(mpImpl)); \
+ }
+#define IMPL_CONSTRUCTORS_BODY(t,par,unoName,body) \
+ t::t( Context *context, const char *pId, sal_uInt32 nId ) \
+ : par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
+ { \
+ Window *parent = dynamic_cast<Window*> (context);\
+ body;\
+ if (parent)\
+ SetParent (parent);\
+ } \
+ t::t( Window *parent, WinBits bits) \
+ : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
+ { \
+ body;\
+ if ( parent )\
+ SetParent (parent);\
+ } \
+ t::t( Window *parent, ResId const& res) \
+ : par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, 0, unoName ), this ) ) \
+ { \
+ body;\
+ setRes (res);\
+ if (parent)\
+ SetParent (parent);\
+ }
+#define IMPL_CONSTRUCTORS(t,par,unoName) IMPL_CONSTRUCTORS_BODY(t, par, unoName, )
+#define IMPL_CONSTRUCTORS_2(t,win_par,other_par,unoName) \
+ t::t( Context *context, const char *pId, sal_uInt32 nId ) \
+ : win_par( new t##Impl( context, context->GetPeerHandle( pId, nId ), this ) ) \
+ , other_par( new other_par##Impl( Window::GetPeer() ) ) \
+ { \
+ } \
+ t::t( Window *parent, WinBits bits) \
+ : win_par( new t##Impl( parent->getContext(), Window::CreatePeer( parent, bits, unoName ), this ) ) \
+ , other_par( new other_par##Impl( Window::GetPeer() ) ) \
+ { \
+ }
+
+#define IMPL_IMPL(t, parent) \
+ class t##Impl : public parent##Impl \
+ { \
+ public: \
+ t##Impl( Context *context, PeerHandle const& peer, Window *window ) \
+ : parent##Impl( context, peer, window ) \
+ { \
+ } \
+ };
+
+
+} // namespace layout
+
+#endif /* LAYOUT_VCL_WRAPPER_HXX */
diff --git a/toolkit/src2xml/README b/toolkit/src2xml/README
new file mode 100644
index 000000000000..ef30040f2133
--- /dev/null
+++ b/toolkit/src2xml/README
@@ -0,0 +1,16 @@
+SRC2XML: Convert OO.o resource to Layout XML.
+
+This directory contains a Python script to convert OO.o's existing dialog
+resource files into XML layout files.
+
+The main executable file is located in ./source/src2xml.py. Run
+
+ source/src2xml.py --help
+
+for more information.
+
+See also: source/dryrunall.sh and ../workben/run-s2x
+
+
+Author: Kohei Yoshida <kyoshida@novell.com>
+Modifications: Jan Nieuwenhuizen <jnieuwenhuizen@novell.com>
diff --git a/toolkit/src2xml/dryrunall.sh b/toolkit/src2xml/dryrunall.sh
new file mode 100644
index 000000000000..a2bd803cc7fb
--- /dev/null
+++ b/toolkit/src2xml/dryrunall.sh
@@ -0,0 +1,2 @@
+#! /bin/bash
+source/src2xml.py --dry-run --includes-from=include.lst $(cat src.lst) "$@"
diff --git a/toolkit/src2xml/include-sc.lst b/toolkit/src2xml/include-sc.lst
new file mode 100644
index 000000000000..7b821a2a8407
--- /dev/null
+++ b/toolkit/src2xml/include-sc.lst
@@ -0,0 +1,8 @@
+../../solver/680/unxlngi6.pro/inc
+../../sc
+../../sc/inc
+../../sc/addin/inc
+../../sc/source/ui/inc
+../../sc/source/core/inc
+../../sc/source/filter/inc
+../../sc/unxlngi6.pro/inc
diff --git a/toolkit/src2xml/include-sd.lst b/toolkit/src2xml/include-sd.lst
new file mode 100644
index 000000000000..44b1f66a5ffc
--- /dev/null
+++ b/toolkit/src2xml/include-sd.lst
@@ -0,0 +1,6 @@
+../../solver/680/unxlngi6.pro/inc
+../../sd
+../../sd/inc
+../../sd/source/ui/inc
+../../sd/source/ui/slidesorter/inc
+../../sd/unxlngi6.pro/inc
diff --git a/toolkit/src2xml/include-sw.lst b/toolkit/src2xml/include-sw.lst
new file mode 100644
index 000000000000..44fa8951eecb
--- /dev/null
+++ b/toolkit/src2xml/include-sw.lst
@@ -0,0 +1,5 @@
+../../solver/680/unxlngi6.pro/inc
+../../sw/source/ui/inc
+../../sw/source/core/inc
+../../sw/source/filter/inc
+../../sw/unxlngi6.pro/inc
diff --git a/toolkit/src2xml/include.lst b/toolkit/src2xml/include.lst
new file mode 100644
index 000000000000..a93449625585
--- /dev/null
+++ b/toolkit/src2xml/include.lst
@@ -0,0 +1,301 @@
+../../solver/680/unxlngi6.pro/inc
+../../io/inc
+../../io/unxlngi6.pro/inc
+../../sc/inc
+../../sc/addin/inc
+../../sc/source/ui/inc
+../../sc/source/core/inc
+../../sc/source/filter/inc
+../../sc/unxlngi6.pro/inc
+../../sd/inc
+../../sd/source/ui/inc
+../../sd/source/ui/slidesorter/inc
+../../sd/unxlngi6.pro/inc
+../../sw/inc
+../../sw/source/ui/inc
+../../sw/source/core/inc
+../../sw/source/filter/inc
+../../sw/unxlngi6.pro/inc
+../../xt/unxlngi6.pro/inc
+../../agg/inc
+../../icu/unxlngi6.pro/inc
+../../idl/inc
+../../idl/unxlngi6.pro/inc
+../../nas/unxlngi6.pro/inc
+../../odk/inc
+../../sal/qa/inc
+../../sal/inc
+../../sal/unxlngi6.pro/inc
+../../sax/unxlngi6.pro/inc
+../../sch/inc
+../../sch/source/ui/inc
+../../sch/unxlngi6.pro/inc
+../../sj2/inc
+../../sj2/source/inc
+../../sj2/unxlngi6.pro/inc
+../../rsc/inc
+../../rsc/unxlngi6.pro/inc
+../../so3/inc
+../../so3/unxlngi6.pro/inc
+../../sot/inc
+../../sot/unxlngi6.pro/inc
+../../svx/inc
+../../svx/source/inc
+../../svx/source/unodialogs/inc
+../../svx/unxlngi6.pro/inc
+../../ucb/inc
+../../ucb/source/inc
+../../ucb/unxlngi6.pro/inc
+../../udm/inc
+../../udm/source/inc
+../../vcl/inc
+../../vcl/unx/inc
+../../vcl/unx/source/inc
+../../vcl/win/inc
+../../vcl/aqua/inc
+../../vcl/unxlngi6.pro/inc
+../../ure/unxlngi6.pro/inc
+../../uui/unxlngi6.pro/inc
+../../vos/inc
+../../vos/unxlngi6.pro/inc
+../../dbaccess/inc
+../../dbaccess/source/ui/inc
+../../dbaccess/source/inc
+../../dbaccess/source/core/inc
+../../dbaccess/source/sdbtools/inc
+../../dbaccess/unxlngi6.pro/inc
+../../transex3/inc
+../../transex3/unxlngi6.pro/inc
+../../bean/unxlngi6.pro/inc
+../../cosv/inc
+../../cosv/source/inc
+../../cppu/inc
+../../cppu/unxlngi6.pro/inc
+../../idlc/inc
+../../idlc/unxlngi6.pro/inc
+../../o3tl/inc
+../../o3tl/unxlngi6.pro/inc
+../../jurt/unxlngi6.pro/inc
+../../sane/inc
+../../scp2/inc
+../../scp2/unxlngi6.pro/inc
+../../sfx2/inc
+../../sfx2/source/inc
+../../sfx2/unxlngi6.pro/inc
+../../stoc/inc
+../../stoc/unxlngi6.pro/inc
+../../framework/inc
+../../framework/source/inc
+../../framework/unxlngi6.pro/inc
+../../desktop/inc
+../../desktop/source/inc
+../../desktop/source/deployment/inc
+../../desktop/source/deployment/registry/inc
+../../desktop/unxlngi6.pro/inc
+../../external/unxlngi6.pro/inc
+../../xml2cmp/source/inc
+../../xml2cmp/unxlngi6.pro/inc
+../../xmlhelp/inc
+../../xmlhelp/unxlngi6.pro/inc
+../../soltools/inc
+../../soltools/testSHL/inc
+../../soltools/unxlngi6.pro/inc
+../../unixODBC/inc
+../../basic/inc
+../../basic/source/inc
+../../basic/unxlngi6.pro/inc
+../../boost/unxlngi6.pro/inc
+../../XmlSearch/unxlngi6.pro/inc
+../../fondu/unxlngi6.pro/inc
+../../forms/inc
+../../forms/source/inc
+../../forms/source/solar/inc
+../../forms/unxlngi6.pro/inc
+../../ridljar/unxlngi6.pro/inc
+../../offuh/unxlngi6.pro/inc
+../../pyuno/inc
+../../pyuno/unxlngi6.pro/inc
+../../shell/inc
+../../shell/unxlngi6.pro/inc
+../../store/inc
+../../store/unxlngi6.pro/inc
+../../sysui/unxlngi6.pro/inc
+../../tools/inc
+../../tools/win/inc
+../../tools/unxlngi6.pro/inc
+../../twain/inc
+../../unoil/unxlngi6.pro/inc
+../../cppcanvas/inc
+../../cppcanvas/source/inc
+../../cppcanvas/unxlngi6.pro/inc
+../../eventattacher/unxlngi6.pro/inc
+../../unotools/inc
+../../unotools/unxlngi6.pro/inc
+../../scaddins/unxlngi6.pro/inc
+../../javaunohelper/inc
+../../javaunohelper/unxlngi6.pro/inc
+../../configmgr/inc
+../../configmgr/source/inc
+../../configmgr/unxlngi6.pro/inc
+../../hwpfilter/inc
+../../hwpfilter/unxlngi6.pro/inc
+../../libxmlsec/unxlngi6.pro/inc
+../../jvmaccess/inc
+../../jvmaccess/unxlngi6.pro/inc
+../../comphelper/inc
+../../comphelper/unxlngi6.pro/inc
+../../helpcontent2/unxlngi6.pro/inc
+../../animations/inc
+../../animations/unxlngi6.pro/inc
+../../fileaccess/unxlngi6.pro/inc
+../../i18npool/inc
+../../i18npool/unxlngi6.pro/inc
+../../i18nutil/inc
+../../i18nutil/unxlngi6.pro/inc
+../../accessibility/inc
+../../accessibility/unxlngi6.pro/inc
+../../testshl2/inc
+../../testshl2/source/inc
+../../testshl2/unxlngi6.pro/inc
+../../lpsolve/unxlngi6.pro/inc
+../../setup_native/inc
+../../setup_native/unxlngi6.pro/inc
+../../embedserv/source/inc
+../../psprint_config/unxlngi6.pro/inc
+../../basctl/inc
+../../basctl/source/inc
+../../basctl/unxlngi6.pro/inc
+../../cpputools/unxlngi6.pro/inc
+../../stlport/unxlngi6.pro/inc
+../../canvas/inc
+../../canvas/unxlngi6.pro/inc
+../../embeddedobj/inc
+../../embeddedobj/source/inc
+../../embeddedobj/unxlngi6.pro/inc
+../../chart2/inc
+../../chart2/source/inc
+../../chart2/source/view/inc
+../../chart2/source/model/inc
+../../chart2/source/controller/inc
+../../chart2/unxlngi6.pro/inc
+../../scsolver/source/inc
+../../scsolver/unxlngi6.pro/inc
+../../automation/inc
+../../automation/source/inc
+../../automation/unxlngi6.pro/inc
+../../portaudio/unxlngi6.pro/inc
+../../svtools/inc
+../../svtools/unx/inc
+../../svtools/source/inc
+../../svtools/unxlngi6.pro/inc
+../../dtrans/inc
+../../dtrans/source/inc
+../../dtrans/unxlngi6.pro/inc
+../../x11_extensions/inc
+../../fpicker/inc
+../../fpicker/unxlngi6.pro/inc
+../../filter/inc
+../../filter/unxlngi6.pro/inc
+../../extras/unxlngi6.pro/inc
+../../writerperfect/unxlngi6.pro/inc
+../../toolkit/inc
+../../toolkit/unxlngi6.pro/inc
+../../officecfg/unxlngi6.pro/inc
+../../unodevtools/inc
+../../unodevtools/unxlngi6.pro/inc
+../../cppuhelper/inc
+../../cppuhelper/unxlngi6.pro/inc
+../../jvmfwk/inc
+../../jvmfwk/unxlngi6.pro/inc
+../../layout/inc
+../../layout/unxlngi6.pro/inc
+../../linguistic/inc
+../../linguistic/unxlngi6.pro/inc
+../../libegg/inc
+../../libegg/unxlngi6.pro/inc
+../../libwpd/unxlngi6.pro/inc
+../../libwpg/unxlngi6.pro/inc
+../../libwps/unxlngi6.pro/inc
+../../lingucomponent/inc
+../../lingucomponent/unxlngi6.pro/inc
+../../np_sdk/unxlngi6.pro/inc
+../../offapi/unxlngi6.pro/inc
+../../xmlsecurity/inc
+../../xmlsecurity/unxlngi6.pro/inc
+../../padmin/unxlngi6.pro/inc
+../../regexp/inc
+../../regexp/unxlngi6.pro/inc
+../../ucbhelper/inc
+../../ucbhelper/unxlngi6.pro/inc
+../../berkeleydb/unxlngi6.pro/inc
+../../UnoControls/inc
+../../UnoControls/source/inc
+../../UnoControls/unxlngi6.pro/inc
+../../msfontextract/unxlngi6.pro/inc
+../../solenv/inc
+../../solenv/unxmacxp/inc
+../../solver/680/unxlngi6.pro/inc
+../../postprocess/unxlngi6.pro/inc
+../../udkapi/unxlngi6.pro/inc
+../../unoxml/unxlngi6.pro/inc
+../../starmath/inc
+../../starmath/unxlngi6.pro/inc
+../../mdbtools/unxlngi6.pro/inc
+../../basebmp/inc
+../../basegfx/inc
+../../basegfx/source/inc
+../../basegfx/unxlngi6.pro/inc
+../../xmerge/inc
+../../xmerge/source/inc
+../../xmerge/unxlngi6.pro/inc
+../../xmloff/inc
+../../xmloff/unxlngi6.pro/inc
+../../oovbaapi/unxlngi6.pro/inc
+../../package/inc
+../../package/unxlngi6.pro/inc
+../../extensions/inc
+../../extensions/source/inc
+../../extensions/source/plugin/inc
+../../extensions/unxlngi6.pro/inc
+../../codemaker/inc
+../../codemaker/unxlngi6.pro/inc
+../../salhelper/inc
+../../salhelper/unxlngi6.pro/inc
+../../rdbmaker/inc
+../../rdbmaker/unxlngi6.pro/inc
+../../instsetoo_native/unxlngi6.pro/inc
+../../autodoc/inc
+../../autodoc/source/ary/inc
+../../autodoc/source/inc
+../../autodoc/source/display/inc
+../../autodoc/source/parser_i/inc
+../../autodoc/source/parser/inc
+../../avmedia/inc
+../../avmedia/source/inc
+../../avmedia/unxlngi6.pro/inc
+../../lotuswordpro/unxlngi6.pro/inc
+../../remotebridges/unxlngi6.pro/inc
+../../slideshow/inc
+../../slideshow/source/inc
+../../slideshow/unxlngi6.pro/inc
+../../connectivity/inc
+../../connectivity/source/inc
+../../connectivity/unxlngi6.pro/inc
+../../readlicense_oo/unxlngi6.pro/inc
+../../scripting/inc
+../../scripting/source/inc
+../../scripting/unxlngi6.pro/inc
+../../wizards/unxlngi6.pro/inc
+../../xmlscript/inc
+../../xmlscript/source/inc
+../../xmlscript/unxlngi6.pro/inc
+../../bridges/inc
+../../bridges/unxlngi6.pro/inc
+../../testtools/inc
+../../testtools/unxlngi6.pro/inc
+../../registry/inc
+../../registry/unxlngi6.pro/inc
+../../cli_ure/inc
+../../cli_ure/unxlngi6.pro/inc
+../../psprint/inc
+../../psprint/unxlngi6.pro/inc
diff --git a/toolkit/src2xml/sc.sh b/toolkit/src2xml/sc.sh
new file mode 100644
index 000000000000..1bfb213ccf12
--- /dev/null
+++ b/toolkit/src2xml/sc.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+source/src2xml.py --include-path=$(tr '\n' ':' < include-sc.lst) --dry-run $(cat src-sc.lst) "$@"
diff --git a/toolkit/src2xml/sd.sh b/toolkit/src2xml/sd.sh
new file mode 100644
index 000000000000..78b47201fc00
--- /dev/null
+++ b/toolkit/src2xml/sd.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+source/src2xml.py --include-path=$(tr '\n' ':' < include-sd.lst) --dry-run $(cat src-sd.lst) "$@"
diff --git a/toolkit/src2xml/source/boxer.py b/toolkit/src2xml/source/boxer.py
new file mode 100644
index 000000000000..1b716d757299
--- /dev/null
+++ b/toolkit/src2xml/source/boxer.py
@@ -0,0 +1,73 @@
+
+from globals import *
+
+
+class DlgLayoutBuilder(object):
+ def __init__ (self, dlgnode):
+ self.dlgnode = dlgnode
+ self.rows = {}
+
+ def addWidget (self, elem):
+ x, y = int(elem.getAttr('x')), int(elem.getAttr('y'))
+ self.rows[y] = self.rows.get (y, {})
+ while self.rows[y].has_key(x):
+ y += 1
+ self.rows[y] = self.rows.get (y, {})
+ self.rows[y][x] = elem
+
+ def build (self):
+ root = Element('vbox')
+ ys = self.rows.keys()
+ ys.sort()
+ for y in ys:
+ xs = self.rows[y].keys()
+ xs.sort()
+
+ if len(xs) == 1:
+ root.appendChild(self.rows[y][xs[0]])
+ continue
+
+ hbox = Element('hbox')
+ root.appendChild(hbox)
+ for x in xs:
+ elem = self.rows[y][x]
+ hbox.appendChild(elem)
+
+ return root
+
+
+class Boxer(object):
+ def __init__ (self, root):
+ self.root = root
+
+ def layout (self):
+
+ newroot = RootNode()
+ for dlgnode in self.root.children:
+ newdlgnode = self.__walkDlgNode(dlgnode)
+ newroot.children.append(newdlgnode)
+
+ return newroot
+
+ def __walkDlgNode (self, dlgnode):
+
+ newnode = Element(dlgnode.name)
+ newnode.clone(dlgnode)
+ if dlgnode.name == 'string':
+ return newnode
+ newnode.setAttr("xmlns", "http://openoffice.org/2007/layout")
+ newnode.setAttr("xmlns:cnt", "http://openoffice.org/2007/layout/container")
+ mx = DlgLayoutBuilder(newnode)
+
+ # Each dialog node is expected to have a flat list of widgets.
+ for widget in dlgnode.children:
+ if widget.hasAttr('x') and widget.hasAttr('y'):
+ mx.addWidget(widget)
+ else:
+ newnode.appendChild(widget)
+
+ vbox = mx.build()
+ if len(vbox.children) > 0:
+ newnode.appendChild(vbox)
+
+ return newnode
diff --git a/toolkit/src2xml/source/expression.py b/toolkit/src2xml/source/expression.py
new file mode 100644
index 000000000000..b5f58c42d112
--- /dev/null
+++ b/toolkit/src2xml/source/expression.py
@@ -0,0 +1,111 @@
+
+import sys
+import globals
+
+def toString (node):
+
+ if node == None:
+ return ''
+
+ chars = '('
+
+ if type(node.left) == type(0):
+ chars += "%d"%node.left
+ else:
+ chars += toString(node.left)
+
+ chars += node.op
+
+ if type(node.right) == type(0):
+ chars += "%d"%node.right
+ else:
+ chars += toString(node.right)
+
+ chars += ")"
+
+ return chars
+
+class Node(object):
+ def __init__ (self):
+ self.left = None
+ self.right = None
+ self.parent = None
+ self.op = None
+
+class ExpParser(object):
+
+ def __init__ (self, tokens):
+ self.tokens = tokens
+
+ def jumpToRoot (self):
+ while self.ptr.parent != None:
+ self.ptr = self.ptr.parent
+
+ def build (self):
+ self.ptr = Node()
+
+ for token in self.tokens:
+
+ if token in '+-':
+ if self.ptr.left == None:
+ raise globals.ParseError ('')
+ if self.ptr.right == None:
+ self.ptr.op = token
+ else:
+ self.jumpToRoot()
+ self.ptr.parent = Node()
+ self.ptr.parent.left = self.ptr
+ self.ptr = self.ptr.parent
+ self.ptr.op = token
+
+ elif token in '*/':
+ if self.ptr.left == None:
+ raise globals.ParseError ('')
+ elif self.ptr.right == None:
+ self.ptr.op = token
+ else:
+ num = self.ptr.right
+ self.ptr.right = Node()
+ self.ptr.right.parent = self.ptr
+ self.ptr.right.left = num
+ self.ptr.right.op = token
+ self.ptr = self.ptr.right
+
+ elif token == '(':
+ if self.ptr.left == None:
+ self.ptr.left = Node()
+ self.ptr.left.parent = self.ptr
+ self.ptr = self.ptr.left
+ elif self.ptr.right == None:
+ self.ptr.right = Node()
+ self.ptr.right.parent = self.ptr
+ self.ptr = self.ptr.right
+ else:
+ raise globals.ParseError ('')
+
+ elif token == ')':
+ if self.ptr.left == None:
+ raise globals.ParseError ('')
+ elif self.ptr.right == None:
+ raise globals.ParseError ('')
+ elif self.ptr.parent == None:
+ pass
+ else:
+ self.ptr = self.ptr.parent
+
+ else:
+ num = int(token)
+ if self.ptr.left == None:
+ self.ptr.left = num
+ elif self.ptr.right == None:
+ self.ptr.right = num
+ else:
+ raise globals.ParseError ('')
+
+ def dumpTree (self):
+ self.jumpToRoot()
+ print toString(self.ptr)
+
+
+
+
diff --git a/toolkit/src2xml/source/expression_test.py b/toolkit/src2xml/source/expression_test.py
new file mode 100644
index 000000000000..7e7393fb2fba
--- /dev/null
+++ b/toolkit/src2xml/source/expression_test.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import sys
+import expression
+
+def run (exp):
+ tokens = exp.split()
+ expparser = expression.ExpParser(tokens)
+ expparser.build()
+ expparser.dumpTree()
+
+def main ():
+ run("6 + 34")
+ run("6 + 34 - 10")
+ run("6 + 34 - 10 + 200")
+ run("6 + 34 - 10 * 200")
+ run("6 + 34 - 10 * 200 + 18")
+ run("6 + 34 - 10 * 200 + 18 / 2")
+
+ run("6 * ( ( 10 + 2 ) - 10 ) * 33")
+
+if __name__ == '__main__':
+ main()
diff --git a/toolkit/src2xml/source/globals.py b/toolkit/src2xml/source/globals.py
new file mode 100644
index 000000000000..5e170b8c2a6e
--- /dev/null
+++ b/toolkit/src2xml/source/globals.py
@@ -0,0 +1,115 @@
+import sys
+
+class ParseError (Exception):
+ pass
+
+def error (msg, exit=0):
+ sys.stderr.write (msg)
+ if exit:
+ sys.exit (exit)
+
+def progress (msg):
+ sys.stderr.write(msg)
+
+
+def removeQuote (text):
+ """Remove quotes from a literal.
+"""
+ if len(text) >= 2 and text[0] == text[len(text)-1] == '"':
+ text = text[1:-1]
+ return text
+
+
+class Macro(object):
+ def __init__ (self, name):
+ self.name = name
+ self.tokens = []
+ self.vars = {}
+
+
+class Node(object):
+ def __init__ (self):
+ self.children = []
+
+ def appendChild (self, childnode):
+ self.children.append(childnode)
+ childnode.parent = self
+
+ def getChildren (self):
+ return self.children
+
+
+class RootNode(Node):
+ def __init__ (self):
+ Node.__init__(self)
+
+ def dump (self):
+ chars = ''
+ for child in self.getChildren():
+ chars += child.dump()
+ return chars
+
+
+class Element(Node):
+
+ INDENT = " "
+
+ def __init__ (self, name, rid = None):
+ Node.__init__(self)
+ self.name = name
+ self.parent = None
+# print "name: " + self.name - stats ...
+
+ # The following attributes are copied when 'clone'ed.
+ self.rid = rid
+ self.attrs = {}
+
+ def dump (self, level = 0):
+ chars = ''
+ chars += "\n" + Element.INDENT*level
+ chars += '<%s'%self.name
+
+ if self.rid != None:
+ self.setAttr("rid", self.rid)
+
+ chars += self.__dumpAttrs()
+
+ if len(self.children) == 0:
+ chars += '/>'
+ else:
+ chars += '>'
+ for child in self.getChildren():
+ chars += child.dump(level+1)
+
+ chars += "\n"+Element.INDENT*level
+ chars += "</%s>"%self.name
+
+ return chars
+
+ def hasAttr (self, name):
+ return self.attrs.has_key(name)
+
+ def getAttr (self, name):
+ return self.attrs[name]
+
+ def setAttr (self, name, value):
+ if type(value) == type(0):
+ value = "%d"%value
+ self.attrs[name] = removeQuote(value)
+# print "attr: " + self.name + "." + name - stats ...
+ return
+
+ def clone (self, elem):
+ keys = elem.attrs.keys()
+ for key in keys:
+ self.attrs[key] = elem.attrs[key]
+ self.rid = elem.rid
+
+ def __dumpAttrs (self):
+ text = ''
+ keys = self.attrs.keys()
+ keys.sort()
+ for key in keys:
+ value = self.attrs[key]
+ text += ' %s="%s"'%(key, value)
+ return text
diff --git a/toolkit/src2xml/source/macroexpander_test.py b/toolkit/src2xml/source/macroexpander_test.py
new file mode 100644
index 000000000000..823bcdb36bc2
--- /dev/null
+++ b/toolkit/src2xml/source/macroexpander_test.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+import srclexer, srcparser, globals
+
+class TestCase:
+
+ @staticmethod
+ def run (tokens, defines):
+ mcExpander = srcparser.MacroExpander(tokens, defines)
+ mcExpander.debug = True
+ mcExpander.expand()
+ tokens = mcExpander.getTokens()
+ print tokens
+
+ @staticmethod
+ def simpleNoArgs ():
+ tokens = ['FUNC_FOO', '(', 'left', ',', 'right', ')']
+ defines = {}
+ macro = globals.Macro('FUNC_FOO')
+ macro.tokens = ['Here', 'comes', 'X', 'and', 'Y']
+ defines['FUNC_FOO'] = macro
+ TestCase.run(tokens, defines)
+
+ @staticmethod
+ def simpleArgs ():
+ tokens = ['FUNC_FOO', '(', 'left', ',', 'right', ')']
+ defines = {}
+ macro = globals.Macro('FUNC_FOO')
+ macro.tokens = ['Here', 'comes', 'X', 'and', 'Y']
+ macro.vars['X'] = 0
+ macro.vars['Y'] = 1
+ defines['FUNC_FOO'] = macro
+ TestCase.run(tokens, defines)
+
+ @staticmethod
+ def multiTokenArgs ():
+ tokens = ['FUNC_FOO', '(', 'left1', 'left2', 'left3', ',', 'right', ')']
+ defines = {}
+ macro = globals.Macro('FUNC_FOO')
+ macro.tokens = ['Here', 'comes', 'X', 'and', 'Y']
+ macro.vars['X'] = 0
+ macro.vars['Y'] = 1
+ defines['FUNC_FOO'] = macro
+ TestCase.run(tokens, defines)
+
+ @staticmethod
+ def nestedTokenArgs ():
+ tokens = ['FUNC_BAA', '(', 'left', ',', 'right', ')']
+ defines = {}
+ macro = globals.Macro('FUNC_FOO')
+ macro.tokens = ['Here', 'comes', 'X', 'and', 'Y']
+ macro.vars['X'] = 0
+ macro.vars['Y'] = 1
+ defines['FUNC_FOO'] = macro
+ macro = globals.Macro('FUNC_BAA')
+ macro.tokens = ['FUNC_FOO']
+ defines['FUNC_BAA'] = macro
+ TestCase.run(tokens, defines)
+
+def main ():
+ print "simple expansion with no arguments"
+ TestCase.simpleNoArgs()
+ print "simple argument expansion"
+ TestCase.simpleArgs()
+ print "multi-token argument expansion"
+ TestCase.multiTokenArgs()
+ print "nested argument expansion"
+ TestCase.nestedTokenArgs()
+
+if __name__ == '__main__':
+ main()
diff --git a/toolkit/src2xml/source/macroparser.py b/toolkit/src2xml/source/macroparser.py
new file mode 100644
index 000000000000..1a221b404d42
--- /dev/null
+++ b/toolkit/src2xml/source/macroparser.py
@@ -0,0 +1,130 @@
+
+import sys
+from globals import *
+import srclexer
+
+class MacroParser(object):
+
+ def __init__ (self, buf):
+ self.buffer = buf
+ self.macro = None
+ self.debug = False
+
+ def parse (self):
+ """
+A macro with arguments must have its open paren immediately following
+its name without any whitespace.
+"""
+ if self.debug:
+ print "-"*68
+ print "parsing '%s'"%self.buffer
+
+ i = 0
+ bufSize = len(self.buffer)
+ name, buf = '', ''
+ while i < bufSize:
+ c = self.buffer[i]
+ if c in [' ', "\t"] and len(name) == 0:
+ # This is a simple macro with no arguments.
+ name = buf
+ vars = []
+ content = self.buffer[i:]
+ self.setMacro(name, vars, content)
+ return
+ elif c == '(' and len(name) == 0:
+ # This one has arguments.
+ name = buf
+ buf = self.buffer[i:]
+ vars, content = self.parseArgs(buf)
+ self.setMacro(name, vars, content)
+ return
+ else:
+ buf += c
+ i += 1
+
+ def parseArgs (self, buffer):
+ """Parse arguments.
+
+The buffer is expected to be formatted like '(a, b, c)' where the first
+character is the open paren.
+"""
+ scope = 0
+ buf = ''
+ vars = []
+ content = ''
+ bufSize = len(buffer)
+ i = 0
+ while i < bufSize:
+ c = buffer[i]
+ if c == '(':
+ scope += 1
+ elif c == ')':
+ scope -= 1
+ if len(buf) > 0:
+ vars.append(buf)
+ if scope == 0:
+ break
+ elif c == ',':
+ if len(buf) == 0:
+ raise globals.ParseError ('')
+ vars.append(buf)
+ buf = ''
+ elif c in " \t" and scope > 0:
+ pass
+ else:
+ buf += c
+
+ i += 1
+
+ if scope > 0:
+ raise globals.ParseError ('')
+
+ return vars, buffer[i+1:]
+
+
+ def setMacro (self, name, vars, content):
+ if self.debug:
+ print "-"*68
+ print "name: %s"%name
+ for var in vars:
+ print "var: %s"%var
+ if len(vars) == 0:
+ print "no vars"
+ print "content: '%s'"%content
+
+ if len(content) > 0:
+ self.macro = Macro(name)
+ for i in xrange(0, len(vars)):
+ self.macro.vars[vars[i]] = i
+
+ # tokinize it using lexer.
+ mclexer = srclexer.SrcLexer(content)
+ mclexer.expandHeaders = False
+ mclexer.inMacroDefine = True
+ mclexer.tokenize()
+ self.macro.tokens = mclexer.getTokens()
+ if self.debug:
+ print self.macro.tokens
+
+ if not self.isValidMacro(self.macro):
+ self.macro = None
+
+ if self.debug:
+ if self.macro != None:
+ print "macro registered!"
+ else:
+ print "macro not registered"
+
+ def isValidMacro (self, macro):
+
+ n = len(macro.tokens)
+ if n == 0:
+ return False
+ elif len(macro.name) > 4 and macro.name[1:4] == 'ID_':
+ # We don't want to expand macros like HID_, SID_, WID_, etc.
+ return False
+ return True
+
+
+ def getMacro (self):
+ return self.macro
diff --git a/toolkit/src2xml/source/macroparser_test.py b/toolkit/src2xml/source/macroparser_test.py
new file mode 100644
index 000000000000..a7064832d1f8
--- /dev/null
+++ b/toolkit/src2xml/source/macroparser_test.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import macroparser
+
+def runParser (buf):
+ mparser = macroparser.MacroParser(buf)
+ mparser.debug = True
+ mparser.parse()
+
+def main ():
+ buf = 'FOO (asdfsdaf)'
+ runParser(buf)
+ buf = 'FOO (x, y) (x) + (y)'
+ runParser(buf)
+ buf = 'FOO(x, y) (x) + (y)'
+ runParser(buf)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/toolkit/src2xml/source/src2xml.py b/toolkit/src2xml/source/src2xml.py
new file mode 100644
index 000000000000..b03c5e61ede1
--- /dev/null
+++ b/toolkit/src2xml/source/src2xml.py
@@ -0,0 +1,227 @@
+#!/usr/bin/env python
+
+import getopt
+import os
+import re
+import sys
+#
+from srclexer import SrcLexer
+from srcparser import SrcParser
+from boxer import Boxer
+# FIXME
+from globals import *
+
+def option_parser ():
+ import optparse
+ p = optparse.OptionParser ()
+
+ p.usage = '''src2xml.py [OPTION]... SRC-FILE...'''
+
+ examples = '''
+Examples:
+ src2xml.py --output-dir=. --post-process --ignore-includes zoom.src
+ src2xml.py --dry-run -I svx/inc -I svx/source/dialog zoom.src
+'''
+
+ def format_examples (self):
+ return examples
+
+ if 'epilog' in p.__dict__:
+ p.formatter.format_epilog = format_examples
+ p.epilog = examples
+ else:
+ p.formatter.format_description = format_examples
+ p.description = examples
+
+ p.description = '''OOo SRC To Layout XML Converter.
+
+Convert OO.o's existing dialog resource files into XML layout files.
+'''
+
+ p.add_option ('-l', '--debug-lexer', action='store_true',
+ dest='debug_lexer', default=False,
+ help='debug lexer')
+
+ p.add_option ('-p', '--debug-parser', action='store_true',
+ dest='debug_parser', default=False,
+ help='debug parser')
+
+ p.add_option ('-m', '--debug-macro', action='store_true',
+ dest='debug_macro', default=False,
+ help='debug macro')
+
+ p.add_option ('-n', '--dry-run', action='store_true',
+ dest='dry_run', default=False,
+ help='dry run')
+
+ p.add_option ('-k', '--keep-going', action='store_true',
+ dest='keep_going', default=False,
+ help='continue after error')
+
+ p.add_option ('-i', '--ignore-includes', action='store_true',
+ dest='ignore_includes', default=False,
+ help='ignore #include directives')
+
+ p.add_option ('-I', '--include-dir', action='append',
+ dest='include_path',
+ default=[],
+ metavar='DIR',
+ help='append DIR to include path')
+
+ def from_file (option, opt_str, value, parser):
+ lst = getattr (parser.values, option.dest)
+ lst += file (value).read ().split ('\n')
+ setattr (parser.values, option.dest, lst)
+
+ def from_path (option, opt_str, value, parser):
+ lst = getattr (parser.values, option.dest)
+ lst += value.split (':')
+ setattr (parser.values, option.dest, lst)
+
+ # Junk me?
+ p.add_option ('--includes-from-file', action='callback', callback=from_file,
+ dest='include_path',
+ default=[],
+ type='string',
+ metavar='FILE',
+ help='append directory list from FILE to include path')
+
+ p.add_option ('--include-path', action='callback', callback=from_path,
+ dest='include_path',
+ type='string',
+ default=[],
+ metavar='PATH',
+ help='append PATH to include path')
+
+ p.add_option ('--only-expand-macros', action='store_true',
+ dest='only_expand_macros', default=False,
+ help='FIXME: better to say what NOT to expand?')
+
+ p.add_option ('-o', '--output-dir', action='store',
+ dest='output_dir', default=None,
+ metavar='DIR',
+ help='Output to DIR')
+
+ p.add_option ('-s', '--post-process', action='store_true',
+ dest='post_process', default=False,
+ help='post process output for use in Layout')
+
+ p.add_option ('--stop-on-header', action='store_true',
+ dest='stopOnHeader', default=False,
+ help='FIXME: remove this?')
+
+ return p
+
+
+def convert (file_name, options):
+ progress ("parsing %(file_name)s ..." % locals ())
+ fullpath = os.path.abspath(file_name)
+ if not os.path.isfile(fullpath):
+ error("no such file", exit=True)
+
+ ##options.include_path.append (os.path.dirname (fullpath))
+
+ input = file (fullpath, 'r').read()
+ lexer = SrcLexer(input, fullpath)
+ lexer.expandHeaders = not options.ignore_includes
+ lexer.includeDirs = options.include_path
+ lexer.stopOnHeader = options.stopOnHeader
+ lexer.debugMacro = options.debug_macro
+ if options.debug_lexer:
+ lexer.debug = True
+ lexer.tokenize()
+ progress ("-"*68 + "\n")
+ progress ("** token dump\n")
+ lexer.dumpTokens()
+ progress ("** end of token dump\n")
+ return
+
+ # Tokenize it using lexer
+ lexer.tokenize()
+
+ parser = SrcParser(lexer.getTokens(), lexer.getDefines())
+ parser.only_expand_macros = options.only_expand_macros
+ if options.debug_parser:
+ parser.debug = True
+ root = parser.parse()
+ s = root.dump()
+ return s
+
+ # Parse the tokens.
+ root = parser.parse()
+
+ # Box it, and return the XML tree.
+ root = Boxer(root).layout()
+ output = root.dump()
+ if not options.dry_run:
+ progress ("\n")
+ return output
+
+def dry_one_file (file_name, options):
+ try:
+ str = convert(file_name, options)
+ progress (" SUCCESS\n")
+ except Exception, e:
+ if options.keep_going:
+ progress (" FAILED\n")
+ else:
+ import traceback
+ print traceback.format_exc (None)
+ raise e
+
+def post_process (s):
+ """Make output directly usable by layout module."""
+ s = re.sub ('(</?)([a-z]+)-([a-z]+)-([a-z]+)', r'\1\2\3\4', s)
+ s = re.sub ('(</?)([a-z]+)-([a-z]+)', r'\1\2\3', s)
+ s = re.sub ('(<(checkbox|(cancel|help|ignore|ok|push|more|no|radio|reset|retry|yes)button|(fixed(info|text)))[^>]*) text=', r'\1 label=', s)
+ s = re.sub (' (height|width|x|y)="[0-9]*"', '', s)
+ s = re.sub (' (label|text|title)="', r' _\1="', s)
+ s = re.sub ('&([^m][^p]*[^;]*)', r'&amp;\1', s)
+ s = re.sub (' hide="(TRUE|true|1)"', ' show="false"', s)
+
+ s = s.replace ('<modaldialog', '<modaldialog sizeable="true"')
+ s = s.replace (' rid=', ' id=')
+ s = s.replace (' border="true"', ' has_border="true"')
+ s = s.replace (' def-button="true"', ' defbutton="true"')
+ s = s.replace (' drop-down="', ' dropdown="')
+ s = s.replace (' tab-stop="', ' tabstop="')
+ return s
+
+XML_HEADER = '''<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+'''
+
+def do_one_file (file_name, options):
+ str = XML_HEADER
+ str += convert(file_name, options)
+ str += '\n'
+
+ if options.post_process:
+ str = post_process (str)
+ h = sys.stdout
+ if options.output_dir:
+ base = os.path.basename (file_name)
+ root, ext = os.path.splitext (base)
+ out_name = options.output_dir + '/' + root + '.xml'
+ progress ("writing %(out_name)s ..." % locals ())
+ h = file (out_name, 'w')
+ h.write (str)
+ h.flush ()
+ progress ("\n")
+
+def main ():
+ p = option_parser ()
+ (options, files) = option_parser ().parse_args ()
+ if not files:
+ p.error ("no input files")
+
+ for f in files:
+ if options.dry_run:
+ dry_one_file (f, options)
+ else:
+ do_one_file (f, options)
+
+if __name__ == '__main__':
+ main ()
diff --git a/toolkit/src2xml/source/srclexer.py b/toolkit/src2xml/source/srclexer.py
new file mode 100644
index 000000000000..5a5a3319b0d1
--- /dev/null
+++ b/toolkit/src2xml/source/srclexer.py
@@ -0,0 +1,488 @@
+import sys, os.path
+from globals import *
+import macroparser
+
+class EOF(Exception):
+ def __init__ (self):
+ pass
+
+ def str (self):
+ return "end of file"
+
+class BOF(Exception):
+ def __init__ (self):
+ pass
+
+ def str (self):
+ return "beginning of file"
+
+
+def removeHeaderQuotes (orig):
+ if len(orig) <= 2:
+ return orig
+ elif orig[0] == orig[-1] == '"':
+ return orig[1:-1]
+ elif orig[0] == '<' and orig[-1] == '>':
+ return orig[1:-1]
+
+ return orig
+
+
+def dumpTokens (tokens, toError=False):
+
+ scope = 0
+ indent = " "
+ line = ''
+ chars = ''
+
+ for token in tokens:
+ if token in '{<':
+ if len(line) > 0:
+ chars += indent*scope + line + "\n"
+ line = ''
+ chars += indent*scope + token + "\n"
+ scope += 1
+
+ elif token in '}>':
+ if len(line) > 0:
+ chars += indent*scope + line + "\n"
+ line = ''
+ scope -= 1
+ chars += indent*scope + token
+
+ elif token == ';':
+ if len(line) > 0:
+ chars += indent*scope + line + ";\n"
+ line = ''
+ else:
+ chars += ";\n"
+ elif len(token) > 0:
+ line += token + ' '
+
+ if len(line) > 0:
+ chars += line
+ chars += "\n"
+ if toError:
+ sys.stderr.write(chars)
+ else:
+ sys.stdout.write(chars)
+
+
+class HeaderData(object):
+ def __init__ (self):
+ self.defines = {}
+ self.tokens = []
+
+
+class SrcLexer(object):
+ """Lexicographical analyzer for .src format.
+
+The role of a lexer is to parse the source file and break it into
+appropriate tokens. Such tokens are later passed to a parser to
+build the syntax tree.
+"""
+ headerCache = {}
+
+ VISIBLE = 0
+ INVISIBLE_PRE = 1
+ INVISIBLE_POST = 2
+
+ def __init__ (self, chars, filepath = None):
+ self.filepath = filepath
+ self.parentLexer = None
+ self.chars = chars
+ self.bufsize = len(self.chars)
+
+ # TODO: use parameters for this
+ # Properties that can be copied.
+ self.headerDict = dict ()
+ self.debug = False
+ self.debugMacro = False
+ self.includeDirs = list ()
+ self.expandHeaders = True
+ self.inMacroDefine = False
+ self.stopOnHeader = False
+
+ def copyProperties (self, other):
+ """Copy properties from another instance of SrcLexer."""
+
+ # TODO: use parameters for this
+ self.headerDict = other.headerDict
+ self.debug = other.debug
+ self.debugMacro = other.debugMacro
+ self.includeDirs = other.includeDirs[:]
+ self.expandHeaders = other.expandHeaders
+ self.inMacroDefine = other.inMacroDefine
+ self.stopOnHeader = other.stopOnHeader
+
+ def init (self):
+ self.firstNonBlank = ''
+ self.token = ''
+ self.tokens = []
+ self.defines = {}
+ self.visibilityStack = []
+
+ def getTokens (self):
+ return self.tokens
+
+ def getDefines (self):
+ return self.defines
+
+ def nextPos (self, i):
+ while True:
+ i += 1
+ try:
+ c = self.chars[i]
+ except IndexError:
+ raise EOF
+
+ if ord(c) in [0x0D]:
+ continue
+ break
+ return i
+
+ def prevPos (self, i):
+ while True:
+ i -= 1
+ try:
+ c = self.chars[i]
+ except IndexError:
+ raise BOF
+
+ if ord(c) in [0x0D]:
+ continue
+ break
+ return i
+
+ def isCodeVisible (self):
+ if len(self.visibilityStack) == 0:
+ return True
+ for item in self.visibilityStack:
+ if item != SrcLexer.VISIBLE:
+ return False
+ return True
+
+ def tokenize (self):
+ self.init()
+
+ i = 0
+ while True:
+ c = self.chars[i]
+
+ if self.firstNonBlank == '' and not c in [' ', "\n", "\t"]:
+ # Store the first non-blank in a line.
+ self.firstNonBlank = c
+ elif c == "\n":
+ self.firstNonBlank = ''
+
+ if c == '#':
+ i = self.pound(i)
+ elif c == '/':
+ i = self.slash(i)
+ elif c == "\n":
+ i = self.lineBreak(i)
+ elif c == '"':
+ i = self.doubleQuote(i)
+ elif c in [' ', "\t"]:
+ i = self.blank(i)
+ elif c in ";()[]{}<>,=+-*":
+ # Any outstanding single-character token.
+ i = self.anyToken(i, c)
+ elif self.isCodeVisible():
+ self.token += c
+
+ try:
+ i = self.nextPos(i)
+ except EOF:
+ break
+
+ if len(self.token):
+ self.tokens.append(self.token)
+
+ if not self.parentLexer and self.debug:
+ progress ("-"*68 + "\n")
+ progress ("All defines found in this translation unit:\n")
+ keys = self.defines.keys()
+ keys.sort()
+ for key in keys:
+ progress ("@ %s\n"%key)
+
+ def dumpTokens (self, toError=False):
+ dumpTokens(self.tokens, toError)
+
+
+ def maybeAddToken (self):
+ if len(self.token) > 0:
+ self.tokens.append(self.token)
+ self.token = ''
+
+
+ #--------------------------------------------------------------------
+ # character handlers
+
+ def blank (self, i):
+ if not self.isCodeVisible():
+ return i
+
+ self.maybeAddToken()
+ return i
+
+
+ def pound (self, i):
+
+ if self.inMacroDefine:
+ return i
+
+ if not self.firstNonBlank == '#':
+ return i
+
+ self.maybeAddToken()
+ # We are in preprocessing mode.
+
+ # Get the macro command name '#<command> .....'
+
+ command, define, buf = '', '', ''
+ firstNonBlank = False
+ while True:
+ try:
+ i = self.nextPos(i)
+ c = self.chars[i]
+ if c == '\\' and self.chars[self.nextPos(i)] == "\n":
+ i = self.nextPos(i)
+ continue
+ except EOF:
+ break
+
+ if c == "\n":
+ if len(buf) > 0 and len(command) == 0:
+ command = buf
+ i = self.prevPos(i)
+ break
+ elif c in [' ', "\t"]:
+ if not firstNonBlank:
+ # Ignore any leading blanks after the '#'.
+ continue
+
+ if len(command) == 0:
+ command = buf
+ buf = ''
+ else:
+ buf += ' '
+ elif c == '(':
+ if len(buf) > 0 and len(command) == 0:
+ command = buf
+ buf += c
+ else:
+ if not firstNonBlank:
+ firstNonBlank = True
+ buf += c
+
+ if command == 'define':
+ self.handleMacroDefine(buf)
+ elif command == 'include':
+ self.handleMacroInclude(buf)
+ elif command == 'ifdef':
+ defineName = buf.strip()
+ if self.defines.has_key(defineName):
+ self.visibilityStack.append(SrcLexer.VISIBLE)
+ else:
+ self.visibilityStack.append(SrcLexer.INVISIBLE_PRE)
+
+ elif command == 'ifndef':
+ defineName = buf.strip()
+ if self.defines.has_key(defineName):
+ self.visibilityStack.append(SrcLexer.INVISIBLE_PRE)
+ else:
+ self.visibilityStack.append(SrcLexer.VISIBLE)
+
+ elif command == 'if':
+ if self.evalCodeVisibility(buf):
+ self.visibilityStack.append(SrcLexer.VISIBLE)
+ else:
+ self.visibilityStack.append(SrcLexer.INVISIBLE_PRE)
+
+ elif command == 'elif':
+ if len(self.visibilityStack) == 0:
+ raise ParseError ('')
+
+ if self.visibilityStack[-1] == SrcLexer.VISIBLE:
+ self.visibilityStack[-1] = SrcLexer.INVISIBLE_POST
+ elif self.visibilityStack[-1] == SrcLexer.INVISIBLE_PRE:
+ # Evaluate only if the current visibility is false.
+ if self.evalCodeVisibility(buf):
+ self.visibilityStack[-1] = SrcLexer.VISIBLE
+
+ elif command == 'else':
+ if len(self.visibilityStack) == 0:
+ raise ParseError ('')
+
+ if self.visibilityStack[-1] == SrcLexer.VISIBLE:
+ self.visibilityStack[-1] = SrcLexer.INVISIBLE_POST
+ if self.visibilityStack[-1] == SrcLexer.INVISIBLE_PRE:
+ self.visibilityStack[-1] = SrcLexer.VISIBLE
+
+ elif command == 'endif':
+ if len(self.visibilityStack) == 0:
+ raise ParseError ('')
+ self.visibilityStack.pop()
+
+ elif command == 'undef':
+ pass
+ elif command in ['error', 'pragma']:
+ pass
+ else:
+ print "'%s' '%s'"%(command, buf)
+ print self.filepath
+ sys.exit(0)
+
+ return i
+
+
+ def evalCodeVisibility (self, buf):
+ try:
+ return eval(buf)
+ except:
+ return True
+
+ def handleMacroDefine (self, buf):
+
+ mparser = macroparser.MacroParser(buf)
+ mparser.debug = self.debugMacro
+ mparser.parse()
+ macro = mparser.getMacro()
+ if macro:
+ self.defines[macro.name] = macro
+
+ def handleMacroInclude (self, buf):
+
+ # Strip excess string if any.
+ pos = buf.find(' ')
+ if pos >= 0:
+ buf = buf[:pos]
+ headerSub = removeHeaderQuotes(buf)
+
+ if not self.expandHeaders:
+ # We don't want to expand headers. Bail out.
+ if self.debug:
+ progress ("%s ignored\n"%headerSub)
+ return
+
+ defines = {}
+ headerPath = None
+ for includeDir in self.includeDirs:
+ hpath = includeDir + '/' + headerSub
+ if os.path.isfile(hpath) and hpath != self.filepath:
+ headerPath = hpath
+ break
+
+ if not headerPath:
+ error("included header file " + headerSub + " not found\n", self.stopOnHeader)
+ return
+
+ if self.debug:
+ progress ("%s found\n"%headerPath)
+
+ if headerPath in self.headerDict:
+ if self.debug:
+ progress ("%s already included\n"%headerPath)
+ return
+
+ if SrcLexer.headerCache.has_key(headerPath):
+ if self.debug:
+ progress ("%s in cache\n"%headerPath)
+ for key in SrcLexer.headerCache[headerPath].defines.keys():
+ self.defines[key] = SrcLexer.headerCache[headerPath].defines[key]
+ return
+
+ chars = open(headerPath, 'r').read()
+ mclexer = SrcLexer(chars, headerPath)
+ mclexer.copyProperties(self)
+ mclexer.parentLexer = self
+ mclexer.tokenize()
+ hdrData = HeaderData()
+ hdrData.tokens = mclexer.getTokens()
+ headerDefines = mclexer.getDefines()
+ for key in headerDefines.keys():
+ defines[key] = headerDefines[key]
+ hdrData.defines[key] = headerDefines[key]
+
+ self.headerDict[headerPath] = True
+ SrcLexer.headerCache[headerPath] = hdrData
+
+ # Update the list of headers that have already been expaneded.
+ for key in mclexer.headerDict.keys():
+ self.headerDict[key] = True
+
+ if self.debug:
+ progress ("defines found in header %s:\n"%headerSub)
+ for key in defines.keys():
+ progress (" '%s'\n"%key)
+
+ for key in defines.keys():
+ self.defines[key] = defines[key]
+
+
+ def slash (self, i):
+ if not self.isCodeVisible():
+ return i
+
+ if i < self.bufsize - 1 and self.chars[i+1] == '/':
+ # Parse line comment.
+ line = ''
+ i += 2
+ while i < self.bufsize:
+ c = self.chars[i]
+ if ord(c) in [0x0A, 0x0D]:
+ return i - 1
+ line += c
+ i += 1
+ self.token = ''
+ elif i < self.bufsize - 1 and self.chars[i+1] == '*':
+ comment = ''
+ i += 2
+ while i < self.bufsize:
+ c = self.chars[i]
+ if c == '/' and self.chars[i-1] == '*':
+ return i
+ comment += c
+ i += 1
+ else:
+ return self.anyToken(i, '/')
+
+ return i
+
+
+ def lineBreak (self, i):
+ if not self.isCodeVisible():
+ return i
+
+ self.maybeAddToken()
+
+ return i
+
+
+ def doubleQuote (self, i):
+ if not self.isCodeVisible():
+ return i
+
+ literal = ''
+ i += 1
+ while i < self.bufsize:
+ c = self.chars[i]
+ if c == '"':
+ self.tokens.append('"'+literal+'"')
+ break
+ literal += c
+ i += 1
+
+ return i
+
+
+ def anyToken (self, i, token):
+ if not self.isCodeVisible():
+ return i
+
+ self.maybeAddToken()
+ self.token = token
+ self.maybeAddToken()
+ return i
diff --git a/toolkit/src2xml/source/srcparser.py b/toolkit/src2xml/source/srcparser.py
new file mode 100644
index 000000000000..b25d39ecb66e
--- /dev/null
+++ b/toolkit/src2xml/source/srcparser.py
@@ -0,0 +1,416 @@
+import sys
+from globals import *
+import srclexer
+
+# simple name translation map
+postTransMap = {"ok-button": "okbutton",
+ "cancel-button": "cancelbutton",
+ "help-button": "helpbutton"}
+
+def transName (name):
+ """Translate a mixed-casing name to dash-separated name.
+
+Translate a mixed-casing name (e.g. MyLongName) to a dash-separated name
+(e.g. my-long-name).
+"""
+ def isUpper (c):
+ return c >= 'A' and c <= 'Z'
+
+ newname = ''
+ parts = []
+ buf = ''
+ for c in name:
+ if isUpper(c) and len(buf) > 1:
+ parts.append(buf)
+ buf = c
+ else:
+ buf += c
+
+ if len(buf) > 0:
+ parts.append(buf)
+
+ first = True
+ for part in parts:
+ if first:
+ first = False
+ else:
+ newname += '-'
+ newname += part.lower()
+
+ # special-case mapping ...
+ if 0: #postTransMap.has_key(newname):
+ newname = postTransMap[newname]
+
+ return newname
+
+
+def transValue (value):
+ """Translate certain values.
+
+Examples of translated values include TRUE -> true, FALSE -> false.
+"""
+ if value.lower() in ["true", "false"]:
+ value = value.lower()
+ return value
+
+
+def renameAttribute (name, elemName):
+
+ # TODO: all manner of evil special cases ...
+ if elemName == 'metric-field' and name == 'spin-size':
+ return 'step-size'
+
+ return name
+
+
+class Statement(object):
+ """Container to hold information for a single statement.
+
+Each statement consists of the left-hand-side token(s), and right-hand-side
+tokens, separated by a '=' token. This class stores the information on the
+left-hand-side tokens.
+"""
+ def __init__ (self):
+ self.leftTokens = []
+ self.leftScope = None
+
+
+class MacroExpander(object):
+ def __init__ (self, tokens, defines):
+ self.tokens = tokens
+ self.defines = defines
+
+ def expand (self):
+ self.pos = 0
+ while self.pos < len(self.tokens):
+ self.expandToken()
+
+ def expandToken (self):
+ token = self.tokens[self.pos]
+ if not self.defines.has_key(token):
+ self.pos += 1
+ return
+
+ macro = self.defines[token]
+ nvars = len(macro.vars.keys())
+ if nvars == 0:
+ # Simple expansion
+ self.tokens[self.pos:self.pos+1] = macro.tokens
+ return
+ else:
+ # Expansion with arguments.
+ values, lastPos = self.parseValues()
+ newtokens = []
+ for mtoken in macro.tokens:
+ if macro.vars.has_key(mtoken):
+ # variable
+ pos = macro.vars[mtoken]
+ valtokens = values[pos]
+ for valtoken in valtokens:
+ newtokens.append(valtoken)
+ else:
+ # not a variable
+ newtokens.append(mtoken)
+
+ self.tokens[self.pos:self.pos+lastPos+1] = newtokens
+
+
+ def parseValues (self):
+ """Parse tokens to get macro function variable values.
+
+Be aware that there is an implicit quotes around the text between the open
+paren, the comma(s), and the close paren. For instance, if a macro is defined
+as FOO(a, b) and is used as FOO(one two three, and four), then the 'a' must be
+replaced with 'one two three', and the 'b' replaced with 'and four'. In other
+words, whitespace does not end a token.
+
+"""
+ values = []
+ i = 1
+ scope = 0
+ value = []
+ while True:
+ try:
+ tk = self.tokens[self.pos+i]
+ except IndexError:
+ progress ("error parsing values (%d)\n"%i)
+ for j in xrange(0, i):
+ print self.tokens[self.pos+j],
+ print ''
+ srclexer.dumpTokens(self.tokens)
+ srclexer.dumpTokens(self.newtokens)
+ print "tokens expanded so far:"
+ for tk in self.expandedTokens:
+ print "-"*20
+ print tk
+ srclexer.dumpTokens(self.defines[tk].tokens)
+ sys.exit(1)
+ if tk == '(':
+ value = []
+ scope += 1
+ elif tk == ',':
+ values.append(value)
+ value = []
+ elif tk == ')':
+ scope -= 1
+ values.append(value)
+ value = []
+ if scope == 0:
+ break
+ else:
+ raise ParseError ('')
+ else:
+ value.append(tk)
+ i += 1
+
+ return values, i
+
+ def getTokens (self):
+ return self.tokens
+
+
+class SrcParser(object):
+
+ def __init__ (self, tokens, defines = None):
+ self.tokens = tokens
+ self.defines = defines
+ self.debug = False
+ self.onlyExpandMacros = False
+
+ def init (self):
+ self.elementStack = [RootNode()]
+ self.stmtData = Statement()
+ self.tokenBuf = []
+ self.leftTokens = []
+
+ # Expand defined macros.
+ if self.debug:
+ progress ("-"*68+"\n")
+ for key in self.defines.keys():
+ progress ("define: %s\n"%key)
+
+ self.expandMacro()
+ self.tokenSize = len(self.tokens)
+
+ def expandMacro (self):
+ macroExp = MacroExpander(self.tokens, self.defines)
+ macroExp.expand()
+ self.tokens = macroExp.getTokens()
+ if self.onlyExpandMacros:
+ srclexer.dumpTokens(self.tokens)
+ sys.exit(0)
+
+ def parse (self):
+ """Parse it!
+
+This is the main loop for the parser. This is where it all begins and ends.
+"""
+ self.init()
+
+ i = 0
+ while i < self.tokenSize:
+ tk = self.tokens[i]
+ if tk == '{':
+ i = self.openBrace(i)
+ elif tk == '}':
+ i = self.closeBrace(i)
+ elif tk == ';':
+ i = self.semiColon(i)
+ elif tk == '=':
+ i = self.assignment(i)
+ else:
+ self.tokenBuf.append(tk)
+
+ i += 1
+
+ return self.elementStack[0]
+
+ #-------------------------------------------------------------------------
+ # Token Handlers
+
+ """
+Each token handler takes the current token position and returns the position
+of the last token processed. For the most part, the current token position
+and the last processed token are one and the same, in which case the handler
+can simply return the position value it receives without incrementing it.
+
+If you need to read ahead to process more tokens than just the current token,
+make sure that the new token position points to the last token that has been
+processed, not the next token that has not yet been processed. This is
+because the main loop increments the token position when it returns from the
+handler.
+"""
+
+ # assignment token '='
+ def assignment (self, i):
+ self.leftTokens = self.tokenBuf[:]
+ if self.stmtData.leftScope == None:
+ # Keep track of lhs data in case of compound statement.
+ self.stmtData.leftTokens = self.tokenBuf[:]
+ self.stmtData.leftScope = len(self.elementStack) - 1
+
+ self.tokenBuf = []
+ return i
+
+ # open brace token '{'
+ def openBrace (self, i):
+ bufSize = len(self.tokenBuf)
+ leftSize = len(self.leftTokens)
+ obj = None
+ if bufSize == 0 and leftSize > 0:
+ # Name = { ...
+ obj = Element(self.leftTokens[0])
+
+ elif bufSize > 0 and leftSize == 0:
+ # Type Name { ...
+ wgtType = self.tokenBuf[0]
+ wgtRID = None
+ if bufSize >= 2:
+ wgtRID = self.tokenBuf[1]
+ obj = Element(wgtType, wgtRID)
+
+ else:
+ # LeftName = Name { ...
+ obj = Element(self.leftTokens[0])
+ obj.setAttr("type", self.tokenBuf[0])
+
+ obj.name = transName(obj.name)
+
+ if obj.name == 'string-list':
+ i = self.parseStringList(i)
+ elif obj.name == 'filter-list':
+ i = self.parseFilterList(i, obj)
+ else:
+ self.elementStack[-1].appendChild(obj)
+ self.elementStack.append(obj)
+
+ self.tokenBuf = []
+ self.leftTokens = []
+
+ return i
+
+ # close brace token '}'
+ def closeBrace (self, i):
+ if len(self.tokenBuf) > 0:
+ if self.debug:
+ print self.tokenBuf
+ raise ParseError ('')
+ self.elementStack.pop()
+ return i
+
+ # semi colon token ';'
+ def semiColon (self, i):
+ stackSize = len(self.elementStack)
+ scope = stackSize - 1
+ if len(self.tokenBuf) == 0:
+ pass
+ elif scope == 0:
+ # We are not supposed to have any statment in global scope.
+ # Just ignore this statement.
+ pass
+ else:
+ # Statement within a scope. Import it as an attribute for the
+ # current element.
+ elem = self.elementStack[-1]
+
+ name = "none"
+ if len(self.leftTokens) > 0:
+ # Use the leftmost token as the name for now. If we need to
+ # do more complex parsing of lhs, add more code here.
+ name = self.leftTokens[0]
+ name = transName(name)
+
+ if name == 'pos':
+ i = self.parsePosAttr(i)
+ elif name == 'size':
+ i = self.parseSizeAttr(i)
+ elif len (self.tokenBuf) == 1:
+ # Simple value
+ value = transValue(self.tokenBuf[0])
+ name = renameAttribute(name, elem.name)
+ elem.setAttr(name, value)
+
+ if not self.stmtData.leftScope == None and self.stmtData.leftScope < scope:
+ # This is a nested scope within a statement. Do nothing for now.
+ pass
+
+ if self.stmtData.leftScope == scope:
+ # end of (nested) statement.
+ self.stmtData.leftScope = None
+
+ self.tokenBuf = []
+ self.leftTokens = []
+
+ return i
+
+ def parseStringList (self, i):
+
+ i += 1
+ while i < self.tokenSize:
+ tk = self.tokens[i]
+ if tk == '}':
+ break
+ i += 1
+
+ return i
+
+ def parseFilterList (self, i, obj):
+ self.elementStack[-1].appendChild(obj)
+ self.elementStack.append(obj)
+
+ return i
+
+ def parsePosAttr (self, i):
+
+ # MAP_APPFONT ( 6 , 5 )
+ elem = self.elementStack[-1]
+ x, y = self.parseMapAppfont(self.tokenBuf)
+ elem.setAttr("x", x)
+ elem.setAttr("y", y)
+
+ return i
+
+ def parseSizeAttr (self, i):
+
+ # MAP_APPFONT ( 6 , 5 )
+ elem = self.elementStack[-1]
+ width, height = self.parseMapAppfont(self.tokenBuf)
+ elem.setAttr("width", width)
+ elem.setAttr("height", height)
+
+ return i
+
+ def parseMapAppfont (self, tokens):
+ values = []
+ scope = 0
+ val = ''
+ for tk in tokens:
+ if tk == '(':
+ scope += 1
+ if scope == 1:
+ val = ''
+ else:
+ val += tk
+ elif tk == ')':
+ scope -= 1
+ if scope == 0:
+ if len(val) == 0:
+ raise ParseError ('')
+ values.append(val)
+ break
+ else:
+ val += tk
+ elif tk == ',':
+ if len(val) == 0:
+ raise ParseError ('')
+ values.append(val)
+ val = ''
+ elif scope > 0:
+ val += tk
+
+ if len(values) != 2:
+ raise ParseError ('')
+
+ return eval(values[0]), eval(values[1])
+
+
diff --git a/toolkit/src2xml/src-sc.lst b/toolkit/src2xml/src-sc.lst
new file mode 100644
index 000000000000..bb2417d47da8
--- /dev/null
+++ b/toolkit/src2xml/src-sc.lst
@@ -0,0 +1,57 @@
+../../sc/util/hidother.src
+../../sc/addin/datefunc/dfa.src
+../../sc/addin/rot13/rot13.src
+../../sc/source/ui/src/crnrdlg.src
+../../sc/source/ui/src/hdrcont.src
+../../sc/source/ui/src/solvrdlg.src
+../../sc/source/ui/src/miscdlgs.src
+../../sc/source/ui/src/tabopdlg.src
+../../sc/source/ui/src/popup.src
+../../sc/source/ui/src/autofmt.src
+../../sc/source/ui/src/toolbox.src
+../../sc/source/ui/src/opredlin.src
+../../sc/source/ui/src/namedlg.src
+../../sc/source/ui/src/sortdlg.src
+../../sc/source/ui/src/textdlgs.src
+../../sc/source/ui/src/optdlg.src
+../../sc/source/ui/src/scwarngs.src
+../../sc/source/ui/src/scfuncs.src
+../../sc/source/ui/src/filter.src
+../../sc/source/ui/src/simpref.src
+../../sc/source/ui/src/attrdlg.src
+../../sc/source/ui/src/sc.src
+../../sc/source/ui/src/globstr.src
+../../sc/source/ui/src/scstring.src
+../../sc/source/ui/src/dbnamdlg.src
+../../sc/source/ui/src/subtdlg.src
+../../sc/source/ui/src/pseudo.src
+../../sc/source/ui/src/condfrmt.src
+../../sc/source/ui/src/chartdlg.src
+../../sc/source/ui/src/scerrors.src
+../../sc/source/ui/dbgui/outline.src
+../../sc/source/ui/dbgui/pvfundlg.src
+../../sc/source/ui/dbgui/scendlg.src
+../../sc/source/ui/dbgui/pivot.src
+../../sc/source/ui/dbgui/dpgroupdlg.src
+../../sc/source/ui/dbgui/dapitype.src
+../../sc/source/ui/dbgui/imoptdlg.src
+../../sc/source/ui/dbgui/consdlg.src
+../../sc/source/ui/dbgui/validate.src
+../../sc/source/ui/dbgui/asciiopt.src
+../../sc/source/ui/drawfunc/objdraw.src
+../../sc/source/ui/drawfunc/drformsh.src
+../../sc/source/ui/styleui/scstyles.src
+../../sc/source/ui/styleui/styledlg.src
+../../sc/source/ui/formdlg/parawin.src
+../../sc/source/ui/formdlg/dwfunctr.src
+../../sc/source/ui/formdlg/formdlgs.src
+../../sc/source/ui/navipi/navipi.src
+../../sc/source/ui/miscdlgs/acredlin.src
+../../sc/source/ui/miscdlgs/highred.src
+../../sc/source/ui/miscdlgs/linkarea.src
+../../sc/source/ui/miscdlgs/instbdlg.src
+../../sc/source/ui/pagedlg/pagedlg.src
+../../sc/source/ui/pagedlg/tphf.src
+../../sc/source/ui/pagedlg/hfedtdlg.src
+../../sc/source/ui/docshell/tpstat.src
+../../sc/source/core/src/compiler.src
diff --git a/toolkit/src2xml/src-sd.lst b/toolkit/src2xml/src-sd.lst
new file mode 100644
index 000000000000..6dc236e38ff2
--- /dev/null
+++ b/toolkit/src2xml/src-sd.lst
@@ -0,0 +1,124 @@
+../../sd/util/hidother.src
+../../sd/source/ui/app/tbxids_tmpl.src
+../../sd/source/ui/app/popup2_tmpl.src
+../../sd/source/ui/app/popup.src
+../../sd/source/ui/app/toolbox.src
+../../sd/source/ui/app/menuids2_tmpl.src
+../../sd/source/ui/app/sdstring.src
+../../sd/source/ui/app/menu_tmpl.src
+../../sd/source/ui/app/strings.src
+../../sd/source/ui/app/menuids_tmpl.src
+../../sd/source/ui/app/accel_tmpl.src
+../../sd/source/ui/app/tbx_ww.src
+../../sd/source/ui/app/accelids_tmpl.src
+../../sd/source/ui/app/menuportal_tmpl.src
+../../sd/source/ui/app/menuids3_tmpl.src
+../../sd/source/ui/app/app.src
+../../sd/source/ui/app/res_bmp.src
+../../sd/source/ui/app/pseudo.src
+../../sd/source/ui/app/menuids4_tmpl.src
+../../sd/source/ui/app/toolbox2_tmpl.src
+../../sd/source/ui/dlg/headerfooterdlg.src
+../../sd/source/ui/dlg/dlgfield.src
+../../sd/source/ui/dlg/sdobjpal.src
+../../sd/source/ui/dlg/morphdlg.src
+../../sd/source/ui/dlg/PaneDockingWindow.src
+../../sd/source/ui/dlg/dlgsnap.src
+../../sd/source/ui/dlg/tpoption.src
+../../sd/source/ui/dlg/present.src
+../../sd/source/ui/dlg/sdpreslt.src
+../../sd/source/ui/dlg/dlgass.src
+../../sd/source/ui/dlg/tpaction.src
+../../sd/source/ui/dlg/prntopts.src
+../../sd/source/ui/dlg/prltempl.src
+../../sd/source/ui/dlg/custsdlg.src
+../../sd/source/ui/dlg/inspagob.src
+../../sd/source/ui/dlg/paragr.src
+../../sd/source/ui/dlg/dlgpage.src
+../../sd/source/ui/dlg/vectdlg.src
+../../sd/source/ui/dlg/dlgolbul.src
+../../sd/source/ui/dlg/copydlg.src
+../../sd/source/ui/dlg/dlg_char.src
+../../sd/source/ui/dlg/printdlg.src
+../../sd/source/ui/dlg/ins_page.src
+../../sd/source/ui/dlg/animobjs.src
+../../sd/source/ui/dlg/ins_paste.src
+../../sd/source/ui/dlg/tabtempl.src
+../../sd/source/ui/dlg/LayerDialog.src
+../../sd/source/ui/dlg/masterlayoutdlg.src
+../../sd/source/ui/dlg/navigatr.src
+../../sd/source/ui/dlg/brkdlg.src
+../../sd/source/ui/slidesorter/shell/SlideSorterChildWindow.src
+../../sd/source/ui/notes/NotesChildWindow.src
+../../sd/source/ui/toolpanel/ToolPanelChildWindow.src
+../../sd/source/ui/animations/CustomAnimationCreateDialog.src
+../../sd/source/ui/animations/CustomAnimationDialog.src
+../../sd/source/ui/animations/CustomAnimation.src
+../../sd/source/ui/animations/CustomAnimationSchemesPane.src
+../../sd/source/ui/animations/SlideTransitionPane.src
+../../sd/source/ui/animations/AnimationSchemesPane.src
+../../sd/source/ui/animations/CustomAnimationPane.src
+../../sd/source/ui/accessibility/accessibility.src
+../../sd/source/ui/slideshow/slideshow.src
+../../sd/source/core/glob.src
+../../sd/source/filter/html/pubdlg.src
+../../sd/unxlngi6.pro/inc/menu.src
+../../sd/unxlngi6.pro/inc/menuids2.src
+../../sd/unxlngi6.pro/inc/menuids3.src
+../../sd/unxlngi6.pro/inc/menuids4.src
+../../sd/unxlngi6.pro/inc/popup2.src
+../../sd/unxlngi6.pro/inc/toolbox2.src
+../../sd/unxlngi6.pro/inc/accel.src
+../../sd/unxlngi6.pro/inc/menuids.src
+../../sd/unxlngi6.pro/inc/menuportal.src
+../../sd/unxlngi6.pro/inc/accelids.src
+../../sd/unxlngi6.pro/inc/tbxids.src
+../../sd/unxlngi6.pro/misc/app/popup.src
+../../sd/unxlngi6.pro/misc/app/toolbox.src
+../../sd/unxlngi6.pro/misc/app/sdstring.src
+../../sd/unxlngi6.pro/misc/app/strings.src
+../../sd/unxlngi6.pro/misc/app/tbx_ww.src
+../../sd/unxlngi6.pro/misc/app/app.src
+../../sd/unxlngi6.pro/misc/app/res_bmp.src
+../../sd/unxlngi6.pro/misc/app/pseudo.src
+../../sd/unxlngi6.pro/misc/dlg/headerfooterdlg.src
+../../sd/unxlngi6.pro/misc/dlg/dlgfield.src
+../../sd/unxlngi6.pro/misc/dlg/morphdlg.src
+../../sd/unxlngi6.pro/misc/dlg/PaneDockingWindow.src
+../../sd/unxlngi6.pro/misc/dlg/dlgsnap.src
+../../sd/unxlngi6.pro/misc/dlg/tpoption.src
+../../sd/unxlngi6.pro/misc/dlg/present.src
+../../sd/unxlngi6.pro/misc/dlg/sdpreslt.src
+../../sd/unxlngi6.pro/misc/dlg/dlgass.src
+../../sd/unxlngi6.pro/misc/dlg/tpaction.src
+../../sd/unxlngi6.pro/misc/dlg/prntopts.src
+../../sd/unxlngi6.pro/misc/dlg/prltempl.src
+../../sd/unxlngi6.pro/misc/dlg/custsdlg.src
+../../sd/unxlngi6.pro/misc/dlg/inspagob.src
+../../sd/unxlngi6.pro/misc/dlg/paragr.src
+../../sd/unxlngi6.pro/misc/dlg/dlgpage.src
+../../sd/unxlngi6.pro/misc/dlg/vectdlg.src
+../../sd/unxlngi6.pro/misc/dlg/dlgolbul.src
+../../sd/unxlngi6.pro/misc/dlg/copydlg.src
+../../sd/unxlngi6.pro/misc/dlg/dlg_char.src
+../../sd/unxlngi6.pro/misc/dlg/printdlg.src
+../../sd/unxlngi6.pro/misc/dlg/ins_page.src
+../../sd/unxlngi6.pro/misc/dlg/animobjs.src
+../../sd/unxlngi6.pro/misc/dlg/ins_paste.src
+../../sd/unxlngi6.pro/misc/dlg/tabtempl.src
+../../sd/unxlngi6.pro/misc/dlg/LayerDialog.src
+../../sd/unxlngi6.pro/misc/dlg/masterlayoutdlg.src
+../../sd/unxlngi6.pro/misc/dlg/navigatr.src
+../../sd/unxlngi6.pro/misc/dlg/brkdlg.src
+../../sd/unxlngi6.pro/misc/core/glob.src
+../../sd/unxlngi6.pro/misc/html/pubdlg.src
+../../sd/unxlngi6.pro/misc/notes/NotesChildWindow.src
+../../sd/unxlngi6.pro/misc/accessibility/accessibility.src
+../../sd/unxlngi6.pro/misc/animui/CustomAnimationCreateDialog.src
+../../sd/unxlngi6.pro/misc/animui/CustomAnimationDialog.src
+../../sd/unxlngi6.pro/misc/animui/CustomAnimation.src
+../../sd/unxlngi6.pro/misc/animui/CustomAnimationSchemesPane.src
+../../sd/unxlngi6.pro/misc/animui/SlideTransitionPane.src
+../../sd/unxlngi6.pro/misc/animui/AnimationSchemesPane.src
+../../sd/unxlngi6.pro/misc/animui/CustomAnimationPane.src
+../../sd/unxlngi6.pro/misc/slideshow/slideshow.src
diff --git a/toolkit/src2xml/src-sw.lst b/toolkit/src2xml/src-sw.lst
new file mode 100644
index 000000000000..8d43400462d8
--- /dev/null
+++ b/toolkit/src2xml/src-sw.lst
@@ -0,0 +1,121 @@
+../../sw/sdi/swslots.src
+../../sw/util/hidother.src
+../../sw/source/ui/app/mn.src
+../../sw/source/ui/app/app.src
+../../sw/source/ui/app/error.src
+../../sw/source/ui/web/web.src
+../../sw/source/ui/dbui/addresslistdialog.src
+../../sw/source/ui/dbui/customizeaddresslistdialog.src
+../../sw/source/ui/dbui/mailmergewizard.src
+../../sw/source/ui/dbui/mmlayoutpage.src
+../../sw/source/ui/dbui/dbui.src
+../../sw/source/ui/dbui/createaddresslistdialog.src
+../../sw/source/ui/dbui/mmoutputpage.src
+../../sw/source/ui/dbui/dbtablepreviewdialog.src
+../../sw/source/ui/dbui/mmmergepage.src
+../../sw/source/ui/dbui/dbinsdlg.src
+../../sw/source/ui/dbui/selectdbtabledialog.src
+../../sw/source/ui/dbui/mmoutputtypepage.src
+../../sw/source/ui/dbui/mailmergechildwindow.src
+../../sw/source/ui/dbui/mmpreparemergepage.src
+../../sw/source/ui/dbui/mmdocselectpage.src
+../../sw/source/ui/dbui/mmgreetingspage.src
+../../sw/source/ui/dbui/mmaddressblockpage.src
+../../sw/source/ui/misc/linenum.src
+../../sw/source/ui/misc/outline.src
+../../sw/source/ui/misc/glosbib.src
+../../sw/source/ui/misc/pgfnote.src
+../../sw/source/ui/misc/redlndlg.src
+../../sw/source/ui/misc/glossary.src
+../../sw/source/ui/misc/numberingtypelistbox.src
+../../sw/source/ui/misc/autocorr.src
+../../sw/source/ui/misc/insfnote.src
+../../sw/source/ui/misc/srtdlg.src
+../../sw/source/ui/misc/num.src
+../../sw/source/ui/misc/pggrid.src
+../../sw/source/ui/misc/bookmark.src
+../../sw/source/ui/misc/docfnote.src
+../../sw/source/ui/misc/insrule.src
+../../sw/source/ui/docvw/docvw.src
+../../sw/source/ui/docvw/access.src
+../../sw/source/ui/fldui/javaedit.src
+../../sw/source/ui/fldui/fldref.src
+../../sw/source/ui/fldui/fldtdlg.src
+../../sw/source/ui/fldui/fldfunc.src
+../../sw/source/ui/fldui/flddok.src
+../../sw/source/ui/fldui/flddinf.src
+../../sw/source/ui/fldui/inpdlg.src
+../../sw/source/ui/fldui/flddb.src
+../../sw/source/ui/fldui/changedb.src
+../../sw/source/ui/fldui/fldvar.src
+../../sw/source/ui/fldui/DropDownFieldDialog.src
+../../sw/source/ui/fldui/fldui.src
+../../sw/source/ui/fmtui/tmpdlg.src
+../../sw/source/ui/fmtui/fmtui.src
+../../sw/source/ui/index/cnttab.src
+../../sw/source/ui/index/multmrk.src
+../../sw/source/ui/index/idxmrk.src
+../../sw/source/ui/lingu/olmenu.src
+../../sw/source/ui/table/colwd.src
+../../sw/source/ui/table/rowht.src
+../../sw/source/ui/table/tautofmt.src
+../../sw/source/ui/table/splittbl.src
+../../sw/source/ui/table/chartins.src
+../../sw/source/ui/table/tabledlg.src
+../../sw/source/ui/table/split.src
+../../sw/source/ui/table/convert.src
+../../sw/source/ui/table/insrc.src
+../../sw/source/ui/table/table.src
+../../sw/source/ui/table/mergetbl.src
+../../sw/source/ui/table/instable.src
+../../sw/source/ui/utlui/utlui.src
+../../sw/source/ui/utlui/initui.src
+../../sw/source/ui/utlui/navipi.src
+../../sw/source/ui/utlui/attrdesc.src
+../../sw/source/ui/utlui/gloslst.src
+../../sw/source/ui/utlui/poolfmt.src
+../../sw/source/ui/utlui/unotools.src
+../../sw/source/ui/wrtsh/wrtsh.src
+../../sw/source/ui/chrdlg/chardlg.src
+../../sw/source/ui/chrdlg/swbreak.src
+../../sw/source/ui/chrdlg/ccoll.src
+../../sw/source/ui/chrdlg/paradlg.src
+../../sw/source/ui/chrdlg/drpcps.src
+../../sw/source/ui/chrdlg/chrdlg.src
+../../sw/source/ui/chrdlg/numpara.src
+../../sw/source/ui/config/mailconfigpage.src
+../../sw/source/ui/config/optcomp.src
+../../sw/source/ui/config/optdlg.src
+../../sw/source/ui/config/optload.src
+../../sw/source/ui/config/redlopt.src
+../../sw/source/ui/dialog/abstract.src
+../../sw/source/ui/dialog/docstdlg.src
+../../sw/source/ui/dialog/ascfldlg.src
+../../sw/source/ui/dialog/dialog.src
+../../sw/source/ui/dialog/regionsw.src
+../../sw/source/ui/dialog/wordcountdialog.src
+../../sw/source/ui/dochdl/dochdl.src
+../../sw/source/ui/dochdl/selglos.src
+../../sw/source/ui/envelp/mailmrge.src
+../../sw/source/ui/envelp/envelp.src
+../../sw/source/ui/envelp/labprt.src
+../../sw/source/ui/envelp/envlop.src
+../../sw/source/ui/envelp/label.src
+../../sw/source/ui/envelp/envfmt.src
+../../sw/source/ui/envelp/labfmt.src
+../../sw/source/ui/envelp/envprt.src
+../../sw/source/ui/smartmenu/stmenu.src
+../../sw/source/ui/frmdlg/frmpage.src
+../../sw/source/ui/frmdlg/cption.src
+../../sw/source/ui/frmdlg/column.src
+../../sw/source/ui/frmdlg/wrap.src
+../../sw/source/ui/frmdlg/frmui.src
+../../sw/source/ui/globdoc/globdoc.src
+../../sw/source/ui/ribbar/tbxanchr.src
+../../sw/source/ui/ribbar/workctrl.src
+../../sw/source/ui/ribbar/inputwin.src
+../../sw/source/ui/ribbar/tblctrl.src
+../../sw/source/ui/shells/shells.src
+../../sw/source/ui/uiview/pview.src
+../../sw/source/ui/uiview/view.src
+../../sw/source/core/undo/undo.src
diff --git a/toolkit/src2xml/src.lst b/toolkit/src2xml/src.lst
new file mode 100644
index 000000000000..4a5876b84a08
--- /dev/null
+++ b/toolkit/src2xml/src.lst
@@ -0,0 +1,680 @@
+../../sc/util/hidother.src
+../../sc/addin/datefunc/dfa.src
+../../sc/addin/rot13/rot13.src
+../../sc/source/ui/src/crnrdlg.src
+../../sc/source/ui/src/hdrcont.src
+../../sc/source/ui/src/solvrdlg.src
+../../sc/source/ui/src/miscdlgs.src
+../../sc/source/ui/src/tabopdlg.src
+../../sc/source/ui/src/popup.src
+../../sc/source/ui/src/autofmt.src
+../../sc/source/ui/src/toolbox.src
+../../sc/source/ui/src/opredlin.src
+../../sc/source/ui/src/namedlg.src
+../../sc/source/ui/src/sortdlg.src
+../../sc/source/ui/src/textdlgs.src
+../../sc/source/ui/src/optdlg.src
+../../sc/source/ui/src/scwarngs.src
+../../sc/source/ui/src/scfuncs.src
+../../sc/source/ui/src/filter.src
+../../sc/source/ui/src/simpref.src
+../../sc/source/ui/src/attrdlg.src
+../../sc/source/ui/src/sc.src
+../../sc/source/ui/src/globstr.src
+../../sc/source/ui/src/scstring.src
+../../sc/source/ui/src/dbnamdlg.src
+../../sc/source/ui/src/subtdlg.src
+../../sc/source/ui/src/pseudo.src
+../../sc/source/ui/src/condfrmt.src
+../../sc/source/ui/src/scerrors.src
+../../sc/source/ui/dbgui/outline.src
+../../sc/source/ui/dbgui/pvfundlg.src
+../../sc/source/ui/dbgui/scendlg.src
+../../sc/source/ui/dbgui/pivot.src
+../../sc/source/ui/dbgui/dpgroupdlg.src
+../../sc/source/ui/dbgui/dapitype.src
+../../sc/source/ui/dbgui/imoptdlg.src
+../../sc/source/ui/dbgui/consdlg.src
+../../sc/source/ui/dbgui/validate.src
+../../sc/source/ui/dbgui/asciiopt.src
+../../sc/source/ui/drawfunc/objdraw.src
+../../sc/source/ui/drawfunc/drformsh.src
+../../sc/source/ui/styleui/scstyles.src
+../../sc/source/ui/styleui/styledlg.src
+../../sc/source/ui/formdlg/parawin.src
+../../sc/source/ui/formdlg/dwfunctr.src
+../../sc/source/ui/formdlg/formdlgs.src
+../../sc/source/ui/navipi/navipi.src
+../../sc/source/ui/miscdlgs/acredlin.src
+../../sc/source/ui/miscdlgs/highred.src
+../../sc/source/ui/miscdlgs/linkarea.src
+../../sc/source/ui/miscdlgs/instbdlg.src
+../../sc/source/ui/pagedlg/pagedlg.src
+../../sc/source/ui/pagedlg/tphf.src
+../../sc/source/ui/pagedlg/hfedtdlg.src
+../../sc/source/ui/docshell/tpstat.src
+../../sc/source/core/src/compiler.src
+../../sd/util/hidother.src
+../../sd/source/ui/app/tbxids_tmpl.src
+../../sd/source/ui/app/popup2_tmpl.src
+../../sd/source/ui/app/popup.src
+../../sd/source/ui/app/toolbox.src
+../../sd/source/ui/app/menuids2_tmpl.src
+../../sd/source/ui/app/sdstring.src
+../../sd/source/ui/app/menu_tmpl.src
+../../sd/source/ui/app/strings.src
+../../sd/source/ui/app/menuids_tmpl.src
+../../sd/source/ui/app/accel_tmpl.src
+../../sd/source/ui/app/tbx_ww.src
+../../sd/source/ui/app/accelids_tmpl.src
+../../sd/source/ui/app/menuportal_tmpl.src
+../../sd/source/ui/app/menuids3_tmpl.src
+../../sd/source/ui/app/app.src
+../../sd/source/ui/app/res_bmp.src
+../../sd/source/ui/app/pseudo.src
+../../sd/source/ui/app/menuids4_tmpl.src
+../../sd/source/ui/app/toolbox2_tmpl.src
+../../sd/source/ui/dlg/headerfooterdlg.src
+../../sd/source/ui/dlg/dlgfield.src
+../../sd/source/ui/dlg/sdobjpal.src
+../../sd/source/ui/dlg/morphdlg.src
+../../sd/source/ui/dlg/PaneDockingWindow.src
+../../sd/source/ui/dlg/dlgsnap.src
+../../sd/source/ui/dlg/tpoption.src
+../../sd/source/ui/dlg/present.src
+../../sd/source/ui/dlg/sdpreslt.src
+../../sd/source/ui/dlg/dlgass.src
+../../sd/source/ui/dlg/tpaction.src
+../../sd/source/ui/dlg/prntopts.src
+../../sd/source/ui/dlg/prltempl.src
+../../sd/source/ui/dlg/custsdlg.src
+../../sd/source/ui/dlg/inspagob.src
+../../sd/source/ui/dlg/paragr.src
+../../sd/source/ui/dlg/dlgpage.src
+../../sd/source/ui/dlg/vectdlg.src
+../../sd/source/ui/dlg/dlgolbul.src
+../../sd/source/ui/dlg/copydlg.src
+../../sd/source/ui/dlg/dlg_char.src
+../../sd/source/ui/dlg/printdlg.src
+../../sd/source/ui/dlg/animobjs.src
+../../sd/source/ui/dlg/ins_paste.src
+../../sd/source/ui/dlg/tabtempl.src
+../../sd/source/ui/dlg/LayerDialog.src
+../../sd/source/ui/dlg/masterlayoutdlg.src
+../../sd/source/ui/dlg/navigatr.src
+../../sd/source/ui/dlg/brkdlg.src
+../../sd/source/ui/slidesorter/shell/SlideSorterChildWindow.src
+../../sd/source/ui/notes/NotesChildWindow.src
+../../sd/source/ui/toolpanel/ToolPanelChildWindow.src
+../../sd/source/ui/animations/CustomAnimationCreateDialog.src
+../../sd/source/ui/animations/CustomAnimationDialog.src
+../../sd/source/ui/animations/CustomAnimation.src
+../../sd/source/ui/animations/CustomAnimationSchemesPane.src
+../../sd/source/ui/animations/SlideTransitionPane.src
+../../sd/source/ui/animations/AnimationSchemesPane.src
+../../sd/source/ui/animations/CustomAnimationPane.src
+../../sd/source/ui/accessibility/accessibility.src
+../../sd/source/ui/slideshow/slideshow.src
+../../sd/source/core/glob.src
+../../sd/source/filter/html/pubdlg.src
+../../sw/sdi/swslots.src
+../../sw/util/hidother.src
+../../sw/source/ui/app/mn.src
+../../sw/source/ui/app/app.src
+../../sw/source/ui/app/error.src
+../../sw/source/ui/web/web.src
+../../sw/source/ui/dbui/addresslistdialog.src
+../../sw/source/ui/dbui/customizeaddresslistdialog.src
+../../sw/source/ui/dbui/mailmergewizard.src
+../../sw/source/ui/dbui/mmlayoutpage.src
+../../sw/source/ui/dbui/dbui.src
+../../sw/source/ui/dbui/createaddresslistdialog.src
+../../sw/source/ui/dbui/mmoutputpage.src
+../../sw/source/ui/dbui/dbtablepreviewdialog.src
+../../sw/source/ui/dbui/mmmergepage.src
+../../sw/source/ui/dbui/dbinsdlg.src
+../../sw/source/ui/dbui/selectdbtabledialog.src
+../../sw/source/ui/dbui/mmoutputtypepage.src
+../../sw/source/ui/dbui/mailmergechildwindow.src
+../../sw/source/ui/dbui/mmpreparemergepage.src
+../../sw/source/ui/dbui/mmdocselectpage.src
+../../sw/source/ui/dbui/mmgreetingspage.src
+../../sw/source/ui/dbui/mmaddressblockpage.src
+../../sw/source/ui/misc/linenum.src
+../../sw/source/ui/misc/outline.src
+../../sw/source/ui/misc/glosbib.src
+../../sw/source/ui/misc/pgfnote.src
+../../sw/source/ui/misc/redlndlg.src
+../../sw/source/ui/misc/glossary.src
+../../sw/source/ui/misc/numberingtypelistbox.src
+../../sw/source/ui/misc/autocorr.src
+../../sw/source/ui/misc/insfnote.src
+../../sw/source/ui/misc/srtdlg.src
+../../sw/source/ui/misc/num.src
+../../sw/source/ui/misc/pggrid.src
+../../sw/source/ui/misc/bookmark.src
+../../sw/source/ui/misc/docfnote.src
+../../sw/source/ui/misc/insrule.src
+../../sw/source/ui/docvw/docvw.src
+../../sw/source/ui/docvw/access.src
+../../sw/source/ui/fldui/javaedit.src
+../../sw/source/ui/fldui/fldref.src
+../../sw/source/ui/fldui/fldtdlg.src
+../../sw/source/ui/fldui/fldfunc.src
+../../sw/source/ui/fldui/flddok.src
+../../sw/source/ui/fldui/flddinf.src
+../../sw/source/ui/fldui/inpdlg.src
+../../sw/source/ui/fldui/flddb.src
+../../sw/source/ui/fldui/changedb.src
+../../sw/source/ui/fldui/fldvar.src
+../../sw/source/ui/fldui/DropDownFieldDialog.src
+../../sw/source/ui/fldui/fldui.src
+../../sw/source/ui/fmtui/tmpdlg.src
+../../sw/source/ui/fmtui/fmtui.src
+../../sw/source/ui/index/cnttab.src
+../../sw/source/ui/index/multmrk.src
+../../sw/source/ui/index/idxmrk.src
+../../sw/source/ui/lingu/olmenu.src
+../../sw/source/ui/table/colwd.src
+../../sw/source/ui/table/rowht.src
+../../sw/source/ui/table/tautofmt.src
+../../sw/source/ui/table/splittbl.src
+../../sw/source/ui/table/chartins.src
+../../sw/source/ui/table/tabledlg.src
+../../sw/source/ui/table/split.src
+../../sw/source/ui/table/convert.src
+../../sw/source/ui/table/insrc.src
+../../sw/source/ui/table/table.src
+../../sw/source/ui/table/mergetbl.src
+../../sw/source/ui/table/instable.src
+../../sw/source/ui/utlui/utlui.src
+../../sw/source/ui/utlui/initui.src
+../../sw/source/ui/utlui/navipi.src
+../../sw/source/ui/utlui/attrdesc.src
+../../sw/source/ui/utlui/gloslst.src
+../../sw/source/ui/utlui/poolfmt.src
+../../sw/source/ui/utlui/unotools.src
+../../sw/source/ui/wrtsh/wrtsh.src
+../../sw/source/ui/chrdlg/chardlg.src
+../../sw/source/ui/chrdlg/swbreak.src
+../../sw/source/ui/chrdlg/ccoll.src
+../../sw/source/ui/chrdlg/paradlg.src
+../../sw/source/ui/chrdlg/drpcps.src
+../../sw/source/ui/chrdlg/chrdlg.src
+../../sw/source/ui/chrdlg/numpara.src
+../../sw/source/ui/config/mailconfigpage.src
+../../sw/source/ui/config/optcomp.src
+../../sw/source/ui/config/optdlg.src
+../../sw/source/ui/config/optload.src
+../../sw/source/ui/config/redlopt.src
+../../sw/source/ui/dialog/abstract.src
+../../sw/source/ui/dialog/docstdlg.src
+../../sw/source/ui/dialog/ascfldlg.src
+../../sw/source/ui/dialog/dialog.src
+../../sw/source/ui/dialog/regionsw.src
+../../sw/source/ui/dialog/wordcountdialog.src
+../../sw/source/ui/dochdl/dochdl.src
+../../sw/source/ui/dochdl/selglos.src
+../../sw/source/ui/envelp/mailmrge.src
+../../sw/source/ui/envelp/envelp.src
+../../sw/source/ui/envelp/labprt.src
+../../sw/source/ui/envelp/envlop.src
+../../sw/source/ui/envelp/label.src
+../../sw/source/ui/envelp/envfmt.src
+../../sw/source/ui/envelp/labfmt.src
+../../sw/source/ui/envelp/envprt.src
+../../sw/source/ui/smartmenu/stmenu.src
+../../sw/source/ui/frmdlg/frmpage.src
+../../sw/source/ui/frmdlg/cption.src
+../../sw/source/ui/frmdlg/column.src
+../../sw/source/ui/frmdlg/wrap.src
+../../sw/source/ui/frmdlg/frmui.src
+../../sw/source/ui/globdoc/globdoc.src
+../../sw/source/ui/ribbar/tbxanchr.src
+../../sw/source/ui/ribbar/workctrl.src
+../../sw/source/ui/ribbar/inputwin.src
+../../sw/source/ui/ribbar/tblctrl.src
+../../sw/source/ui/shells/shells.src
+../../sw/source/ui/uiview/pview.src
+../../sw/source/ui/uiview/view.src
+../../sw/source/core/undo/undo.src
+../../sch/util/hidother.src
+../../sch/source/ui/app/res_hc_bmp.src
+../../sch/source/ui/app/menu_tmpl.src
+../../sch/source/ui/app/strings.src
+../../sch/source/ui/app/menuids_tmpl.src
+../../sch/source/ui/app/app.src
+../../sch/source/ui/app/res_bmp.src
+../../sch/source/ui/dlg/axisgrid.src
+../../sch/source/ui/dlg/attrib2.src
+../../sch/source/ui/dlg/attrib3.src
+../../sch/source/ui/dlg/attrib4.src
+../../sch/source/ui/dlg/tpappopt.src
+../../sch/source/ui/dlg/tplabel.src
+../../sch/source/ui/dlg/attrib.src
+../../sch/source/ui/dlg/title.src
+../../sch/source/ui/dlg/lightdlg.src
+../../sch/source/ui/dlg/viewdlg.src
+../../sch/source/ui/dlg/dgrdata.src
+../../sch/source/ui/dlg/dlggraut.src
+../../sch/source/ui/dlg/tpscaley.src
+../../sch/source/ui/dlg/datdescr.src
+../../sch/source/ui/dlg/legend.src
+../../sch/source/ui/dlg/diagrtyp.src
+../../sch/source/ui/dlg/datstat.src
+../../sch/source/core/glob.src
+../../so3/src/svuidlg.src
+../../so3/src/formats.src
+../../so3/src/nocode.src
+../../so3/util/hidother.src
+../../so3/workben/ddetest/ddetest.src
+../../so3/workben/paintdlg.src
+../../so3/workben/svser.src
+../../so3/workben/paint.src
+../../svx/util/hidother.src
+../../svx/source/src/app.src
+../../svx/source/form/fmstring.src
+../../svx/source/form/filtnav.src
+../../svx/source/form/fmexpl.src
+../../svx/source/form/fmsearch.src
+../../svx/source/form/tbxform.src
+../../svx/source/form/formshell.src
+../../svx/source/form/datanavi.src
+../../svx/source/intro/ooo.src
+../../svx/source/intro/iso.src
+../../svx/source/items/svxitems.src
+../../svx/source/items/svxerr.src
+../../svx/source/editeng/editeng.src
+../../svx/source/accessibility/accessibility.src
+../../svx/source/mnuctrls/mnuctrls.src
+../../svx/source/engine3d/float3d.src
+../../svx/source/engine3d/string3d.src
+../../svx/source/dialog/textanim.src
+../../svx/source/dialog/hyperdlg.src
+../../svx/source/dialog/textattr.src
+../../svx/source/dialog/tabarea.src
+../../svx/source/dialog/rubydialog.src
+../../svx/source/dialog/frmdirlbox.src
+../../svx/source/dialog/chardlg.src
+../../svx/source/dialog/numfmt.src
+../../svx/source/dialog/doclinkdialog.src
+../../svx/source/dialog/treeopt.src
+../../svx/source/dialog/page.src
+../../svx/source/dialog/opthtml.src
+../../svx/source/dialog/frmsel.src
+../../svx/source/dialog/ruler.src
+../../svx/source/dialog/optgdlg.src
+../../svx/source/dialog/fontwork.src
+../../svx/source/dialog/backgrnd.src
+../../svx/source/dialog/SpellDialog.src
+../../svx/source/dialog/labdlg.src
+../../svx/source/dialog/charmap.src
+../../svx/source/dialog/zoom.src
+../../svx/source/dialog/border.src
+../../svx/source/dialog/svuidlg.src
+../../svx/source/dialog/impgrf.src
+../../svx/source/dialog/dlgname.src
+../../svx/source/dialog/test.src
+../../svx/source/dialog/selector.src
+../../svx/source/dialog/optupdt.src
+../../svx/source/dialog/numpages.src
+../../svx/source/dialog/thesdlg.src
+../../svx/source/dialog/tabline.src
+../../svx/source/dialog/srchdlg.src
+../../svx/source/dialog/contdlg.src
+../../svx/source/dialog/paragrph.src
+../../svx/source/dialog/commonlingui.src
+../../svx/source/dialog/sdstring.src
+../../svx/source/dialog/optmemory.src
+../../svx/source/dialog/grfflt.src
+../../svx/source/dialog/langbox.src
+../../svx/source/dialog/bbdlg.src
+../../svx/source/dialog/hangulhanjadlg.src
+../../svx/source/dialog/txenctab.src
+../../svx/source/dialog/connpooloptions.src
+../../svx/source/dialog/dbregister.src
+../../svx/source/dialog/macropg.src
+../../svx/source/dialog/fontsubs.src
+../../svx/source/dialog/align.src
+../../svx/source/dialog/hyprlink.src
+../../svx/source/dialog/imapdlg.src
+../../svx/source/dialog/dlgctrl.src
+../../svx/source/dialog/tabstpge.src
+../../svx/source/dialog/readonlyimage.src
+../../svx/source/dialog/docrecovery.src
+../../svx/source/dialog/hlmarkwn.src
+../../svx/source/dialog/internationaloptions.src
+../../svx/source/dialog/optjava.src
+../../svx/source/dialog/language.src
+../../svx/source/dialog/hdft.src
+../../svx/source/dialog/lingu.src
+../../svx/source/dialog/grfpage.src
+../../svx/source/dialog/iconcdlg.src
+../../svx/source/dialog/swframeposstrings.src
+../../svx/source/dialog/connect.src
+../../svx/source/dialog/bmpmask.src
+../../svx/source/dialog/postdlg.src
+../../svx/source/dialog/checklbx.src
+../../svx/source/dialog/autocdlg.src
+../../svx/source/dialog/measure.src
+../../svx/source/dialog/cfg.src
+../../svx/source/dialog/scriptdlg.src
+../../svx/source/dialog/langtab.src
+../../svx/source/dialog/srchxtra.src
+../../svx/source/dialog/ctredlin.src
+../../svx/source/dialog/passwd.src
+../../svx/source/dialog/transfrm.src
+../../svx/source/dialog/optfltr.src
+../../svx/source/dialog/prtqry.src
+../../svx/source/dialog/eventdlg.src
+../../svx/source/dialog/hyphen.src
+../../svx/source/dialog/swpossizetabpage.src
+../../svx/source/dialog/dstribut.src
+../../svx/source/svxlink/linkmgr.src
+../../svx/source/fmcomp/gridctrl.src
+../../svx/source/fmcomp/showcols.src
+../../svx/source/outliner/outliner.src
+../../svx/source/unodraw/unodraw.src
+../../svx/source/svdraw/svdstr.src
+../../svx/source/stbctrls/stbctrls.src
+../../svx/source/unodialogs/textconversiondlgs/chinese_translationdialog.src
+../../svx/source/unodialogs/textconversiondlgs/chinese_dictionarydialog.src
+../../svx/source/toolbars/fontworkbar.src
+../../svx/source/toolbars/extrusionbar.src
+../../svx/source/options/optlingu.src
+../../svx/source/options/optasian.src
+../../svx/source/options/optdict.src
+../../svx/source/options/optinet2.src
+../../svx/source/options/optspell.src
+../../svx/source/options/optsave.src
+../../svx/source/options/optgrid.src
+../../svx/source/options/multipat.src
+../../svx/source/options/optcolor.src
+../../svx/source/options/optpath.src
+../../svx/source/options/optctl.src
+../../svx/source/options/optaccessibility.src
+../../svx/source/options/optjsearch.src
+../../svx/source/options/optgenrl.src
+../../svx/source/gallery2/gallery.src
+../../svx/source/gallery2/galtheme.src
+../../svx/source/tbxctrls/extrusioncontrols.src
+../../svx/source/tbxctrls/tbcontrl.src
+../../svx/source/tbxctrls/fontworkgallery.src
+../../svx/source/tbxctrls/lboxctrl.src
+../../svx/source/tbxctrls/linectrl.src
+../../svx/source/tbxctrls/tbxdraw.src
+../../svx/source/tbxctrls/grafctrl.src
+../../svx/source/tbxctrls/colrctrl.src
+../../vcl/source/src/menu.src
+../../vcl/source/src/stdtext.src
+../../vcl/source/src/images.src
+../../vcl/source/src/helptext.src
+../../vcl/source/src/btntext.src
+../../vcl/source/src/units.src
+../../uui/source/passworderrs.src
+../../uui/source/logindlg.src
+../../uui/source/passworddlg.src
+../../uui/source/ids.src
+../../uui/source/masterpassworddlg.src
+../../uui/source/passcrtdlg.src
+../../uui/source/cookiedg.src
+../../uui/source/fltdlg.src
+../../uui/source/masterpasscrtdlg.src
+../../dbaccess/util/hidother.src
+../../dbaccess/source/ui/app/app.src
+../../dbaccess/source/ui/dlg/indexdialog.src
+../../dbaccess/source/ui/dlg/RelationDlg.src
+../../dbaccess/source/ui/dlg/queryfilter.src
+../../dbaccess/source/ui/dlg/AdvancedPageDlg.src
+../../dbaccess/source/ui/dlg/queryorder.src
+../../dbaccess/source/ui/dlg/dbadmin.src
+../../dbaccess/source/ui/dlg/dsselect.src
+../../dbaccess/source/ui/dlg/paramdialog.src
+../../dbaccess/source/ui/dlg/CollectionView.src
+../../dbaccess/source/ui/dlg/sqlmessage.src
+../../dbaccess/source/ui/dlg/UserAdmin.src
+../../dbaccess/source/ui/dlg/ConnectionPage.src
+../../dbaccess/source/ui/dlg/dlgattr.src
+../../dbaccess/source/ui/dlg/AutoControls.src
+../../dbaccess/source/ui/dlg/dlgsave.src
+../../dbaccess/source/ui/dlg/UserAdminDlg.src
+../../dbaccess/source/ui/dlg/directsql.src
+../../dbaccess/source/ui/dlg/dlgsize.src
+../../dbaccess/source/ui/dlg/AdabasStat.src
+../../dbaccess/source/ui/dlg/dbfindex.src
+../../dbaccess/source/ui/dlg/dbadminsetup.src
+../../dbaccess/source/ui/dlg/AdabasStatDlg.src
+../../dbaccess/source/ui/dlg/adtabdlg.src
+../../dbaccess/source/ui/dlg/dbadmin2.src
+../../dbaccess/source/ui/uno/dbinteraction.src
+../../dbaccess/source/ui/misc/WizardPages.src
+../../dbaccess/source/ui/misc/dbumiscres.src
+../../dbaccess/source/ui/control/undosqledit.src
+../../dbaccess/source/ui/control/TableGrantCtrl.src
+../../dbaccess/source/ui/control/tabletree.src
+../../dbaccess/source/ui/imagelists/dbimagelists.src
+../../dbaccess/source/ui/relationdesign/relation.src
+../../dbaccess/source/ui/tabledesign/table.src
+../../dbaccess/source/ui/querydesign/querydlg.src
+../../dbaccess/source/ui/querydesign/query.src
+../../dbaccess/source/ui/browser/bcommon.src
+../../dbaccess/source/ui/browser/sbagrid.src
+../../dbaccess/source/ui/browser/sbabrw.src
+../../dbaccess/source/core/resource/strings.src
+../../dbaccess/source/sdbtools/resource/sdbt_strings.src
+../../sfx2/util/hidother.src
+../../sfx2/source/doc/sfxbasemodel.src
+../../sfx2/source/doc/doctempl.src
+../../sfx2/source/doc/doc.src
+../../sfx2/source/doc/secmacrowarnings.src
+../../sfx2/source/doc/new.src
+../../sfx2/source/doc/docvor.src
+../../sfx2/source/doc/graphhelp.src
+../../sfx2/source/doc/doctdlg.src
+../../sfx2/source/appl/dde.src
+../../sfx2/source/appl/newhelp.src
+../../sfx2/source/appl/sfx.src
+../../sfx2/source/appl/app.src
+../../sfx2/source/menu/menu.src
+../../sfx2/source/view/view.src
+../../sfx2/source/bastyp/fltfnc.src
+../../sfx2/source/bastyp/bastyp.src
+../../sfx2/source/config/config.src
+../../sfx2/source/dialog/recfloat.src
+../../sfx2/source/dialog/templdlg.src
+../../sfx2/source/dialog/newstyle.src
+../../sfx2/source/dialog/dinfdlg.src
+../../sfx2/source/dialog/alienwarn.src
+../../sfx2/source/dialog/dinfedt.src
+../../sfx2/source/dialog/printopt.src
+../../sfx2/source/dialog/srchdlg.src
+../../sfx2/source/dialog/mailwindow.src
+../../sfx2/source/dialog/dialog.src
+../../sfx2/source/dialog/macropg.src
+../../sfx2/source/dialog/versdlg.src
+../../sfx2/source/dialog/mgetempl.src
+../../sfx2/source/dialog/filedlghelper.src
+../../sfx2/source/dialog/cfg.src
+../../sfx2/source/dialog/passwd.src
+../../framework/util/hidother.src
+../../framework/source/classes/resource.src
+../../desktop/util/hidother.src
+../../desktop/source/app/desktop.src
+../../desktop/source/deployment/gui/dp_gui_dependencydialog.src
+../../desktop/source/deployment/gui/dp_gui_backend.src
+../../desktop/source/deployment/gui/dp_gui_versionboxes.src
+../../desktop/source/deployment/gui/dp_gui_updatedialog.src
+../../desktop/source/deployment/gui/dp_gui_updateinstalldialog.src
+../../desktop/source/deployment/gui/dp_gui_dialog.src
+../../desktop/source/deployment/misc/dp_misc.src
+../../desktop/source/deployment/manager/dp_manager.src
+../../desktop/source/deployment/unopkg/unopkg.src
+../../desktop/source/deployment/registry/sfwk/dp_sfwk.src
+../../desktop/source/deployment/registry/component/dp_component.src
+../../desktop/source/deployment/registry/dp_registry.src
+../../desktop/source/deployment/registry/configuration/dp_configuration.src
+../../desktop/source/deployment/registry/script/dp_script.src
+../../desktop/source/deployment/registry/package/dp_package.src
+../../desktop/source/migration/migration.src
+../../desktop/source/migration/wizard.src
+../../basic/source/app/basic.src
+../../basic/source/app/ttmsg.src
+../../basic/source/app/svtmsg.src
+../../basic/source/app/testtool.src
+../../basic/source/app/basmsg.src
+../../basic/source/sbx/format.src
+../../basic/source/classes/sb.src
+../../basic/workben/basmgr.src
+../../forms/source/resource/xforms.src
+../../forms/source/resource/strings.src
+../../scaddins/source/datefunc/datefunc.src
+../../scaddins/source/analysis/analysis_deffuncnames.src
+../../scaddins/source/analysis/analysis.src
+../../scaddins/source/analysis/analysis_funcnames.src
+../../basctl/util/hidother.src
+../../basctl/source/dlged/dlgresid.src
+../../basctl/source/dlged/managelang.src
+../../basctl/source/basicide/tbxctl.src
+../../basctl/source/basicide/moptions.src
+../../basctl/source/basicide/macrodlg.src
+../../basctl/source/basicide/objdlg.src
+../../basctl/source/basicide/basidesh.src
+../../basctl/source/basicide/moduldlg.src
+../../basctl/source/basicide/brkdlg.src
+../../chart2/source/controller/menu/ContextMenu.src
+../../chart2/source/controller/menu/MainMenu.src
+../../chart2/source/controller/dialogs/tp_DataLabel.src
+../../chart2/source/controller/dialogs/Strings_ChartTypes.src
+../../chart2/source/controller/dialogs/dlg_InsertTitle.src
+../../chart2/source/controller/dialogs/Strings.src
+../../chart2/source/controller/dialogs/tp_SeriesStatistic.src
+../../chart2/source/controller/dialogs/dlg_InsertDataLabel.src
+../../chart2/source/controller/dialogs/Strings_Statistic.src
+../../chart2/source/controller/dialogs/dlg_InsertLegend.src
+../../chart2/source/controller/dialogs/dlg_RotateDiagram.src
+../../chart2/source/controller/dialogs/tp_PointGeometry.src
+../../chart2/source/controller/dialogs/dlg_ObjectProperties.src
+../../chart2/source/controller/dialogs/Bitmaps_HC.src
+../../chart2/source/controller/dialogs/tp_TitleRotation.src
+../../chart2/source/controller/dialogs/dlg_ChartType.src
+../../chart2/source/controller/dialogs/Bitmaps.src
+../../chart2/source/controller/dialogs/dlg_InsertStatistic.src
+../../chart2/source/controller/dialogs/Strings_Scale.src
+../../chart2/source/controller/dialogs/tp_LegendPosition.src
+../../chart2/source/controller/dialogs/dlg_InsertAxis_Grid.src
+../../chart2/source/controller/dialogs/tp_AxisLabel.src
+../../chart2/source/controller/dialogs/tp_SeriesToAxis.src
+../../chart2/source/controller/dialogs/tp_Scale.src
+../../scsolver/source/ui/scsolver.src
+../../automation/source/miniapp/servres.src
+../../svtools/util/hidother.src
+../../svtools/bmpmaker/bmp.src
+../../svtools/source/uno/unoifac2.src
+../../svtools/source/java/javaerror.src
+../../svtools/source/java/patchjavaerror.src
+../../svtools/source/misc/imagemgr.src
+../../svtools/source/misc/iniman.src
+../../svtools/source/misc/config.src
+../../svtools/source/misc/errtxt.src
+../../svtools/source/misc/ehdl.src
+../../svtools/source/misc/helpagent.src
+../../svtools/source/control/ctrlbox.src
+../../svtools/source/control/ctrltool.src
+../../svtools/source/control/calendar.src
+../../svtools/source/control/filectrl.src
+../../svtools/source/dialogs/colrdlg.src
+../../svtools/source/dialogs/addresstemplate.src
+../../svtools/source/dialogs/prnsetup.src
+../../svtools/source/dialogs/formats.src
+../../svtools/source/dialogs/filedlg2.src
+../../svtools/source/dialogs/so3res.src
+../../svtools/source/dialogs/printdlg.src
+../../svtools/source/dialogs/logindlg.src
+../../svtools/source/dialogs/wizardmachine.src
+../../svtools/source/misc1/mediatyp.src
+../../svtools/source/brwbox/editbrowsebox.src
+../../svtools/source/contnr/fileview.src
+../../svtools/source/contnr/svcontnr.src
+../../svtools/source/contnr/templwin.src
+../../svtools/source/items1/cstitem.src
+../../svtools/source/filter.vcl/filter/dlgepng.src
+../../svtools/source/filter.vcl/filter/dlgexpor.src
+../../svtools/source/filter.vcl/filter/dlgejpg.src
+../../svtools/source/filter.vcl/filter/strings.src
+../../svtools/source/Accessibility/accessiblelistboxentry.src
+../../svtools/source/productregistration/registrationdlg.src
+../../svtools/source/plugapp/commtest.src
+../../svtools/source/plugapp/testtool.src
+../../fpicker/source/office/OfficeFilePicker.src
+../../fpicker/source/office/iodlg.src
+../../filter/source/pdf/impdialog.src
+../../filter/source/pdf/pdf.src
+../../filter/source/t602/t602filter.src
+../../filter/source/flash/impswfdialog.src
+../../filter/source/xsltdialog/xmlfiltertabdialog.src
+../../filter/source/xsltdialog/xmlfiltersettingsdialog.src
+../../filter/source/xsltdialog/xmlfileview.src
+../../filter/source/xsltdialog/xmlfilterdialogstrings.src
+../../filter/source/xsltdialog/hidother.src
+../../filter/source/xsltdialog/xmlfiltertabpagexslt.src
+../../filter/source/xsltdialog/xmlfiltertestdialog.src
+../../filter/source/xsltdialog/xmlfiltertabpagebasic.src
+../../toolkit/source/awt/accessiblestrings.src
+../../toolkit/source/awt/xthrobber.src
+../../xmlsecurity/source/dialogs/warnings.src
+../../xmlsecurity/source/dialogs/macrosecurity.src
+../../xmlsecurity/source/dialogs/certificatechooser.src
+../../xmlsecurity/source/dialogs/digitalsignaturesdialog.src
+../../xmlsecurity/source/dialogs/certificateviewer.src
+../../xmlsecurity/source/component/warnbox.src
+../../padmin/source/rtsetup.src
+../../padmin/source/padialog.src
+../../ucbhelper/workben/ucbexplorer/ucbexplorer.src
+../../starmath/util/hidother.src
+../../starmath/source/commands.src
+../../starmath/source/symbol.src
+../../starmath/source/menu_tmpl.src
+../../starmath/source/smres.src
+../../extensions/qa/complex/extensions/orl_de.src
+../../extensions/qa/complex/extensions/orl_en-US.src
+../../extensions/util/hidother.src
+../../extensions/source/bibliography/menu.src
+../../extensions/source/bibliography/toolbar.src
+../../extensions/source/bibliography/datman.src
+../../extensions/source/bibliography/sections.src
+../../extensions/source/bibliography/hidother.src
+../../extensions/source/bibliography/bib.src
+../../extensions/source/scanner/grid.src
+../../extensions/source/scanner/sanedlg.src
+../../extensions/source/dbpilots/dbpilots.src
+../../extensions/source/dbpilots/gridpages.src
+../../extensions/source/dbpilots/listcombopages.src
+../../extensions/source/dbpilots/groupboxpages.src
+../../extensions/source/dbpilots/commonpagesdbp.src
+../../extensions/source/abpilot/abspilot.src
+../../extensions/source/update/ui/updatecheckui.src
+../../extensions/source/propctrlr/taborder.src
+../../extensions/source/propctrlr/listselectiondlg.src
+../../extensions/source/propctrlr/formlinkdialog.src
+../../extensions/source/propctrlr/fontdialog.src
+../../extensions/source/propctrlr/selectlabeldialog.src
+../../extensions/source/propctrlr/pcrmiscres.src
+../../extensions/source/propctrlr/formres.src
+../../extensions/source/propctrlr/newdatatype.src
+../../extensions/source/propctrlr/propres.src
+../../extensions/source/preload/preload.src
+../../extensions/workben/testresource.src
+../../avmedia/util/hidother.src
+../../avmedia/source/framework/mediacontrol.src
+../../avmedia/source/viewer/mediawindow.src
+../../connectivity/source/resource/conn_shared_res.src
+../../connectivity/source/drivers/hsqldb/hsqlui.src
+../../scripting/source/runtimemgr/ScriptExecDialog.src
+../../wizards/util/hidother.src
+../../wizards/source/euro/euro.src
+../../wizards/source/imagelists/imagelists.src
+../../wizards/source/webwizard/webwizar.src
+../../wizards/source/template/template.src
+../../wizards/source/schedule/schedule.src
+../../wizards/source/importwizard/importwi.src
+../../wizards/source/formwizard/dbwizres.src
diff --git a/toolkit/src2xml/sw.sh b/toolkit/src2xml/sw.sh
new file mode 100644
index 000000000000..22f16d4b6c57
--- /dev/null
+++ b/toolkit/src2xml/sw.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+source/src2xml.py --include-path=$(tr '\n' ':' < include-sw.lst) --dry-run $(cat src-sw.lst) "$@"
diff --git a/toolkit/test/accessibility/AWB.sxw b/toolkit/test/accessibility/AWB.sxw
new file mode 100755
index 000000000000..57931aed1d19
--- /dev/null
+++ b/toolkit/test/accessibility/AWB.sxw
Binary files differ
diff --git a/toolkit/test/accessibility/AccTreeNode.java b/toolkit/test/accessibility/AccTreeNode.java
new file mode 100644
index 000000000000..64a5a5a3c4f6
--- /dev/null
+++ b/toolkit/test/accessibility/AccTreeNode.java
@@ -0,0 +1,350 @@
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.*;
+import java.util.Vector;
+
+/**
+ * The node type for the AccessibleTreeModel.
+ * This implements all the child-handling based on the appropriate
+ * NodeHandlers. Trivial nodes can be implemented by any Object
+ * type.
+ */
+class AccTreeNode
+ extends AccessibleTreeNode
+{
+ class HandlerDescriptor
+ {
+ public HandlerDescriptor (NodeHandler aHandler)
+ {
+ maHandler = aHandler;
+ mnChildCount = -1;
+ }
+ public NodeHandler maHandler;
+ public int mnChildCount;
+ }
+ /// NodeHandlers for this node
+ private Vector maHandlers;
+
+ // The accessible context of this node.
+ private XAccessible mxAccessible;
+ private XAccessibleContext mxContext;
+ private XAccessibleComponent mxComponent;
+ private XAccessibleText mxText;
+ private XAccessibleTable mxTable;
+
+ public AccTreeNode (XAccessible xAccessible, XAccessibleContext xContext, AccessibleTreeNode aParent)
+ {
+ this (xAccessible, xContext, xContext, aParent);
+ }
+
+ public AccTreeNode (XAccessible xAccessible, XAccessibleContext xContext, Object aDisplay, AccessibleTreeNode aParent)
+ {
+ super (aDisplay, aParent);
+
+ maHandlers = new Vector(5);
+ mxContext = xContext;
+ mxAccessible = xAccessible;
+ }
+
+ /** Update the internal data extracted from the corresponding accessible
+ object. This is done by replacing every handler by a new one. An
+ update method at each handler would be better of course.
+ */
+ public void update ()
+ {
+ for (int i=0; i<maHandlers.size(); i++)
+ {
+ System.out.println ("replacing handler " + i);
+ HandlerDescriptor aDescriptor = (HandlerDescriptor)maHandlers.get(i);
+ aDescriptor.maHandler = aDescriptor.maHandler.createHandler (mxContext);
+ aDescriptor.mnChildCount =
+ aDescriptor.maHandler.getChildCount (this);
+ }
+ }
+
+ public XAccessibleContext getContext ()
+ {
+ return mxContext;
+ }
+
+ public XAccessibleComponent getComponent ()
+ {
+ if (mxComponent == null && mxContext != null)
+ mxComponent = (XAccessibleComponent)UnoRuntime.queryInterface(
+ XAccessibleComponent.class, mxContext);
+ return mxComponent;
+ }
+
+ public XAccessibleExtendedComponent getExtendedComponent ()
+ {
+ if (mxComponent == null)
+ getComponent();
+ if (mxComponent != null)
+ return (XAccessibleExtendedComponent)UnoRuntime.queryInterface(
+ XAccessibleExtendedComponent.class, mxComponent);
+ else
+ return null;
+ }
+
+ public XAccessibleText getText ()
+ {
+ if (mxText == null && mxContext != null)
+ mxText = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, mxContext);
+ return mxText;
+ }
+
+ public XAccessibleEditableText getEditText ()
+ {
+ return (XAccessibleEditableText)UnoRuntime.queryInterface(
+ XAccessibleEditableText.class, mxContext);
+ }
+
+ public XAccessibleTable getTable ()
+ {
+ if (mxTable == null && mxContext != null)
+ mxTable = (XAccessibleTable)UnoRuntime.queryInterface(
+ XAccessibleTable.class, mxContext);
+ return mxTable;
+ }
+
+
+ public XAccessible getAccessible()
+ {
+ if ((mxAccessible == null) && (mxContext != null))
+ mxAccessible = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, mxContext);
+ return mxAccessible;
+ }
+
+ public XAccessibleSelection getSelection ()
+ {
+ return (XAccessibleSelection)UnoRuntime.queryInterface(
+ XAccessibleSelection.class, mxContext);
+ }
+
+ public void addHandler( NodeHandler aHandler )
+ {
+ if (aHandler != null)
+ maHandlers.add (new HandlerDescriptor (aHandler));
+ }
+
+
+ /** iterate over handlers and return child sum */
+ protected HandlerDescriptor getHandlerDescriptor (int i)
+ {
+ HandlerDescriptor aDescriptor = (HandlerDescriptor)maHandlers.get(i);
+ if (aDescriptor.mnChildCount < 0)
+ aDescriptor.mnChildCount =
+ aDescriptor.maHandler.getChildCount (this);
+ return aDescriptor;
+ }
+
+ public int getChildCount()
+ {
+ int nChildCount = 0;
+ for (int i = 0; i < maHandlers.size(); i++)
+ {
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ nChildCount += aDescriptor.mnChildCount;
+ }
+ return nChildCount;
+ }
+
+ /** iterate over handlers until the child is found */
+ public AccessibleTreeNode getChild (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ if( nIndex >= 0 )
+ {
+ for(int i = 0; i < maHandlers.size(); i++)
+ {
+ // check if this handler has the child, and if not
+ // search with next handler
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ if (nIndex < aDescriptor.mnChildCount)
+ return aDescriptor.maHandler.getChild (this, nIndex);
+ else
+ nIndex -= aDescriptor.mnChildCount;
+ }
+ }
+ else
+ throw new IndexOutOfBoundsException();
+
+ // nothing found?
+ return null;
+ }
+
+ public AccessibleTreeNode getChildNoCreate (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ if( nIndex >= 0 )
+ {
+ for(int i = 0; i < maHandlers.size(); i++)
+ {
+ // check if this handler has the child, and if not
+ // search with next handler
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ if (nIndex < aDescriptor.mnChildCount)
+ return aDescriptor.maHandler.getChildNoCreate (this, nIndex);
+ else
+ nIndex -= aDescriptor.mnChildCount;
+ }
+ }
+ else
+ throw new IndexOutOfBoundsException();
+
+ // nothing found?
+ return null;
+ }
+
+ public boolean removeChild (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ boolean bStatus = false;
+ if (nIndex >= 0)
+ {
+ for (int i=0; i<maHandlers.size(); i++)
+ {
+ // check if this handler has the child, and if not
+ // search with next handler
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ if (nIndex < aDescriptor.mnChildCount)
+ {
+ bStatus = aDescriptor.maHandler.removeChild (this, nIndex);
+ aDescriptor.mnChildCount = aDescriptor.maHandler.getChildCount (this);
+ break;
+ }
+ else
+ nIndex -= aDescriptor.mnChildCount;
+ }
+ }
+ else
+ throw new IndexOutOfBoundsException();
+
+ return bStatus;
+ }
+
+
+ public int indexOf (AccessibleTreeNode aNode)
+ {
+ int nBaseIndex = 0;
+ if (aNode != null)
+ {
+ for (int i=0; i<maHandlers.size(); i++)
+ {
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ int nIndex = aDescriptor.maHandler.indexOf (aNode);
+ if (nIndex >= 0)
+ return nBaseIndex + nIndex;
+ else
+ nBaseIndex += aDescriptor.mnChildCount;
+ }
+ }
+
+ return -1;
+ }
+
+ /** this node is a leaf if have no handlers, or is those
+ handlers show no children */
+ public boolean isLeaf()
+ {
+ return (maHandlers.size() == 0);// || (getChildCount() == 0);
+ }
+
+ public boolean equals (Object aOther)
+ {
+ return (this == aOther) || (aOther!=null && aOther.equals(mxContext));
+ }
+
+
+ /** iterate over handlers until the child is found */
+ public void getActions(Vector aActions)
+ {
+ for(int i = 0; i < maHandlers.size(); i++)
+ {
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ NodeHandler aHandler = aDescriptor.maHandler;
+ String[] aHandlerActions = aHandler.getActions (this);
+ for(int j = 0; j < aHandlerActions.length; j++ )
+ {
+ aActions.add( aHandlerActions[j] );
+ }
+ }
+ }
+
+ public void performAction( int nIndex )
+ {
+ if( nIndex >= 0 )
+ {
+ for(int i = 0; i < maHandlers.size(); i++)
+ {
+ // check if this handler has the child, and if not
+ // search with next handler
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ NodeHandler aHandler = aDescriptor.maHandler;
+ int nCount = aHandler.getActions(this).length;
+ if( nCount > nIndex )
+ {
+ aHandler.performAction(this, nIndex );
+ return;
+ }
+ else
+ nIndex -= nCount;
+ }
+ }
+ }
+
+ /** Try to add the specified accessible object as new accessible child of the
+ AccessibleTreeHandler.
+ Note that child is used in another context than
+ it is used in the other methods of this class.
+ */
+ public AccessibleTreeNode addAccessibleChild (XAccessible xChild)
+ {
+ for(int i = 0; i < maHandlers.size(); i++)
+ {
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ if (aDescriptor.maHandler instanceof AccessibleTreeHandler)
+ {
+ AccessibleTreeHandler aHandler = (AccessibleTreeHandler)aDescriptor.maHandler;
+ AccessibleTreeNode aNode = aHandler.addAccessibleChild (this, xChild);
+ aDescriptor.mnChildCount = aHandler.getChildCount (this);
+ return aNode;
+ }
+ }
+ return null;
+ }
+
+ /** Update the specified handlers.
+ @return
+ The returned array containes the indices of the updated children
+ and can be used to create a TreeModelEvent.
+ */
+ public Vector updateChildren (java.lang.Class class1)
+ {
+ return updateChildren (class1, null);
+ }
+
+ public Vector updateChildren (java.lang.Class class1, java.lang.Class class2)
+ {
+ Vector aChildIndices = new Vector();
+ int nOffset = 0;
+ for(int i=0; i < maHandlers.size(); i++)
+ {
+ HandlerDescriptor aDescriptor = getHandlerDescriptor (i);
+ if ((class1.isInstance(aDescriptor.maHandler))
+ || (class2 !=null && class2.isInstance(aDescriptor.maHandler)))
+ {
+ aDescriptor.maHandler.update(this);
+ // Get updated number of children.
+ int nChildCount = aDescriptor.maHandler.getChildCount (this);
+ aDescriptor.mnChildCount = nChildCount;
+ // Fill in the indices of the updated children.
+ for (int j=0; j<nChildCount; j++)
+ aChildIndices.add(new Integer(j+nOffset));
+ }
+ nOffset += aDescriptor.mnChildCount;
+ }
+ return aChildIndices;
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibilityTree.java b/toolkit/test/accessibility/AccessibilityTree.java
new file mode 100755
index 000000000000..819631b41eb8
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibilityTree.java
@@ -0,0 +1,377 @@
+import com.sun.star.accessibility.*;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.uno.UnoRuntime;
+
+import java.util.Vector;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.tree.*;
+import javax.swing.event.*;
+
+
+
+/** This is the tree component that is responsible for displaying the
+ contents of the tree model on the screen.
+*/
+public class AccessibilityTree
+ implements TreeExpansionListener, TreeWillExpandListener
+{
+ /** Create a new accessibility tree. Use the specified message display
+ for displaying messages and the specified canvas to draw the
+ graphical representations of accessible objects on.
+ */
+ public AccessibilityTree ()
+ {
+ maTree = new JTree ();
+
+ AccessibilityTreeModel aModel =
+ new AccessibilityTreeModel (
+ new StringNode ("Please press Update button", null));
+ maTree.setModel (aModel);
+
+ maCellRenderer = new AccessibleTreeCellRenderer();
+ // setCellRenderer (maCellRenderer);
+
+ // allow editing of XAccessibleText interfaces
+ // setEditable (true);
+ // maTreeModel.addTreeModelListener( new TextUpdateListener() );
+
+ maTree.addMouseListener (new MouseListener (this));
+
+ // Listen to expansions and collapses to change the mouse cursor.
+ mnExpandLevel = 0;
+ maTree.addTreeWillExpandListener (this);
+ maTree.addTreeExpansionListener (this);
+ }
+
+ public JTree getComponent ()
+ {
+ return maTree;
+ }
+
+ // Change cursor during expansions to show the user that this is a
+ // lengthy operation.
+ public void treeWillExpand (TreeExpansionEvent e)
+ {
+ if (mnExpandLevel == 0)
+ {
+ maTree.setCursor (new Cursor (Cursor.WAIT_CURSOR));
+ }
+ mnExpandLevel += 1;
+ }
+ public void treeWillCollapse (TreeExpansionEvent e)
+ {
+ if (mnExpandLevel == 0)
+ {
+ maTree.setCursor (new Cursor (Cursor.WAIT_CURSOR));
+ }
+ mnExpandLevel += 1;
+ }
+ public void treeExpanded (TreeExpansionEvent e)
+ {
+ mnExpandLevel -= 1;
+ if (mnExpandLevel == 0)
+ {
+ maTree.setCursor (new Cursor (Cursor.DEFAULT_CURSOR));
+ }
+ }
+ public void treeCollapsed (TreeExpansionEvent e)
+ {
+ mnExpandLevel -= 1;
+ if (mnExpandLevel == 0)
+ {
+ maTree.setCursor (new Cursor (Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+
+
+ public void SetCanvas (Canvas aCanvas)
+ {
+ maCanvas = aCanvas;
+ ((AccessibilityTreeModel)maTree.getModel()).setCanvas (maCanvas);
+ }
+
+ /** Expand the nodes in the subtree rooted in aNode according to the the
+ specified expander. The tree is locked during the expansion.
+ */
+ protected void expandTree (AccessibleTreeNode aNode, Expander aExpander)
+ {
+ if (mnExpandLevel == 0)
+ {
+ maTree.setEnabled (false);
+ }
+ mnExpandLevel += 1;
+
+ ((AccessibilityTreeModel)maTree.getModel()).lock ();
+
+ try
+ {
+ expandTree (new TreePath (aNode.createPath()), aExpander);
+ }
+ catch (Exception e)
+ {
+ // Ignore
+ }
+
+ mnExpandLevel -= 1;
+ if (mnExpandLevel == 0)
+ {
+ maTree.setEnabled (true);
+ ((AccessibilityTreeModel)maTree.getModel()).unlock (aNode);
+ }
+ }
+
+ private TreePath expandTree( TreePath aPath, Expander aExpander )
+ {
+ // return first expanded object
+ TreePath aFirst = null;
+
+ // System.out.print ("e");
+
+ try
+ {
+ // get 'our' object
+ Object aObj = aPath.getLastPathComponent();
+
+ // expand this object, if the Expander tells us so
+ if( aExpander.expand( aObj ) )
+ {
+ maTree.expandPath (aPath);
+ if( aFirst == null )
+ aFirst = aPath;
+ }
+
+ // visit all children
+ if (aObj instanceof AccessibleTreeNode)
+ {
+ AccessibleTreeNode aNode = (AccessibleTreeNode)aObj;
+ int nLength = aNode.getChildCount();
+ for( int i = 0; i < nLength; i++ )
+ {
+ TreePath aRet = expandTree(
+ aPath.pathByAddingChild( aNode.getChild( i ) ),
+ aExpander );
+ if( aFirst == null )
+ aFirst = aRet;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while expanding tree path "
+ + aPath + ": " + e);
+ e.printStackTrace ();
+ }
+
+ return aFirst;
+ }
+
+
+ /** Expand all nodes and their subtrees that represent shapes. Call
+ * this method from the outside. */
+ public void expandShapes ()
+ {
+ expandShapes ((AccessibleTreeNode)maTree.getModel().getRoot());
+ }
+ public void expandShapes (AccessibleTreeNode aNode)
+ {
+ expandTree (aNode, new ShapeExpander());
+ }
+
+ /** Expand all nodes */
+ public void expandAll ()
+ {
+ expandAll ((AccessibleTreeNode)maTree.getModel().getRoot());
+ }
+ public void expandAll (AccessibleTreeNode aNode)
+ {
+ expandTree (aNode, new AllExpander());
+ }
+
+
+
+ public void disposing (com.sun.star.lang.EventObject e)
+ {
+ System.out.println ("disposing " + e);
+ }
+
+ /*
+ public Dimension getPreferredSize ()
+ {
+ Dimension aPreferredSize = super.getPreferredSize();
+ Dimension aMinimumSize = super.getMinimumSize();
+ if (aPreferredSize.width < aMinimumSize.width)
+ aPreferredSize.width = aMinimumSize.width;
+ return aPreferredSize;
+ }
+ */
+
+ class MouseListener extends MouseAdapter
+ {
+ public MouseListener (AccessibilityTree aTree)
+ {
+ maTree=aTree;
+ }
+ public void mousePressed(MouseEvent e) { popupTrigger(e); }
+ public void mouseClicked(MouseEvent e) { popupTrigger(e); }
+ public void mouseEntered(MouseEvent e) { popupTrigger(e); }
+ public void mouseExited(MouseEvent e) { popupTrigger(e); }
+ public void mouseReleased(MouseEvent e) { popupTrigger(e); }
+
+ public boolean popupTrigger( MouseEvent e )
+ {
+ boolean bIsPopup = e.isPopupTrigger();
+ if( bIsPopup )
+ {
+ int selRow = maTree.getComponent().getRowForLocation(e.getX(), e.getY());
+ if (selRow != -1)
+ {
+ TreePath aPath = maTree.getComponent().getPathForLocation(e.getX(), e.getY());
+
+ // check for actions
+ Object aObject = aPath.getLastPathComponent();
+ JPopupMenu aMenu = new JPopupMenu();
+ if( aObject instanceof AccTreeNode )
+ {
+ AccTreeNode aNode = (AccTreeNode)aObject;
+
+ Vector aActions = new Vector();
+ aMenu.add (new AccessibilityTree.ShapeExpandAction(maTree, aNode));
+ aMenu.add (new AccessibilityTree.SubtreeExpandAction(maTree, aNode));
+
+ aNode.getActions(aActions);
+ for( int i = 0; i < aActions.size(); i++ )
+ {
+ aMenu.add( new NodeAction(
+ aActions.elementAt(i).toString(),
+ aNode, i ) );
+ }
+ }
+ else if (aObject instanceof AccessibleTreeNode)
+ {
+ AccessibleTreeNode aNode = (AccessibleTreeNode)aObject;
+ String[] aActionNames = aNode.getActions();
+ int nCount=aActionNames.length;
+ if (nCount > 0)
+ {
+ for (int i=0; i<nCount; i++)
+ aMenu.add( new NodeAction(
+ aActionNames[i],
+ aNode,
+ i));
+ }
+ else
+ aMenu = null;
+ }
+ if (aMenu != null)
+ aMenu.show (maTree.getComponent(),
+ e.getX(), e.getY());
+ }
+ }
+
+ return bIsPopup;
+ }
+
+ private AccessibilityTree maTree;
+ }
+
+ class NodeAction extends AbstractAction
+ {
+ private int mnIndex;
+ private AccessibleTreeNode maNode;
+
+ public NodeAction( String aName, AccessibleTreeNode aNode, int nIndex )
+ {
+ super( aName );
+ maNode = aNode;
+ mnIndex = nIndex;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ maNode.performAction(mnIndex);
+ }
+ }
+
+ // This action expands all shapes in the subtree rooted in the specified node.
+ class ShapeExpandAction extends AbstractAction
+ {
+ private AccessibilityTree maTree;
+ private AccTreeNode maNode;
+ public ShapeExpandAction (AccessibilityTree aTree, AccTreeNode aNode)
+ {
+ super ("Expand Shapes");
+ maTree = aTree;
+ maNode = aNode;
+ }
+ public void actionPerformed (ActionEvent e)
+ {
+ maTree.expandShapes (maNode);
+ }
+ }
+
+ // This action expands all nodes in the subtree rooted in the specified node.
+ class SubtreeExpandAction extends AbstractAction
+ {
+ private AccessibilityTree maTree;
+ private AccTreeNode maNode;
+ public SubtreeExpandAction (AccessibilityTree aTree, AccTreeNode aNode)
+ {
+ super ("Expand Subtree");
+ maTree = aTree;
+ maNode = aNode;
+ }
+ public void actionPerformed (ActionEvent e)
+ {
+ maTree.expandAll (maNode);
+ }
+ }
+
+ /** Predicate class to determine whether a node should be expanded
+ * For use with expandTree method */
+ abstract class Expander
+ {
+ abstract public boolean expand (Object aObject);
+ }
+
+ /** expand all nodes */
+ class AllExpander extends Expander
+ {
+ public boolean expand(Object aObject) { return true; }
+ }
+
+ /** expand all nodes with accessibility roles > 100 */
+ class ShapeExpander extends Expander
+ {
+ public boolean expand (Object aObject)
+ {
+ if (aObject instanceof AccTreeNode)
+ {
+ AccTreeNode aNode = (AccTreeNode)aObject;
+ XAccessibleContext xContext = aNode.getContext();
+ if (xContext != null)
+ if (xContext.getAccessibleRole() >= 100)
+ return true;
+ }
+ return false;
+ }
+ }
+
+
+
+ protected AccessibleTreeCellRenderer
+ maCellRenderer;
+
+
+ private JTree
+ maTree;
+ private Canvas
+ maCanvas;
+ private boolean
+ mbFirstShapeSeen;
+ private int
+ mnExpandLevel;
+}
diff --git a/toolkit/test/accessibility/AccessibilityTreeModel.java b/toolkit/test/accessibility/AccessibilityTreeModel.java
new file mode 100644
index 000000000000..d4981e86b4a0
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibilityTreeModel.java
@@ -0,0 +1,513 @@
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreePath;
+
+
+import java.util.Vector;
+import java.util.HashMap;
+import java.util.Enumeration;
+
+import com.sun.star.accessibility.*;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.Any;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XServiceName;
+
+public class AccessibilityTreeModel
+ extends AccessibilityTreeModelBase
+{
+ public boolean mbVerbose = false;
+
+ public AccessibilityTreeModel (AccessibleTreeNode aRoot)
+ {
+ // create default node (unless we have a 'proper' node)
+ if( ! (aRoot instanceof AccessibleTreeNode) )
+ aRoot = new StringNode ("Root", null);
+ setRoot (aRoot);
+
+ maNodeMap = new NodeMap();
+
+ maEventListener = new EventListener (this);
+ mxListener = new QueuedListener (maEventListener);
+ }
+
+ public void clear ()
+ {
+ maNodeMap.Clear();
+ }
+
+ /** Lock the tree. While the tree is locked, events from the outside are
+ not processed. Lock the tree when you change its internal structure.
+ */
+ public void lock ()
+ {
+ mnLockCount += 1;
+ }
+
+ /** Unlock the tree. After unlocking the tree as many times as locking
+ it, a treeStructureChange event is sent to the event listeners.
+ @param aNodeHint
+ If not null and treeStructureChange events are thrown then this
+ node is used as root of the modified subtree.
+ */
+ public void unlock (AccessibleTreeNode aNodeHint)
+ {
+ mnLockCount -= 1;
+ if (mnLockCount == 0)
+ fireTreeStructureChanged (
+ new TreeModelEvent (this,
+ new TreePath (aNodeHint.createPath())));
+ }
+
+
+
+
+ /** Inform all listeners (especially the renderer) of a change of the
+ tree's structure.
+ @param aNode This node specifies the sub tree in which all changes
+ take place.
+ */
+ public void FireTreeStructureChanged (AccessibleTreeNode aNode)
+ {
+ }
+
+
+
+
+
+ public synchronized void setRoot (AccessibleTreeNode aRoot)
+ {
+ if (getRoot() == null)
+ super.setRoot (aRoot);
+ else
+ {
+ lock ();
+ maNodeMap.ForEach (new NodeMapCallback () {
+ public void Apply (AccTreeNode aNode)
+ {
+ if (maCanvas != null)
+ maCanvas.removeNode (aNode);
+ removeAccListener ((AccTreeNode)aNode);
+ }
+ });
+ maNodeMap.Clear ();
+
+ setRoot (aRoot);
+ unlock (aRoot);
+ }
+ }
+
+
+ //
+ // child management:
+ //
+
+
+
+ /** Delegate the request to the parent and then register listeners at
+ the child and add the child to the canvas.
+ */
+ public Object getChild (Object aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = (AccessibleTreeNode)super.getChild (aParent, nIndex);
+
+ if (aChild == null)
+ System.out.println ("getChild: child not found");
+ else
+ // Keep translation table up-to-date.
+ addNode (aChild);
+
+ return aChild;
+ }
+
+ public Object getChildNoCreate (Object aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = (AccessibleTreeNode)super.getChildNoCreate (aParent, nIndex);
+
+ return aChild;
+ }
+
+
+
+
+ /** Remove a node (and all children) from the tree model.
+ */
+ protected boolean removeChild (AccessibleTreeNode aNode)
+ {
+ try
+ {
+ if( aNode == null )
+ {
+ System.out.println ("can't remove null node");
+ return false;
+ }
+ else
+ {
+ // depth-first removal of children
+ while (aNode.getChildCount() > 0)
+ if ( ! removeChild (aNode.getChildNoCreate (0)))
+ break;
+
+ // Remove node from its parent.
+ AccessibleTreeNode aParent = aNode.getParent();
+ if (aParent != null)
+ {
+ int nIndex = aParent.indexOf(aNode);
+ aParent.removeChild (nIndex);
+ }
+
+ maNodeMap.RemoveNode (aNode);
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while removing child "
+ + aNode + " : " + e);
+ e.printStackTrace ();
+ return false;
+ }
+ return true;
+ }
+
+ public void removeNode (XAccessibleContext xNode)
+ {
+ if (xNode != null)
+ {
+ AccessibleTreeNode aNode = maNodeMap.GetNode (xNode);
+ AccessibleTreeNode aRootNode = (AccessibleTreeNode)getRoot();
+ TreeModelEvent aEvent = createEvent (aRootNode, aNode);
+ removeChild (aNode);
+ if (mbVerbose)
+ System.out.println (aNode);
+ fireTreeNodesRemoved (aEvent);
+ maCanvas.repaint ();
+ }
+ }
+
+
+ /** Add add a new child to a parent.
+ @return
+ Returns the new or existing representation of the specified
+ accessible object.
+ */
+ protected AccessibleTreeNode addChild (AccTreeNode aParentNode, XAccessible xNewChild)
+ {
+ AccessibleTreeNode aChildNode = null;
+ try
+ {
+ boolean bRet = false;
+
+ // First make sure that the accessible object does not already have
+ // a representation.
+ aChildNode = maNodeMap.GetNode(xNewChild);
+ if (aChildNode == null)
+ aChildNode = aParentNode.addAccessibleChild (xNewChild);
+ else
+ System.out.println ("node already present");
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while adding child "
+ + xNewChild + " to parent " + aParentNode + ": " + e);
+ e.printStackTrace ();
+ }
+ return aChildNode;
+ }
+
+ public void addChild (XAccessibleContext xParent, XAccessible xChild)
+ {
+ AccessibleTreeNode aParentNode = maNodeMap.GetNode (xParent);
+ if (aParentNode instanceof AccTreeNode)
+ {
+ AccessibleTreeNode aChild = addChild ((AccTreeNode)aParentNode, xChild);
+ if (addNode (aChild))
+ {
+ if (maCanvas != null)
+ maCanvas.updateNode ((AccTreeNode)aParentNode);
+
+ // A call to fireTreeNodesInserted for xNew
+ // should be sufficient but at least the
+ // StringNode object that contains the number of
+ // children also changes and we do not know its
+ // index relative to its parent. Therefore the
+ // more expensive fireTreeStructureChanged is
+ // necessary.
+ fireTreeNodesInserted (createEvent (xParent, xChild));
+ updateNode (xParent, AccessibleTreeHandler.class);
+ }
+ maCanvas.repaint ();
+ }
+ }
+
+
+ /** Add the child node to the internal tree structure.
+ @param aNode
+ The node to insert into the internal tree structure.
+ */
+ protected boolean addNode (AccessibleTreeNode aNode)
+ {
+ boolean bRet = false;
+ try
+ {
+ if ( ! maNodeMap.ValueIsMember (aNode))
+ {
+ if (aNode instanceof AccTreeNode)
+ {
+ AccTreeNode aChild = (AccTreeNode)aNode;
+ XAccessibleContext xChild = aChild.getContext();
+ registerAccListener (aChild);
+ if (maCanvas != null)
+ maCanvas.addNode (aChild);
+ maNodeMap.InsertNode (xChild, aChild);
+ }
+ bRet = true;
+ }
+
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while adding node "
+ + aNode + ": " + e);
+ e.printStackTrace ();
+ }
+ return bRet;
+ }
+
+
+
+
+ /** create path to node, suitable for TreeModelEvent constructor
+ * @see javax.swing.event.TreeModelEvent#TreeModelEvent
+ */
+ protected Object[] createPath (AccessibleTreeNode aNode)
+ {
+ Vector aPath = new Vector();
+ aNode.createPath (aPath);
+ return aPath.toArray();
+ }
+
+ //
+ // listeners (and helper methods)
+ //
+ // We are registered with listeners as soon as objects are in the
+ // tree cache, and we should get removed as soon as they are out.
+ //
+
+ protected void fireTreeNodesChanged(TreeModelEvent e)
+ {
+ for(int i = 0; i < maTMListeners.size(); i++)
+ {
+ ((TreeModelListener)maTMListeners.get(i)).treeNodesChanged(e);
+ }
+ }
+
+ protected void fireTreeNodesInserted(final TreeModelEvent e)
+ {
+ for(int i = 0; i < maTMListeners.size(); i++)
+ {
+ ((TreeModelListener)maTMListeners.get(i)).treeNodesInserted(e);
+ }
+ }
+
+ protected void fireTreeNodesRemoved(final TreeModelEvent e)
+ {
+ for(int i = 0; i < maTMListeners.size(); i++)
+ {
+ ((TreeModelListener)maTMListeners.get(i)).treeNodesRemoved(e);
+ }
+ }
+
+ protected void fireTreeStructureChanged(final TreeModelEvent e)
+ {
+ for(int i = 0; i < maTMListeners.size(); i++)
+ {
+ ((TreeModelListener)maTMListeners.get(i)).treeStructureChanged(e);
+ }
+ }
+
+ protected TreeModelEvent createEvent (XAccessibleContext xParent)
+ {
+ AccessibleTreeNode aParentNode = maNodeMap.GetNode (xParent);
+ return new TreeModelEvent (this, createPath (aParentNode));
+ }
+
+ /** Create a TreeModelEvent object that informs listeners that one child
+ has been removed from or inserted into its parent.
+ */
+ public TreeModelEvent createEvent (XAccessibleContext xParent, XAccessible xChild)
+ {
+ AccessibleTreeNode aParentNode = maNodeMap.GetNode (xParent);
+ return createEvent (aParentNode, xParent);
+ }
+
+ public TreeModelEvent createEvent (AccessibleTreeNode aParentNode, XAccessibleContext xChild)
+ {
+ AccessibleTreeNode aChildNode = null;
+ if (xChild != null)
+ aChildNode = maNodeMap.GetNode (xChild);
+ return createEvent (aParentNode, aChildNode);
+ }
+
+
+
+ protected TreeModelEvent createEvent (
+ AccessibleTreeNode aParentNode,
+ AccessibleTreeNode aChildNode)
+ {
+ Object[] aPathToParent = createPath (aParentNode);
+
+ int nIndexInParent = -1;
+ if (aChildNode != null)
+ nIndexInParent = aParentNode.indexOf (aChildNode);
+ if (mbVerbose)
+ System.out.println (aChildNode + " " + nIndexInParent);
+
+ if (nIndexInParent == -1)
+ // This event may be passed only to treeStructureChanged of the listeners.
+ return new TreeModelEvent (this,
+ aPathToParent);
+ else
+ // General purpose event for removing or inserting known nodes.
+ return new TreeModelEvent (this,
+ aPathToParent,
+ new int[] {nIndexInParent},
+ new Object[] {aChildNode} );
+ }
+
+
+
+
+ /** Create a TreeModelEvent that indicates changes at those children of
+ the specified node with the specified indices.
+ */
+ protected TreeModelEvent createChangeEvent (AccTreeNode aNode, Vector aChildIndices)
+ {
+ // Build a list of child objects that are indicated by the given indices.
+ int nCount = aChildIndices.size();
+ Object aChildObjects[] = new Object[nCount];
+ int nChildIndices[] = new int[nCount];
+ for (int i=0; i<nCount; i++)
+ {
+ int nIndex = ((Integer)aChildIndices.elementAt(i)).intValue();
+ aChildObjects[i] = aNode.getChild (nIndex);
+ nChildIndices[i] = nIndex;
+ }
+
+ return new TreeModelEvent (this,
+ createPath(aNode),
+ nChildIndices,
+ aChildObjects);
+ }
+
+
+
+ /**
+ * broadcast a tree event in a seperate Thread
+ * must override fire method
+ */
+ class EventRunner implements Runnable
+ {
+ public void run()
+ {
+ for(int i = 0; i < maTMListeners.size(); i++)
+ {
+ fire( (TreeModelListener)maTMListeners.get(i) );
+ }
+ }
+
+ protected void fire( TreeModelListener l) { }
+ }
+
+
+
+ protected XAccessibleEventBroadcaster getBroadcaster (Object aObject)
+ {
+ if (aObject instanceof AccTreeNode)
+ return (XAccessibleEventBroadcaster) UnoRuntime.queryInterface (
+ XAccessibleEventBroadcaster.class, ((AccTreeNode)aObject).getContext());
+ else
+ return null;
+ }
+
+ protected void registerAccListener( Object aObject )
+ {
+ // register this as listener for XAccessibleEventBroadcaster
+ // implementations
+ XAccessibleEventBroadcaster xBroadcaster = getBroadcaster( aObject );
+ if (xBroadcaster != null)
+ {
+ xBroadcaster.addEventListener( mxListener );
+ }
+ }
+
+ protected void removeAccListener( Object aObject )
+ {
+ XAccessibleEventBroadcaster xBroadcaster = getBroadcaster( aObject );
+ if (xBroadcaster != null)
+ {
+ xBroadcaster.removeEventListener( mxListener );
+ }
+ }
+
+
+
+ public void setCanvas (Canvas aCanvas)
+ {
+ maCanvas = aCanvas;
+ }
+
+ public Canvas getCanvas ()
+ {
+ return maCanvas;
+ }
+
+ public void updateNode (XAccessibleContext xSource, java.lang.Class class1)
+ {
+ updateNode (xSource, class1,null);
+ }
+
+ /** Get a list of children of the node associated with xSource that are
+ affected by the given handlers. Fire events that these children may
+ have changed in the tree view. Update the canvas representation of
+ xSource.
+ */
+ public AccTreeNode updateNode (XAccessibleContext xSource,
+ java.lang.Class class1, java.lang.Class class2)
+ {
+ AccessibleTreeNode aTreeNode = maNodeMap.GetNode (xSource);
+ AccTreeNode aNode = null;
+ if (mbVerbose)
+ System.out.println ("updating node " + xSource + " " + aTreeNode);
+ if (aTreeNode instanceof AccTreeNode)
+ {
+ aNode = (AccTreeNode) aTreeNode;
+ // Get list of affected children.
+ Vector aChildIndices = (aNode).updateChildren (
+ class1, class2);
+ // Fire events that these children may have changed.
+ fireTreeNodesChanged (
+ createChangeEvent (aNode, aChildIndices));
+ }
+ return aNode;
+ }
+
+ /** The listener to be registered with the accessible objects.
+ * Could be set to 'this' for same-thread event delivery, or to an
+ * instance of QueuedListener for multi-threaded delivery. May
+ * not be changed, since this would trip the
+ * register/removeAccListener logic. */
+ private final XAccessibleEventListener mxListener;
+
+ // Map to translate from accessible object to corresponding tree node.
+ private NodeMap maNodeMap;
+
+ // If the lock count is higher then zero, then no events are processed.
+ private int mnLockCount;
+
+ private Canvas maCanvas;
+
+ private EventListener maEventListener;
+}
diff --git a/toolkit/test/accessibility/AccessibilityTreeModelBase.java b/toolkit/test/accessibility/AccessibilityTreeModelBase.java
new file mode 100644
index 000000000000..e80819bef840
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibilityTreeModelBase.java
@@ -0,0 +1,122 @@
+import javax.swing.tree.TreeModel;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreePath;
+import javax.swing.event.TreeModelEvent;
+import java.util.Vector;
+
+public class AccessibilityTreeModelBase
+ implements TreeModel
+{
+ public AccessibilityTreeModelBase ()
+ {
+ setRoot (null);
+ maTMListeners = new Vector();
+ }
+
+ public synchronized void addTreeModelListener(TreeModelListener l)
+ {
+ maTMListeners.add(l);
+ }
+
+ public synchronized void removeTreeModelListener(TreeModelListener l)
+ {
+ maTMListeners.remove(l);
+ }
+
+ public synchronized int getChildCount(Object aParent)
+ {
+ return (aParent instanceof AccessibleTreeNode) ?
+ ((AccessibleTreeNode)aParent).getChildCount() : 0;
+ }
+
+ public synchronized Object getChild (Object aParent, int nIndex)
+ {
+ Object aChild = null;
+ try
+ {
+ if (aParent != null && aParent instanceof AccessibleTreeNode)
+ aChild = ((AccessibleTreeNode)aParent).getChild(nIndex);
+ else
+ System.out.println ("getChild called for unknown parent node");
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ aChild = ("no child " + nIndex + " from " + aParent + ": " + e);
+ }
+ return aChild;
+ }
+
+ public synchronized Object getChildNoCreate (Object aParent, int nIndex)
+ {
+ Object aChild = null;
+ try
+ {
+ if (aParent != null && aParent instanceof AccessibleTreeNode)
+ aChild = ((AccessibleTreeNode)aParent).getChildNoCreate(nIndex);
+ else
+ System.out.println ("getChild called for unknown parent node");
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ { }
+ return aChild;
+ }
+
+ /** iterate over all children and look for child */
+ public synchronized int getIndexOfChild (Object aParent, Object aChild)
+ {
+ int nIndex = -1;
+ try
+ {
+ if ((aParent instanceof AccessibleTreeNode) && (aChild instanceof AccessibleTreeNode))
+ {
+ AccessibleTreeNode aParentNode = (AccessibleTreeNode) aParent;
+ AccessibleTreeNode aChildNode = (AccessibleTreeNode) aChild;
+
+ int nChildCount = aParentNode.getChildCount();
+ for( int i = 0; i < nChildCount; i++ )
+ {
+ if (aChildNode.equals (aParentNode.getChild (i)))
+ {
+ nIndex = i;
+ break;
+ }
+ }
+ }
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ // Return -1 by falling through.
+ }
+
+ // not found?
+ return nIndex;
+ }
+
+ public boolean isLeaf (Object aNode)
+ {
+ return (aNode instanceof AccessibleTreeNode) ?
+ ((AccessibleTreeNode)aNode).isLeaf() : true;
+ }
+
+
+
+ public synchronized Object getRoot()
+ {
+ return maRoot;
+ }
+
+ public void valueForPathChanged(TreePath path, Object newValue)
+ { }
+
+ protected synchronized void setRoot (AccessibleTreeNode aRoot)
+ {
+ maRoot = aRoot;
+ }
+
+
+ // The list of TreeModelListener objects.
+ protected Vector maTMListeners;
+
+ // The root node of the tree. Use setRoot to change it.
+ private AccessibleTreeNode maRoot = null;
+}
diff --git a/toolkit/test/accessibility/AccessibilityWorkBench.java b/toolkit/test/accessibility/AccessibilityWorkBench.java
new file mode 100755
index 000000000000..58ad607fed67
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibilityWorkBench.java
@@ -0,0 +1,620 @@
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.PropertyChangeEvent;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.document.XEventListener;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawView;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XFrameActionListener;
+import com.sun.star.frame.FrameActionEvent;
+import com.sun.star.frame.FrameAction;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XTerminateListener;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleExtendedComponent;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.accessibility.XAccessibleStateSet;
+
+import com.sun.star.awt.XExtendedToolkit;
+
+import java.util.Vector;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.tree.*;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.event.TreeSelectionEvent;
+import java.io.*;
+
+import ov.ObjectViewContainer;
+
+/** 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 ActionListener, XTerminateListener, TreeSelectionListener
+
+{
+ public static final String msVersion = "v1.7.2";
+ public String msOptionsFileName = ".AWBrc";
+
+ public static void main (String args[])
+ {
+ int nPortNumber = 5678;
+
+ 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 <port-number> Port on which to connect to StarOffice.");
+ System.out.println (" Defaults to 5678.");
+ System.exit (0);
+ }
+ else if (args[i].equals ("-p"))
+ {
+ nPortNumber = Integer.parseInt (args[++i]);
+ }
+ }
+
+ saWorkBench = new AccessibilityWorkBench (nPortNumber);
+ }
+
+
+
+
+ /** 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 (int nPortNumber)
+ {
+ mbInitialized = false;
+
+ Layout ();
+
+ MessageArea.println (System.getProperty ("os.name") + " / "
+ + System.getProperty ("os.arch") + " / "
+ + System.getProperty ("os.version"));
+ MessageArea.println ("Using port " + nPortNumber);
+ office = new SimpleOffice (nPortNumber);
+ info = new InformationWriter ();
+
+ maAccessibilityTree.getComponent().addTreeSelectionListener (this);
+
+ addWindowListener (new WindowAdapter ()
+ { public void windowClosing (WindowEvent e)
+ { System.exit(0); }
+ });
+
+ initialize ();
+ }
+
+
+
+
+ /** Create and arrange the widgets of the GUI.
+ */
+ public void Layout ()
+ {
+ setSize (new Dimension (8000,600));
+
+ JScrollPane aScrollPane;
+ GridBagConstraints constraints;
+
+ // Create new layout.
+ GridBagLayout aLayout = new GridBagLayout ();
+ getContentPane().setLayout (aLayout);
+
+ // Accessible Tree.
+ maAccessibilityTree = new AccessibilityTree ();
+ // maAccessibilityTree.getComponent().setMinimumSize (new Dimension (250,300));
+ JScrollPane aTreeScrollPane = new JScrollPane(
+ maAccessibilityTree.getComponent(),
+ JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
+ JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+ aTreeScrollPane.setPreferredSize (new Dimension (400,300));
+
+ // Object view shows details about the currently selected accessible
+ // object.
+ maObjectViewContainer = new ObjectViewContainer ();
+ // maObjectViewContainer.setPreferredSize (new Dimension (300,100));
+ JScrollPane aObjectViewContainerScrollPane = new JScrollPane(
+ maObjectViewContainer,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ aObjectViewContainerScrollPane.setPreferredSize (new Dimension (400,300));
+
+ // Split pane for tree view and object view.
+ JSplitPane aLeftViewSplitPane = new JSplitPane (
+ JSplitPane.VERTICAL_SPLIT,
+ aTreeScrollPane,
+ aObjectViewContainerScrollPane
+ );
+ aLeftViewSplitPane.setDividerLocation (300);
+
+ // Canvas.
+ maCanvas = new Canvas ();
+ maCanvas.setTree (maAccessibilityTree.getComponent());
+ maAccessibilityTree.SetCanvas (maCanvas);
+ JScrollPane aScrolledCanvas = new JScrollPane(maCanvas,
+ JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
+ aScrolledCanvas.getViewport().setBackground (Color.RED);
+ aScrolledCanvas.setPreferredSize (new 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);
+
+ // Text output area.
+ maMessageArea = MessageArea.Instance ();
+ // maMessageArea.setPreferredSize (new Dimension (300,50));
+
+ // Split pane for the two views and the message area.
+ JSplitPane aSplitPane = new JSplitPane (JSplitPane.VERTICAL_SPLIT,
+ aViewSplitPane, maMessageArea);
+ aSplitPane.setOneTouchExpandable(true);
+ addGridElement (aViewSplitPane, 0,0, 2,1, 3,3,
+ GridBagConstraints.CENTER, GridBagConstraints.BOTH);
+
+ // Button bar.
+ maButtonBar = new JPanel();
+ GridBagLayout aButtonLayout = new GridBagLayout ();
+ maButtonBar.setLayout (new FlowLayout());
+ addGridElement (maButtonBar, 0,3, 2,1, 1,0,
+ GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL);
+
+ // Buttons.
+ aConnectButton = createButton ("Connect", "connect");
+ aUpdateButton = createButton ("Update", "update");
+ aShapesButton = createButton ("Expand Shapes", "shapes");
+ aExpandButton = createButton ("Expand All", "expand");
+ aQuitButton = createButton ("Quit", "quit");
+ UpdateButtonStates ();
+
+ Options.Instance().Load (msOptionsFileName);
+
+ setJMenuBar (CreateMenuBar ());
+
+ setTitle("Accessibility Workbench " + msVersion);
+
+ pack ();
+ setVisible (true);
+ 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>.
+ */
+ 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 ();
+ JRadioButtonMenuItem aRadioButton = new JRadioButtonMenuItem ("Whole Screen");
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("200%");
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("100%");
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("50%");
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("25%");
+ aGroup.add (aRadioButton);
+ aViewMenu.add (aRadioButton);
+ aRadioButton.addActionListener (this);
+ aRadioButton = new JRadioButtonMenuItem ("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", maCanvas.getShowDescriptions());
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Show Names", maCanvas.getShowNames());
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Show Text", maCanvas.getShowText());
+ aOptionsMenu.add (aCBItem);
+ aCBItem.addActionListener (this);
+
+ aCBItem = new JCheckBoxMenuItem ("Antialiased Rendering", maCanvas.getAntialiasing());
+ 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.clear();
+
+ AccessibilityTreeModel aModel = null;
+ aModel = new AccessibilityTreeModel (createTreeModelRoot());
+
+ aModel.setCanvas (maCanvas);
+ maAccessibilityTree.getComponent().setModel (aModel);
+
+ if (office != null)
+ {
+ // Add terminate listener.
+ if (office.getDesktop() != null)
+ office.getDesktop().addTerminateListener (this);
+
+ XExtendedToolkit xToolkit = office.getExtendedToolkit();
+ // Remove old top window listener.
+ if (maTopWindowListener != null)
+ xToolkit.removeTopWindowListener (maQueuedTopWindowListener);
+ // Add top window listener.
+ if (xToolkit != null)
+ {
+ MessageArea.println ("registering at extended toolkit");
+ maTopWindowListener = new TopWindowListener (aModel, office);
+ maQueuedTopWindowListener = new QueuedTopWindowListener (maTopWindowListener);
+ xToolkit.addTopWindowListener (maQueuedTopWindowListener);
+ maTopWindowListener.Initialize ();
+ }
+ else
+ maTopWindowListener = null;
+ }
+
+ mbInitialized = true;
+ UpdateButtonStates ();
+ }
+
+
+
+
+ /** Update the states of the buttons according to the internal state of
+ the AWB.
+ */
+ protected void UpdateButtonStates ()
+ {
+ aConnectButton.setEnabled (mbInitialized);
+ aQuitButton.setEnabled (mbInitialized);
+ aUpdateButton.setEnabled (mbInitialized);
+ aExpandButton.setEnabled (mbInitialized);
+ aShapesButton.setEnabled (mbInitialized);
+ }
+
+
+
+ /** Callback for GUI actions from the buttons.
+ */
+ public void actionPerformed (java.awt.event.ActionEvent e)
+ {
+ if (e.getActionCommand().equals("connect"))
+ {
+ office.connect();
+ initialize ();
+ }
+ else if (e.getActionCommand().equals("quit"))
+ {
+ AccessibilityTreeModel aModel = (AccessibilityTreeModel)maAccessibilityTree.getComponent().getModel();
+ aModel.clear();
+ System.exit (0);
+ }
+ else if (e.getActionCommand().equals("update"))
+ {
+ initialize ();
+ }
+ else if (e.getActionCommand().equals("shapes"))
+ {
+ Cursor aCursor = getCursor();
+ setCursor (new Cursor (Cursor.WAIT_CURSOR));
+ maAccessibilityTree.expandShapes();
+ setCursor (aCursor);
+ }
+ else if (e.getActionCommand().equals("expand"))
+ {
+ Cursor aCursor = getCursor();
+ setCursor (new Cursor (Cursor.WAIT_CURSOR));
+ maAccessibilityTree.expandAll();
+ setCursor (aCursor);
+ }
+ else if (e.getActionCommand().equals ("Quit"))
+ {
+ System.out.println ("exiting");
+ System.exit (0);
+ }
+ else if (e.getActionCommand().equals ("Show Descriptions"))
+ {
+ maCanvas.setShowDescriptions ( ! maCanvas.getShowDescriptions());
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("Show Names"))
+ {
+ maCanvas.setShowNames ( ! maCanvas.getShowNames());
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("Antialiased Rendering"))
+ {
+ maCanvas.setAntialiasing ( ! maCanvas.getAntialiasing());
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("Help"))
+ {
+ HelpWindow.Instance().loadFile ("help.html");
+ }
+ else if (e.getActionCommand().equals ("News"))
+ {
+ try{
+ HelpWindow.Instance().loadFile ("news.html");
+ } catch (Exception ex) {}
+ }
+ else if (e.getActionCommand().equals ("About"))
+ {
+ HelpWindow.Instance().loadFile ("about.html");
+ }
+ else if (e.getActionCommand().equals ("Whole Screen"))
+ {
+ maCanvas.setZoomMode (Canvas.WHOLE_SCREEN);
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("200%"))
+ {
+ maCanvas.setZoomMode (200);
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("100%"))
+ {
+ maCanvas.setZoomMode (100);
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("50%"))
+ {
+ maCanvas.setZoomMode (50);
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("25%"))
+ {
+ maCanvas.setZoomMode (25);
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else if (e.getActionCommand().equals ("10%"))
+ {
+ maCanvas.setZoomMode (10);
+ Options.Instance().Save (msOptionsFileName);
+ }
+ else
+ {
+ System.err.println("unknown command " + e.getActionCommand());
+ }
+ }
+
+
+
+
+ /** Create an AccessibilityTreeModel root which contains the documents
+ (top windows) that are present at the moment.
+ */
+ private AccessibleTreeNode createTreeModelRoot()
+ {
+ // create root node
+ VectorNode aRoot = new VectorNode ("Accessibility Tree", null);
+ if (maTopWindowListener != null)
+ maTopWindowListener.Initialize ();
+ return aRoot;
+ }
+
+
+ // TreeSelectionListener
+ public void valueChanged (TreeSelectionEvent aEvent)
+ {
+ TreePath aPath = aEvent.getPath();
+ Object aObject = aPath.getLastPathComponent();
+ if (aObject instanceof AccTreeNode)
+ {
+ AccTreeNode aNode = (AccTreeNode) aObject;
+ XAccessibleContext xContext = aNode.getContext();
+ maObjectViewContainer.SetObject (xContext);
+ }
+ }
+
+
+
+
+ // XEventListener
+ public void disposing( com.sun.star.lang.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 com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ System.out.println ("Terminate Event : " + aEvent);
+ }
+
+
+
+
+ // XTerminateListener
+ public void notifyTermination (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ System.out.println ("Notifiy Termination Event : " + aEvent);
+ }
+
+
+
+ /// The Singleton Workbench object.
+ private static AccessibilityWorkBench
+ saWorkBench = null;
+
+ protected SimpleOffice
+ office;
+ protected InformationWriter
+ info;
+
+ private XModel
+ mxModel;
+ private JPanel
+ maMainPanel,
+ maButtonBar;
+ private Canvas
+ maCanvas;
+ private AccessibilityTree
+ maAccessibilityTree;
+ private ObjectViewContainer
+ maObjectViewContainer;
+ private JScrollPane
+ maScrollPane;
+ private MessageArea
+ maMessageArea;
+ private JButton
+ aConnectButton,
+ aQuitButton,
+ aUpdateButton,
+ aExpandButton,
+ aShapesButton;
+ private JMenuBar
+ maMenuBar;
+ private String
+ msMessage;
+ private boolean
+ mbInitialized;
+ private TopWindowListener
+ maTopWindowListener;
+ private QueuedTopWindowListener
+ maQueuedTopWindowListener;
+}
diff --git a/toolkit/test/accessibility/AccessibleActionHandler.java b/toolkit/test/accessibility/AccessibleActionHandler.java
new file mode 100644
index 000000000000..0aac7158efde
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleActionHandler.java
@@ -0,0 +1,72 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+class AccessibleActionHandler
+ extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleAction xEComponent =
+ (XAccessibleAction) UnoRuntime.queryInterface (
+ XAccessibleAction.class, xContext);
+ if (xEComponent != null)
+ return new AccessibleActionHandler (xEComponent);
+ else
+ return null;
+ }
+
+ public AccessibleActionHandler ()
+ {
+ }
+
+ public AccessibleActionHandler (XAccessibleAction xAction)
+ {
+ if (xAction != null)
+ maChildList.setSize (1 + xAction.getAccessibleActionCount());
+ }
+
+ protected static XAccessibleAction getAction (AccTreeNode aParent)
+ {
+ return (XAccessibleAction) UnoRuntime.queryInterface (
+ XAccessibleAction.class, aParent.getContext());
+ }
+
+ public AccessibleTreeNode createChild (
+ AccessibleTreeNode aParent,
+ int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+
+ if (aParent instanceof AccTreeNode)
+ {
+ XAccessibleAction xAction = getAction ((AccTreeNode)aParent);
+ if( xAction != null )
+ {
+ if (nIndex == 0)
+ aChild = new StringNode ("Number of actions: " + xAction.getAccessibleActionCount(),
+ aParent);
+ else
+ {
+ nIndex -= 1;
+ try
+ {
+ aChild = new AccessibleActionNode (
+ "Action " + nIndex + " : "
+ + xAction.getAccessibleActionDescription (nIndex),
+ aParent,
+ nIndex);
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aChild = new StringNode ("ERROR", aParent);
+ }
+ }
+ }
+ }
+
+ return aChild;
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleActionNode.java b/toolkit/test/accessibility/AccessibleActionNode.java
new file mode 100644
index 000000000000..7c72ac69803e
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleActionNode.java
@@ -0,0 +1,48 @@
+import javax.swing.JOptionPane;
+import com.sun.star.accessibility.XAccessibleAction;
+
+/**
+ Base class for all tree nodes.
+ */
+class AccessibleActionNode
+ extends StringNode
+{
+ public AccessibleActionNode (String aDisplayObject,
+ AccessibleTreeNode aParent,
+ int nActionIndex)
+ {
+ super (aDisplayObject, aParent);
+ mnActionIndex = nActionIndex;
+ }
+
+ public String[] getActions ()
+ {
+ return new String[] {"Perform Action"};
+ }
+
+ /** perform action */
+ public void performAction (int nIndex)
+ {
+ if (nIndex != 0)
+ return;
+ boolean bResult = false;
+ if (getParent() instanceof AccTreeNode)
+ try
+ {
+ bResult = AccessibleActionHandler.getAction(
+ (AccTreeNode)getParent()).doAccessibleAction (
+ mnActionIndex);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ }
+
+ JOptionPane.showMessageDialog (null,
+ "performed action " + mnActionIndex
+ + (bResult?" with":" without") + " success",
+ "Action " + mnActionIndex,
+ JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ private int mnActionIndex;
+}
diff --git a/toolkit/test/accessibility/AccessibleCellHandler.java b/toolkit/test/accessibility/AccessibleCellHandler.java
new file mode 100644
index 000000000000..19b4a9df67ad
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleCellHandler.java
@@ -0,0 +1,156 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleTable;
+import com.sun.star.accessibility.XAccessible;
+
+
+class AccessibleCellHandler extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ AccessibleCellHandler aCellHandler = null;
+ if (xContext != null)
+ {
+ XAccessible xParent = xContext.getAccessibleParent();
+ if (xParent != null)
+ {
+ XAccessibleTable xTable =
+ (XAccessibleTable) UnoRuntime.queryInterface (
+ XAccessibleTable.class, xParent.getAccessibleContext());
+ if (xTable != null)
+ aCellHandler = new AccessibleCellHandler (xTable);
+ }
+ }
+ return aCellHandler;
+
+ }
+
+ public AccessibleCellHandler ()
+ {
+ }
+
+ public AccessibleCellHandler (XAccessibleTable xTable)
+ {
+ if (xTable != null)
+ maChildList.setSize (8);
+ }
+
+ protected static XAccessibleTable getTable(Object aObject)
+ {
+ return (XAccessibleTable) UnoRuntime.queryInterface (
+ XAccessibleTable.class, aObject);
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+ XAccessibleTable xTable = null;
+ XAccessibleContext xContext = null;
+ AccessibleTreeNode aGrandParent = aParent.getParent();
+ if (aGrandParent instanceof AccTreeNode)
+ {
+ xTable = ((AccTreeNode)aGrandParent).getTable();
+ xContext = ((AccTreeNode)aGrandParent).getContext();
+ }
+ if (aParent instanceof AccTreeNode)
+ {
+ xContext = ((AccTreeNode)aParent).getContext();
+ }
+ try
+ {
+ if( xTable != null && xContext != null )
+ {
+ switch( nIndex )
+ {
+ case 0:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nRow = xTable.getAccessibleRow( nChild );
+
+ aChild = new StringNode ("# table row: " + nRow, aParent);
+ }
+ break;
+ case 1:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nCol = xTable.getAccessibleColumn( nChild );
+
+ aChild = new StringNode ("# table column: " + nCol, aParent);
+ }
+ break;
+ case 2:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nRow = xTable.getAccessibleRow( nChild );
+ int nCol = xTable.getAccessibleColumn( nChild );
+ int nExt = xTable.getAccessibleRowExtentAt( nRow, nCol );
+
+ aChild = new StringNode ("# table row extend: " + nExt, aParent);
+ }
+ break;
+ case 3:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nRow = xTable.getAccessibleRow( nChild );
+ int nCol = xTable.getAccessibleColumn( nChild );
+ int nExt = xTable.getAccessibleColumnExtentAt( nRow, nCol );
+
+ aChild = new StringNode ("# table column extend: " + nExt, aParent);
+ }
+ break;
+ case 4:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nRow = xTable.getAccessibleRow( nChild );
+ int nCol = xTable.getAccessibleColumn( nChild );
+ XAccessible xChild =
+ xTable.getAccessibleCellAt( nRow, nCol );
+
+ aChild = new StringNode ("# cell name retrieved from table: " + xChild.getAccessibleContext().getAccessibleName(), aParent);
+ }
+ break;
+ case 5:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nRow = xTable.getAccessibleRow( nChild );
+ int nCol = xTable.getAccessibleColumn( nChild );
+ boolean bSelected =
+ xTable.isAccessibleSelected( nRow, nCol );
+
+ aChild = new StringNode ("cell is selected: " + bSelected, aParent);
+ }
+ break;
+ case 6:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nRow = xTable.getAccessibleRow( nChild );
+ boolean bSelected =
+ xTable.isAccessibleRowSelected( nRow );
+
+ aChild = new StringNode ("table row is selected: " + bSelected, aParent);
+ }
+ break;
+ case 7:
+ {
+ int nChild = xContext.getAccessibleIndexInParent();
+ int nCol = xTable.getAccessibleColumn( nChild );
+ boolean bSelected =
+ xTable.isAccessibleColumnSelected( nCol );
+
+ aChild = new StringNode ("table column is selected: " + bSelected, aParent);
+ }
+ break;
+ default:
+ aChild = new StringNode ("unknown child index " + nIndex, aParent);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // Return empty child.
+ }
+
+ return aChild;
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleComponentHandler.java b/toolkit/test/accessibility/AccessibleComponentHandler.java
new file mode 100644
index 000000000000..38e5545d23aa
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleComponentHandler.java
@@ -0,0 +1,102 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+
+
+class AccessibleComponentHandler
+ extends NodeHandler
+{
+
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleComponent xComponent =
+ (XAccessibleComponent) UnoRuntime.queryInterface (
+ XAccessibleComponent.class, xContext);
+ if (xComponent != null)
+ return new AccessibleComponentHandler (xComponent);
+ else
+ return null;
+
+ }
+
+ public AccessibleComponentHandler ()
+ {
+ }
+
+ public AccessibleComponentHandler (XAccessibleComponent xComponent)
+ {
+ if (xComponent != null)
+ maChildList.setSize (6);
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+ if (aParent instanceof AccTreeNode)
+ {
+ XAccessibleComponent xComponent =
+ ((AccTreeNode)aParent).getComponent();
+
+ if (xComponent != null)
+ {
+ int nColor;
+ switch (nIndex)
+ {
+ case 0:
+ com.sun.star.awt.Point aLocation = xComponent.getLocation();
+ aChild = new StringNode (
+ "Location: " + aLocation.X + ", " + aLocation.Y,
+ aParent);
+ break;
+ case 1:
+ com.sun.star.awt.Point aScreenLocation = xComponent.getLocationOnScreen();
+ aChild = new StringNode (
+ "Location on Screen: " + aScreenLocation.X + ", " + aScreenLocation.Y,
+ aParent);
+ break;
+ case 2:
+ com.sun.star.awt.Size aSize = xComponent.getSize();
+ aChild = new StringNode (
+ "Size: "+ aSize.Width + ", " + aSize.Height,
+ aParent);
+ break;
+ case 3:
+ com.sun.star.awt.Rectangle aBBox = xComponent.getBounds();
+ aChild = new StringNode (
+ "Bounding Box: "+ aBBox.X + ", " + aBBox.Y + ","
+ + aBBox.Width + ", " + aBBox.Height,
+ aParent);
+ break;
+ case 4:
+ nColor = xComponent.getForeground();
+ aChild = new StringNode ("Foreground color: R"
+ + (nColor>>16&0xff)
+ + "G" + (nColor>>8&0xff)
+ + "B" + (nColor>>0&0xff)
+ + "A" + (nColor>>24&0xff),
+ aParent);
+ break;
+ case 5:
+ nColor = xComponent.getBackground();
+ aChild = new StringNode ("Background color: R"
+ + (nColor>>16&0xff)
+ + "G" + (nColor>>8&0xff)
+ + "B" + (nColor>>0&0xff)
+ + "A" + (nColor>>24&0xff),
+ aParent);
+ break;
+ }
+ }
+ }
+ return aChild;
+ }
+
+ public void update (AccessibleTreeNode aNode)
+ {
+ maChildList.clear();
+ if (aNode instanceof AccTreeNode)
+ if (((AccTreeNode)aNode).getComponent() != null)
+ maChildList.setSize (4);
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleContextHandler.java b/toolkit/test/accessibility/AccessibleContextHandler.java
new file mode 100644
index 000000000000..fd22bcd5367f
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleContextHandler.java
@@ -0,0 +1,91 @@
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.container.XIndexAccess;
+import java.util.HashMap;
+
+import tools.NameProvider;
+
+class AccessibleContextHandler
+ extends NodeHandler
+{
+ protected int nChildrenCount;
+
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new AccessibleContextHandler (xContext);
+ else
+ return null;
+ }
+
+ public AccessibleContextHandler ()
+ {
+ super ();
+ }
+
+ public AccessibleContextHandler (XAccessibleContext xContext)
+ {
+ super();
+ if (xContext != null)
+ maChildList.setSize (4);
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ XAccessibleContext xContext = null;
+ if (aParent instanceof AccTreeNode)
+ xContext = ((AccTreeNode)aParent).getContext();
+
+ String sChild = new String();
+ if (xContext != null)
+ {
+ switch( nIndex )
+ {
+ case 0:
+ sChild = "Description: " +
+ xContext.getAccessibleDescription();
+ break;
+ case 1:
+ int nRole = xContext.getAccessibleRole();
+ sChild = "Role: " + nRole + " (" + NameProvider.getRoleName(nRole) + ")";
+ break;
+ case 2:
+ XAccessible xParent = xContext.getAccessibleParent();
+ sChild = "Has parent: " + (xParent!=null ? "yes" : "no");
+ /* if (xParent != ((AccTreeNode)aParent).getAccessible())
+ {
+ sChild += " but that is inconsistent"
+ + "#" + xParent + " # " + ((AccTreeNode)aParent).getAccessible();
+ }
+ */
+ break;
+ case 3:
+ sChild = "";
+ XAccessibleStateSet xStateSet =
+ xContext.getAccessibleStateSet();
+ if (xStateSet != null)
+ {
+ for (short i=0; i<=30; i++)
+ {
+ if (xStateSet.contains (i))
+ {
+ if (sChild.compareTo ("") != 0)
+ sChild += ", ";
+ sChild += NameProvider.getStateName(i);
+ }
+ }
+ }
+ else
+ sChild += "no state set";
+ sChild = "State set: " + sChild;
+
+ /* case 3:
+ sChild = "Child count: " + xContext.getAccessibleChildCount();
+ break;*/
+ }
+ }
+ return new StringNode (sChild, aParent);
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleEditableTextHandler.java b/toolkit/test/accessibility/AccessibleEditableTextHandler.java
new file mode 100644
index 000000000000..a79158c099ba
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleEditableTextHandler.java
@@ -0,0 +1,40 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEditableText;
+
+
+class AccessibleEditableTextHandler extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleEditableText xText =
+ (XAccessibleEditableText) UnoRuntime.queryInterface (
+ XAccessibleEditableText.class, xContext);
+ if (xText != null)
+ return new AccessibleEditableTextHandler (xText);
+ else
+ return null;
+ }
+
+ public AccessibleEditableTextHandler ()
+ {
+ }
+
+ public AccessibleEditableTextHandler (XAccessibleEditableText xText)
+ {
+ if (xText != null)
+ maChildList.setSize (1);
+ }
+
+ protected static XAccessibleEditableText getEText (AccTreeNode aNode)
+ {
+ return (XAccessibleEditableText) UnoRuntime.queryInterface (
+ XAccessibleEditableText.class, aNode.getContext());
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ return new StringNode ("XAccessibleEditableText is supported", aParent);
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleExtendedComponentHandler.java b/toolkit/test/accessibility/AccessibleExtendedComponentHandler.java
new file mode 100644
index 000000000000..7f9fc17b23a5
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleExtendedComponentHandler.java
@@ -0,0 +1,73 @@
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleExtendedComponent;
+
+
+class AccessibleExtendedComponentHandler
+ extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleExtendedComponent xEComponent =
+ (XAccessibleExtendedComponent) UnoRuntime.queryInterface (
+ XAccessibleExtendedComponent.class, xContext);
+ if (xEComponent != null)
+ return new AccessibleExtendedComponentHandler (xEComponent);
+ else
+ return null;
+ }
+
+ public AccessibleExtendedComponentHandler ()
+ {
+ }
+
+ public AccessibleExtendedComponentHandler (XAccessibleExtendedComponent xEComponent)
+ {
+ if (xEComponent != null)
+ maChildList.setSize (0);
+ }
+
+ private static XAccessibleExtendedComponent getComponent (AccTreeNode aNode)
+ {
+ return (XAccessibleExtendedComponent) UnoRuntime.queryInterface (
+ XAccessibleExtendedComponent.class,
+ aNode.getContext());
+ }
+
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+ if (aParent instanceof AccTreeNode)
+ {
+ XAccessibleExtendedComponent xEComponent = getComponent ((AccTreeNode)aParent);
+
+ if (xEComponent != null)
+ {
+ int nColor;
+ switch( nIndex )
+ {
+ case 0:
+ nColor = xEComponent.getForeground();
+ aChild = new StringNode ("Depricated Foreground color: R"
+ + (nColor>>16&0xff)
+ + "G" + (nColor>>8&0xff)
+ + "B" + (nColor>>0&0xff)
+ + "A" + (nColor>>24&0xff),
+ aParent);
+ break;
+ case 1:
+ nColor = xEComponent.getBackground();
+ aChild = new StringNode ("Depricated Background color: R"
+ + (nColor>>16&0xff)
+ + "G" + (nColor>>8&0xff)
+ + "B" + (nColor>>0&0xff)
+ + "A" + (nColor>>24&0xff),
+ aParent);
+ break;
+ }
+ }
+ }
+ return aChild;
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleHyperlinkHandler.java b/toolkit/test/accessibility/AccessibleHyperlinkHandler.java
new file mode 100644
index 000000000000..674331317f7e
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleHyperlinkHandler.java
@@ -0,0 +1,42 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleHyperlink;
+
+
+class AccessibleHyperlinkHandler extends AccessibleTreeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleHyperlink xLink =
+ (XAccessibleHyperlink) UnoRuntime.queryInterface (
+ XAccessibleHyperlink.class, xContext);
+ if (xLink != null)
+ return new AccessibleHyperlinkHandler (xLink);
+ else
+ return null;
+ }
+
+ public AccessibleHyperlinkHandler ()
+ {
+ }
+
+ public AccessibleHyperlinkHandler (XAccessibleHyperlink xLink)
+ {
+ if (xLink != null)
+ maChildList.setSize (1);
+ }
+
+ protected XAccessibleHyperlink getHyperlink(Object aObject)
+ {
+ XAccessibleHyperlink xHyperlink =
+ (XAccessibleHyperlink) UnoRuntime.queryInterface (
+ XAccessibleHyperlink.class, aObject);
+ return xHyperlink;
+ }
+
+ public AccessibleTreeNode getChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ return new StringNode ("interface XAccessibleHyperlink is supported", aParent);
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleHypertextHandler.java b/toolkit/test/accessibility/AccessibleHypertextHandler.java
new file mode 100644
index 000000000000..aa703942bc4c
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleHypertextHandler.java
@@ -0,0 +1,42 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleHypertext;
+
+
+class AccessibleHypertextHandler extends AccessibleTreeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleHypertext xText =
+ (XAccessibleHypertext) UnoRuntime.queryInterface (
+ XAccessibleHypertext.class, xContext);
+ if (xText != null)
+ return new AccessibleHypertextHandler (xText);
+ else
+ return null;
+ }
+
+ public AccessibleHypertextHandler ()
+ {
+ }
+
+ public AccessibleHypertextHandler (XAccessibleHypertext xText)
+ {
+ if (xText != null)
+ maChildList.setSize (1);
+ }
+
+ protected static XAccessibleHypertext getHypertext (AccTreeNode aNode)
+ {
+ XAccessibleHypertext xHypertext =
+ (XAccessibleHypertext) UnoRuntime.queryInterface (
+ XAccessibleHypertext.class, aNode.getContext());
+ return xHypertext;
+ }
+
+ public AccessibleTreeNode getChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ return new StringNode ("interface XAccessibleHypertext is supported", aParent);
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleImageHandler.java b/toolkit/test/accessibility/AccessibleImageHandler.java
new file mode 100644
index 000000000000..92917e1b9740
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleImageHandler.java
@@ -0,0 +1,51 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleImage;
+
+
+class AccessibleImageHandler extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleImage xImage =
+ (XAccessibleImage) UnoRuntime.queryInterface (
+ XAccessibleImage.class, xContext);
+ if (xImage != null)
+ return new AccessibleImageHandler (xImage);
+ else
+ return null;
+ }
+
+ public AccessibleImageHandler ()
+ {
+ }
+
+ public AccessibleImageHandler (XAccessibleImage xImage)
+ {
+ if (xImage != null)
+ maChildList.setSize (1);
+ }
+
+ protected static XAccessibleImage getImage (AccTreeNode aNode)
+ {
+ return (XAccessibleImage) UnoRuntime.queryInterface (
+ XAccessibleImage.class, aNode.getContext());
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ if (aParent instanceof AccTreeNode)
+ {
+ XAccessibleImage xImage = getImage ((AccTreeNode)aParent);
+ if (xImage != null)
+ return new StringNode (
+ "Image: " +
+ xImage.getAccessibleImageDescription() + " (" +
+ xImage.getAccessibleImageWidth() + "x" +
+ xImage.getAccessibleImageHeight() + ")",
+ aParent);
+ }
+ return null;
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleRelationHandler.java b/toolkit/test/accessibility/AccessibleRelationHandler.java
new file mode 100644
index 000000000000..ea3be4c16264
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleRelationHandler.java
@@ -0,0 +1,96 @@
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.AccessibleRelation;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.accessibility.AccessibleRelationType;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+import tools.NameProvider;
+
+class AccessibleRelationHandler
+ extends NodeHandler
+{
+ public NodeHandler createHandler( XAccessibleContext xContext )
+ {
+ AccessibleRelationHandler aHandler = null;
+ if (xContext != null)
+ {
+ XAccessibleRelationSet xRelation = xContext.getAccessibleRelationSet();
+ if (xRelation != null)
+ aHandler = new AccessibleRelationHandler(xContext);
+ }
+ return aHandler;
+ }
+
+ public AccessibleRelationHandler()
+ {
+ }
+
+ public AccessibleRelationHandler( XAccessibleContext xContext )
+ {
+ XAccessibleRelationSet xRelation = xContext.getAccessibleRelationSet();
+ if (xRelation != null)
+ maChildList.setSize( 1 );
+ }
+
+ public AccessibleTreeNode createChild( AccessibleTreeNode aParent,
+ int nIndex )
+ {
+ XAccessibleRelationSet xRelation = null;
+ AccessibleTreeNode aChild = null;
+
+ if( aParent instanceof AccTreeNode )
+ {
+ xRelation =
+ ((AccTreeNode)aParent).getContext().getAccessibleRelationSet();
+ }
+ if( xRelation == null )
+ return aChild;
+
+
+ VectorNode aVNode = new VectorNode( "RelationSet", aParent);
+ int nCount = xRelation.getRelationCount();
+ try
+ {
+ for( int i = 0; i < nCount; i++ )
+ {
+ AccessibleRelation aRelation = xRelation.getRelation( i );
+
+ StringBuffer aBuffer = new StringBuffer();
+ aBuffer.append (NameProvider.getRelationName (aRelation.RelationType));
+ aBuffer.append( ": " );
+
+ for( int j = 0; j < aRelation.TargetSet.length; j++ )
+ {
+ Object aTarget = aRelation.TargetSet[j];
+ XAccessible xAccTarget =
+ (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aTarget );
+ if( xAccTarget == null )
+ {
+ aBuffer.append( aTarget.toString() );
+ }
+ else
+ {
+ aBuffer.append( xAccTarget.getAccessibleContext().
+ getAccessibleName() );
+ }
+ aBuffer.append( ", " );
+ }
+ aBuffer.delete( aBuffer.length() - 2, aBuffer.length() );
+
+ aVNode.addChild( new StringNode( aBuffer.toString(),
+ aParent ) );
+ }
+
+ aChild = aVNode;
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aChild = new StringNode( "IndexOutOfBounds", aParent );
+ }
+
+ return aChild;
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleSelectionHandler.java b/toolkit/test/accessibility/AccessibleSelectionHandler.java
new file mode 100644
index 000000000000..f7ab62807332
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleSelectionHandler.java
@@ -0,0 +1,130 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleSelection;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Vector;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+
+
+class AccessibleSelectionHandler
+ extends NodeHandler
+{
+ public NodeHandler createHandler( XAccessibleContext xContext )
+ {
+ XAccessibleSelection xSelection =
+ (XAccessibleSelection) UnoRuntime.queryInterface(
+ XAccessibleSelection.class, xContext);
+ return (xSelection == null) ? null :
+ new AccessibleSelectionHandler(xSelection);
+ }
+
+ public AccessibleSelectionHandler()
+ {
+ }
+
+ public AccessibleSelectionHandler( XAccessibleSelection xSelection )
+ {
+ if (xSelection != null)
+ maChildList.setSize( 2 );
+ }
+
+ public AccessibleTreeNode createChild( AccessibleTreeNode aParent,
+ int nIndex )
+ {
+ AccessibleTreeNode aChild = null;
+
+ if( aParent instanceof AccTreeNode )
+ {
+ XAccessibleSelection xSelection =
+ ((AccTreeNode)aParent).getSelection();
+ if( xSelection != null )
+ {
+ switch( nIndex )
+ {
+ case 0:
+ aChild = new StringNode(
+ "getSelectedAccessibleChildCount: " +
+ xSelection.getSelectedAccessibleChildCount(),
+ aParent );
+ break;
+ case 1:
+ {
+ VectorNode aVNode =
+ new VectorNode( "Selected Children", aParent);
+ int nSelected = 0;
+ int nCount = ((AccTreeNode)aParent).getContext().
+ getAccessibleChildCount();
+ try
+ {
+ for( int i = 0; i < nCount; i++ )
+ {
+ try
+ {
+ if( xSelection.isAccessibleChildSelected( i ) )
+ {
+ XAccessible xSelChild = xSelection.
+ getSelectedAccessibleChild(nSelected);
+ XAccessible xNChild =
+ ((AccTreeNode)aParent).
+ getContext().getAccessibleChild( i );
+ aVNode.addChild( new StringNode(
+ i + ": " +
+ xNChild.getAccessibleContext().
+ getAccessibleDescription() + " (" +
+ (xSelChild.equals(xNChild) ? "OK" : "XXX") +
+ ")", aParent ) );
+ }
+ }
+ catch (com.sun.star.lang.DisposedException e)
+ {
+ aVNode.addChild( new StringNode(
+ i + ": caught DisposedException while creating",
+ aParent ));
+ }
+ }
+ aChild = aVNode;
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aChild = new StringNode( "IndexOutOfBounds",
+ aParent );
+ }
+ }
+ break;
+ default:
+ aChild = new StringNode( "ERROR", aParent );
+ break;
+ }
+ }
+ }
+
+ return aChild;
+ }
+
+
+ public String[] getActions (AccessibleTreeNode aNode)
+ {
+ if( aNode instanceof AccTreeNode )
+ {
+ XAccessibleSelection xSelection =
+ ((AccTreeNode)aNode).getSelection();
+ if( xSelection != null )
+ {
+ return new String[] { "Select..." };
+ }
+ }
+ return new String[0];
+ }
+
+ public void performAction (AccessibleTreeNode aNode, int nIndex)
+ {
+ new SelectionDialog( (AccTreeNode)aNode ).show();
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleTableHandler.java b/toolkit/test/accessibility/AccessibleTableHandler.java
new file mode 100644
index 000000000000..c3883f649d5e
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleTableHandler.java
@@ -0,0 +1,90 @@
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleTable;
+
+
+class AccessibleTableHandler extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleTable xTable =
+ (XAccessibleTable) UnoRuntime.queryInterface (
+ XAccessibleTable.class, xContext);
+ if (xTable != null)
+ return new AccessibleTableHandler (xTable);
+ else
+ return null;
+ }
+
+ public AccessibleTableHandler ()
+ {
+ }
+
+ public AccessibleTableHandler (XAccessibleTable xTable)
+ {
+ if (xTable != null)
+ maChildList.setSize (4);
+ }
+
+ protected static XAccessibleTable getTable(Object aObject)
+ {
+ return (XAccessibleTable) UnoRuntime.queryInterface (
+ XAccessibleTable.class, aObject);
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+ XAccessibleTable xTable = null;
+ if (aParent instanceof AccTreeNode)
+ xTable = ((AccTreeNode)aParent).getTable();
+ try
+ {
+ if( xTable != null )
+ {
+ switch( nIndex )
+ {
+ case 0:
+ aChild = new StringNode ("# table rows: " + xTable.getAccessibleRowCount(), aParent);
+ break;
+ case 1:
+ aChild = new StringNode ("# table columns: " + xTable.getAccessibleColumnCount(), aParent);
+ break;
+ case 2:
+ {
+ String sText = "selected rows: ";
+ int[] aSelected = xTable.getSelectedAccessibleRows();
+ for( int i=0; i < aSelected.length; i++ )
+ {
+ sText += aSelected[i];
+ sText += " ";
+ }
+ aChild = new StringNode (sText, aParent);
+ }
+ break;
+ case 3:
+ {
+ String sText = "selected columns: ";
+ int[] aSelected = xTable.getSelectedAccessibleColumns();
+ for( int i=0; i < aSelected.length; i++ )
+ {
+ sText += aSelected[i];
+ sText += " ";
+ }
+ aChild = new StringNode (sText, aParent);
+ }
+ break;
+ default:
+ aChild = new StringNode ("unknown child index " + nIndex, aParent);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // Return empty child.
+ }
+
+ return aChild;
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleTextHandler.java b/toolkit/test/accessibility/AccessibleTextHandler.java
new file mode 100644
index 000000000000..6fa083b22ea3
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleTextHandler.java
@@ -0,0 +1,792 @@
+
+import com.sun.star.accessibility.AccessibleTextType;
+import com.sun.star.accessibility.TextSegment;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.accessibility.XAccessibleEditableText;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.Point;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.beans.PropertyValue;
+
+import java.util.Vector;
+import java.awt.Container;
+import java.awt.FlowLayout;
+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.JDialog;
+import javax.swing.JButton;
+import javax.swing.JPanel;
+import javax.swing.JLabel;
+import javax.swing.Icon;
+import javax.swing.JTextArea;
+import javax.swing.JOptionPane;
+import javax.swing.JCheckBox;
+import javax.swing.JColorChooser;
+import javax.swing.BoxLayout;
+import javax.swing.text.JTextComponent;
+
+
+class AccessibleTextHandler extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ XAccessibleText xText = (XAccessibleText) UnoRuntime.queryInterface (
+ XAccessibleText.class, xContext);
+ if (xText != null)
+ return new AccessibleTextHandler (xText);
+ else
+ return null;
+ }
+
+ public AccessibleTextHandler ()
+ {
+ }
+
+ public AccessibleTextHandler (XAccessibleText xText)
+ {
+ if (xText != null)
+ maChildList.setSize (8);
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+ XAccessibleText xText = null;
+ if (aParent instanceof AccTreeNode)
+ xText = ((AccTreeNode)aParent).getText();
+
+ try
+ {
+ if( xText != null )
+ {
+ switch( nIndex )
+ {
+ case 0:
+ aChild = new StringNode (xText.getText(), aParent);
+ break;
+ case 1:
+ aChild = new StringNode ("# chars: " + xText.getCharacterCount(), aParent);
+ break;
+ case 2:
+ aChild = new StringNode (characters( xText ), aParent);
+ break;
+ case 3:
+ aChild = new StringNode ("selection: "
+ + "[" + xText.getSelectionStart()
+ + "," + xText.getSelectionEnd()
+ + "] \"" + xText.getSelectedText() + "\"",
+ aParent);
+ break;
+ case 4:
+ aChild = new StringNode ("getCaretPosition: " + xText.getCaretPosition(), aParent);
+ break;
+ case 5:
+ {
+ VectorNode aVec = new VectorNode("portions", aParent);
+ aChild = aVec;
+ aVec.addChild(
+ textAtIndexNode( xText, "Character",
+ AccessibleTextType.CHARACTER,
+ aParent ) );
+ aVec.addChild(
+ textAtIndexNode( xText, "Word",
+ AccessibleTextType.WORD,
+ aParent ) );
+ aVec.addChild(
+ textAtIndexNode( xText, "Sentence",
+ AccessibleTextType.SENTENCE,
+ aParent ) );
+ aVec.addChild(
+ textAtIndexNode( xText, "Paragraph",
+ AccessibleTextType.PARAGRAPH,
+ aParent ) );
+ aVec.addChild(
+ textAtIndexNode( xText, "Line",
+ AccessibleTextType.LINE,
+ aParent ) );
+ aVec.addChild(
+ textAtIndexNode( xText, "Attribute",
+ AccessibleTextType.ATTRIBUTE_RUN,
+ aParent ) );
+ aVec.addChild(
+ textAtIndexNode( xText, "Glyph",
+ AccessibleTextType.GLYPH,
+ aParent ) );
+ }
+ break;
+ case 6:
+ aChild = new StringNode (bounds( xText ), aParent);
+ break;
+ case 7:
+ aChild = getAttributes( xText, aParent );
+ break;
+ default:
+ aChild = new StringNode ("unknown child index " + nIndex, aParent);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ // Return empty child.
+ }
+
+ return aChild;
+ }
+
+
+ private String textAtIndexNodeString(
+ int nStart, int nEnd,
+ String sWord, String sBefore, String sBehind)
+ {
+ return "[" + nStart + "," + nEnd + "] "
+ + "\"" + sWord + "\" \t"
+ + "(" + sBefore + ","
+ + "" + sBehind + ")";
+ }
+
+ /** Create a text node that lists all strings of a particular text type
+ */
+ private AccessibleTreeNode textAtIndexNode(
+ XAccessibleText xText,
+ String sName,
+ short nTextType,
+ AccessibleTreeNode aParent)
+ {
+ VectorNode aNode = new VectorNode (sName, aParent);
+
+ // get word at all positions;
+ // for nicer display, compare current word to previous one and
+ // make a new node for every interval, not for every word
+ int nLength = xText.getCharacterCount();
+ if( nLength > 0 )
+ {
+ try
+ {
+ // sWord + nStart mark the current word
+ // make a node as soon as a new one is found; close the last
+ // one at the end
+ TextSegment sWord = xText.getTextAtIndex(0, nTextType);
+ TextSegment sBefore = xText.getTextBeforeIndex(0, nTextType);
+ TextSegment sBehind = xText.getTextBehindIndex(0, nTextType);
+ int nStart = 0;
+ for(int i = 1; i < nLength; i++)
+ {
+ TextSegment sTmp = xText.getTextAtIndex(i, nTextType);
+ TextSegment sTBef = xText.getTextBeforeIndex(i, nTextType);
+ TextSegment sTBeh = xText.getTextBehindIndex(i, nTextType);
+ if( ! ( sTmp.equals( sWord ) && sTBef.equals( sBefore ) &&
+ sTBeh.equals( sBehind ) ) )
+ {
+ aNode.addChild (new StringNode (textAtIndexNodeString(
+ nStart, i,
+ sWord.SegmentText, sBefore.SegmentText, sBehind.SegmentText), aNode));
+ sWord = sTmp;
+ sBefore = sTBef;
+ sBehind = sTBeh;
+ nStart = i;
+ }
+
+ // don't generate more than 50 children.
+ if (aNode.getChildCount() > 50)
+ {
+ sWord.SegmentText = "...";
+ break;
+ }
+ }
+ aNode.addChild (new StringNode (textAtIndexNodeString(
+ nStart, nLength,
+ sWord.SegmentText, sBefore.SegmentText, sBehind.SegmentText), aNode));
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aNode.addChild (new StringNode (e.toString(), aNode));
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ aNode.addChild (new StringNode (e.toString(), aNode));
+ }
+ }
+
+ return aNode;
+ }
+
+
+
+ /** getCharacter (display as array string) */
+ private String characters(XAccessibleText xText)
+ {
+ // get count (max. 30)
+ int nChars = xText.getCharacterCount();
+ if( nChars > 30 )
+ nChars = 30;
+
+ // build up string
+ StringBuffer aChars = new StringBuffer();
+ try
+ {
+ aChars.append( "[" );
+ for( int i = 0; i < nChars; i++)
+ {
+ aChars.append( xText.getCharacter(i) );
+ aChars.append( "," );
+ }
+ if( nChars > 0)
+ {
+ if( nChars == xText.getCharacterCount() )
+ aChars.deleteCharAt( aChars.length() - 1 );
+ else
+ aChars.append( "..." );
+ }
+ aChars.append( "]" );
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aChars.append( " ERROR " );
+ }
+
+ // return result
+ return "getCharacters: " + aChars;
+ }
+
+
+ /** iterate over characters, and translate their positions
+ * back and forth */
+ private String bounds( XAccessibleText xText )
+ {
+ StringBuffer aBuffer = new StringBuffer( "bounds: " );
+ try
+ {
+ // iterate over characters
+ int nCount = xText.getCharacterCount();
+ for(int i = 0; i < nCount; i++ )
+ {
+ // get bounds for this character
+ Rectangle aRect = xText.getCharacterBounds( i );
+
+ // get the character by 'clicking' into the middle of
+ // the bounds
+ Point aMiddle = new Point();
+ aMiddle.X = aRect.X + (aRect.Width / 2) - 1;
+ aMiddle.Y = aRect.Y + (aRect.Height / 2 ) - 1;
+ int nIndex = xText.getIndexAtPoint( aMiddle );
+
+ // get the character, or a '#' for an illegal index
+ if( (nIndex >= 0) && (nIndex < xText.getCharacter(i)) )
+ aBuffer.append( xText.getCharacter(nIndex) );
+ else
+ aBuffer.append( '#' );
+ }
+ }
+ catch( IndexOutOfBoundsException e )
+ { ; } // ignore errors
+
+ return aBuffer.toString();
+ }
+
+
+ private AccessibleTreeNode getAttributes( XAccessibleText xText,
+ AccessibleTreeNode aParent)
+ {
+ String[] aAttributeList = new String[] {
+ "CharBackColor",
+ "CharColor",
+ "CharEscapement",
+ "CharHeight",
+ "CharPosture",
+ "CharStrikeout",
+ "CharUnderline",
+ "CharWeight",
+ "ParaAdjust",
+ "ParaBottomMargin",
+ "ParaFirstLineIndent",
+ "ParaLeftMargin",
+ "ParaLineSpacing",
+ "ParaRightMargin",
+ "ParaTabStops"};
+
+ AccessibleTreeNode aRet;
+
+ try
+ {
+ VectorNode aPortions = new VectorNode ("getAttributes", aParent);
+
+ int nIndex = 0;
+ int nLength = xText.getCharacterCount();
+ while( nIndex < nLength )
+ {
+ // get attribute run
+ String aPortion = null;
+ try
+ {
+ aPortion = xText.getTextAtIndex(
+ nIndex, AccessibleTextType.ATTRIBUTE_RUN).SegmentText;
+ }
+ catch(com.sun.star.lang.IllegalArgumentException e)
+ {
+ aPortion = new String ("");
+ }
+
+ // get attributes and make node with attribute children
+ PropertyValue[] aValues = xText.getCharacterAttributes(nIndex, aAttributeList);
+ VectorNode aAttrs = new VectorNode (aPortion, aPortions);
+ for( int i = 0; i < aValues.length; i++ )
+ {
+ new StringNode( aValues[i].Name + ": " + aValues[i].Value,
+ aAttrs );
+ }
+
+ // get next portion, but advance at least one
+ nIndex += (aPortion.length() > 0) ? aPortion.length() : 1;
+ }
+
+ aRet = aPortions;
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aRet = new StringNode( "Exception caught:" + e, aParent );
+ }
+
+ return aRet;
+ }
+
+
+ static String[] aTextActions =
+ new String[] { "select...", "copy..." };
+ static String[] aEditableTextActions =
+ new String[] { "select...", "copy...",
+ "cut...", "paste...", "edit...", "format..." };
+
+ public String[] getActions (AccessibleTreeNode aNode)
+ {
+ XAccessibleEditableText xEText = null;
+ if (aNode instanceof AccTreeNode)
+ xEText = ((AccTreeNode)aNode).getEditText ();
+
+ return (xEText == null) ? aTextActions : aEditableTextActions;
+ }
+
+ public void performAction (AccessibleTreeNode aNode, int nIndex)
+ {
+ if ( ! (aNode instanceof AccTreeNode))
+ return;
+
+ AccTreeNode aATNode = (AccTreeNode)aNode;
+ TextActionDialog aDialog = null;
+
+ // create proper dialog
+ switch( nIndex )
+ {
+ case 0:
+ aDialog = new TextActionDialog( aATNode,
+ "Select range:",
+ "select" )
+ {
+ boolean action(
+ JTextComponent aText, AccTreeNode aNode )
+ throws IndexOutOfBoundsException
+ {
+ return aNode.getText().setSelection(
+ getSelectionStart(),
+ getSelectionEnd() );
+ }
+ };
+ break;
+ case 1:
+ aDialog = new TextActionDialog( aATNode,
+ "Select range and copy:",
+ "copy" )
+ {
+ boolean action(
+ JTextComponent aText, AccTreeNode aNode )
+ throws IndexOutOfBoundsException
+ {
+ return aNode.getText().copyText(
+ getSelectionStart(),
+ getSelectionEnd() );
+ }
+ };
+ break;
+ case 2:
+ aDialog = new TextActionDialog( aATNode,
+ "Select range and cut:",
+ "cut" )
+ {
+ boolean action(
+ JTextComponent aText, AccTreeNode aNode )
+ throws IndexOutOfBoundsException
+ {
+ return aNode.getEditText().cutText(
+ getSelectionStart(),
+ getSelectionEnd() );
+ }
+ };
+ break;
+ case 3:
+ aDialog = new TextActionDialog( aATNode,
+ "Place Caret and paste:",
+ "paste" )
+ {
+ boolean action(
+ JTextComponent aText, AccTreeNode aNode )
+ throws IndexOutOfBoundsException
+ {
+ return aNode.getEditText().pasteText(
+ aText.getCaretPosition() );
+ }
+ };
+ break;
+ case 4:
+ aDialog = new TextEditDialog( aATNode, "Edit text:",
+ "edit" );
+ break;
+ case 5:
+ aDialog = new TextAttributeDialog( aATNode );
+ break;
+ }
+
+ if( aDialog != null )
+ aDialog.show();
+ }
+
+}
+
+/**
+ * Display a dialog with a text field and a pair of cancel/do-it buttons
+ */
+class TextActionDialog extends JDialog
+ implements ActionListener
+{
+ AccTreeNode aNode;
+ JTextArea aText;
+ String sName;
+ JCheckBox aIndexToggle;
+
+ public TextActionDialog( AccTreeNode aNd,
+ String sExplanation,
+ String sButtonText )
+ {
+ super( AccessibilityWorkBench.Instance() );
+
+ aNode = aNd;
+ sName = sButtonText;
+ init( sExplanation, aNode.getText().getText(), sButtonText );
+// setSize( getPreferredSize() );
+ setSize( 350, 225 );
+ }
+
+ /** build dialog */
+ protected void init( String sExplanation,
+ String sText,
+ String sButtonText )
+ {
+ setTitle( sName );
+
+ // vertical stacking of the elements
+ Container aContent = getContentPane();
+ // aContent.setLayout( new BorderLayout() );
+
+ // label with explanation
+ if( sExplanation.length() > 0 )
+ aContent.add( new JLabel( sExplanation ), BorderLayout.NORTH );
+
+ // the text field
+ aText = new JTextArea();
+ aText.setText( sText );
+ aText.setColumns( Math.min( Math.max( 40, sText.length() ), 20 ) );
+ aText.setRows( sText.length() / 40 + 1 );
+ aText.setLineWrap( true );
+ aText.setEditable( false );
+ aContent.add( aText, BorderLayout.CENTER );
+
+ JPanel aButtons = new JPanel();
+ aButtons.setLayout( new FlowLayout() );
+ aIndexToggle = new JCheckBox( "reverse selection" );
+ aButtons.add( aIndexToggle );
+ JButton aActionButton = new JButton( sButtonText );
+ 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 );
+ }
+
+ void cancel()
+ {
+ hide();
+ dispose();
+ }
+
+ void action()
+ {
+ String sError = null;
+ try
+ {
+ boolean bSuccess = action( aText, aNode );
+ if( !bSuccess )
+ sError = "Can't execute";
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ sError = "Index out of bounds";
+ }
+
+ if( sError != null )
+ JOptionPane.showMessageDialog( AccessibilityWorkBench.Instance(),
+ sError, sName,
+ JOptionPane.ERROR_MESSAGE);
+
+ cancel();
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ String sCommand = e.getActionCommand();
+
+ if( "Cancel".equals( sCommand ) )
+ cancel();
+ else if( "Action".equals( sCommand ) )
+ action();
+ }
+
+
+ int getSelectionStart() { return getSelection(true); }
+ int getSelectionEnd() { return getSelection(false); }
+ int getSelection(boolean bStart)
+ {
+ return ( bStart ^ aIndexToggle.isSelected() )
+ ? aText.getSelectionStart() : aText.getSelectionEnd();
+ }
+
+
+
+ /** override this for dialog-specific action */
+ boolean action( JTextComponent aText, AccTreeNode aNode )
+ throws IndexOutOfBoundsException
+ {
+ return false;
+ }
+}
+
+
+class TextEditDialog extends TextActionDialog
+{
+ public TextEditDialog( AccTreeNode aNode,
+ String sExplanation,
+ String sButtonText )
+ {
+ super( aNode, sExplanation, sButtonText );
+ }
+
+ protected void init( String sExplanation,
+ String sText,
+ String sButtonText )
+ {
+ super.init( sExplanation, sText, sButtonText );
+ aText.setEditable( true );
+ }
+
+
+ /** edit the text */
+ boolean action( JTextComponent aText, AccTreeNode aNode )
+ {
+ // is this text editable? if not, fudge you and return
+ XAccessibleEditableText xEdit = aNode.getEditText();
+ return ( xEdit == null ) ? false :
+ updateText( xEdit, aText.getText() );
+ }
+
+
+ /** update the text */
+ boolean updateText( XAccessibleEditableText xEdit, String sNew )
+ {
+ String sOld = xEdit.getText();
+
+ // false alarm? Early out if no change was done!
+ if( sOld.equals( sNew ) )
+ return false;
+
+ // 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) );
+
+ boolean bRet = false;
+ try
+ {
+ // edit the text, and use
+ // (set|insert|delete|replace)Text as needed
+ if( nFront+nBack == 0 )
+ bRet = xEdit.setText( sIns );
+ else if( sDel.length() == 0 )
+ bRet = xEdit.insertText( sIns, nFront );
+ else if( sIns.length() == 0 )
+ bRet = xEdit.deleteText( nFront, sOld.length()-nBack );
+ else
+ bRet = xEdit.replaceText(nFront, sOld.length()-nBack,sIns);
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+ }
+}
+
+
+class TextAttributeDialog extends TextActionDialog
+{
+ public TextAttributeDialog(
+ AccTreeNode aNode )
+ {
+ super( aNode, "Choose attributes, select text, and press 'Set':",
+ "set" );
+ }
+
+ private JCheckBox aBold, aUnderline, aItalics;
+ private Color aForeground, aBackground;
+
+ protected void init( String sExplanation,
+ String sText,
+ String sButtonText )
+ {
+ super.init( sExplanation, sText, sButtonText );
+
+ aForeground = Color.black;
+ aBackground = Color.white;
+
+ JPanel aAttr = new JPanel();
+ aAttr.setLayout( new BoxLayout( aAttr, BoxLayout.Y_AXIS ) );
+
+ aBold = new JCheckBox( "bold" );
+ aUnderline = new JCheckBox( "underline" );
+ aItalics = new JCheckBox( "italics" );
+
+ JButton aForeButton = new JButton("Foreground", new ColorIcon(true));
+ aForeButton.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ aForeground = JColorChooser.showDialog(
+ TextAttributeDialog.this,
+ "Select Foreground Color",
+ aForeground);
+ }
+ } );
+
+ JButton aBackButton = new JButton("Background", new ColorIcon(false));
+ aBackButton.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent e)
+ {
+ aBackground = JColorChooser.showDialog(
+ TextAttributeDialog.this,
+ "Select Background Color",
+ aBackground);
+ }
+ } );
+
+ aAttr.add( aBold );
+ aAttr.add( aUnderline );
+ aAttr.add( aItalics );
+ aAttr.add( aForeButton );
+ aAttr.add( aBackButton );
+
+ getContentPane().add( aAttr, BorderLayout.WEST );
+ }
+
+
+ class ColorIcon implements Icon
+ {
+ boolean bForeground;
+ static final int nHeight = 16;
+ static final int nWidth = 16;
+
+ 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()
+ {
+ return bForeground ? aForeground : aBackground;
+ }
+ }
+
+
+
+ /** edit the text */
+ boolean action( JTextComponent aText, AccTreeNode aNode )
+ throws IndexOutOfBoundsException
+ {
+ // is this text editable? if not, fudge you and return
+ XAccessibleEditableText xEdit = aNode.getEditText();
+ boolean bSuccess = false;
+ if( xEdit != null )
+ {
+ PropertyValue[] aSequence = new PropertyValue[6];
+ aSequence[0] = new PropertyValue();
+ aSequence[0].Name = "CharWeight";
+ aSequence[0].Value = new Integer( aBold.isSelected() ? 150 : 100 );
+ aSequence[1] = new PropertyValue();
+ aSequence[1].Name = "CharUnderline";
+ aSequence[1].Value = new Integer( aUnderline.isSelected() ? 1 : 0 );
+ aSequence[2] = new PropertyValue();
+ aSequence[2].Name = "CharBackColor";
+ aSequence[2].Value = new Integer( aBackground.getRGB() );
+ aSequence[3] = new PropertyValue();
+ aSequence[3].Name = "CharColor";
+ aSequence[3].Value = new Integer( aForeground.getRGB() );
+ aSequence[4] = new PropertyValue();
+ aSequence[4].Name = "CharPosture";
+ aSequence[4].Value = new Integer( aItalics.isSelected() ? 1 : 0 );
+ aSequence[5] = new PropertyValue();
+ aSequence[5].Name = "CharBackTransparent";
+ aSequence[5].Value = new Boolean( false );
+
+ bSuccess = xEdit.setAttributes( getSelectionStart(),
+ getSelectionEnd(),
+ aSequence );
+ }
+ return bSuccess;
+ }
+
+}
diff --git a/toolkit/test/accessibility/AccessibleTreeCellRenderer.java b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
new file mode 100644
index 000000000000..deb3cb967133
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleTreeCellRenderer.java
@@ -0,0 +1,86 @@
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.TreePath;
+import javax.swing.JTree;
+import java.awt.Color;
+import java.awt.Component;
+import java.util.Vector;
+
+
+public class AccessibleTreeCellRenderer
+ extends DefaultTreeCellRenderer
+{
+ public Color
+ maDefaultColor,
+ maChangedColor;
+ protected Vector
+ maChangedLines;
+
+
+
+ public AccessibleTreeCellRenderer ()
+ {
+ maDefaultColor = Color.black;
+ maChangedColor = Color.red;
+ maChangedLines = new Vector ();
+ }
+
+ public Component getTreeCellRendererComponent (
+ JTree tree,
+ Object value,
+ boolean sel,
+ boolean expanded,
+ boolean leaf,
+ int row,
+ boolean hasFocus)
+ {
+ super.getTreeCellRendererComponent(
+ tree, value, sel,
+ expanded, leaf, row,
+ hasFocus);
+
+ if (maChangedLines.size()<=row || maChangedLines.elementAt (row) == null)
+ setTextNonSelectionColor (maDefaultColor);
+ else
+ setTextNonSelectionColor (maChangedColor);
+
+ return this;
+ }
+
+ /** Tell the cell renderer that no changes shall be displayed anymore.
+ */
+ public void clearAllChanges ()
+ {
+ maChangedLines.clear();
+ }
+
+ /** Inform the cell renderer of a new changed line which to paint
+ highlighted when asked to paint it the next time.
+ */
+ public void addChangedLine (int nRow)
+ {
+ if (maChangedLines.size() <= nRow)
+ maChangedLines.setSize (nRow+1);
+ nRow -= 1; // row index is one to large for some reason.
+ maChangedLines.set (nRow, new Boolean (true));
+ }
+
+ /** Inform the cell renderer of a set of changed line which to paint
+ highlighted when asked to paint them the next time.
+ @param aChangedNodes
+ The set of changed nodes. Each entry is a TreePath.
+ @param aTree
+ The JTree that is used to transform the given TreePath objects
+ into rows.
+ */
+ public void addChangedNodes (Vector aChangedNodes, JTree aTree)
+ {
+ for (int i=0; i<aChangedNodes.size(); i++)
+ {
+ TreePath aPath = (TreePath)aChangedNodes.elementAt (i);
+ int nRow = aTree.getRowForPath (aPath);
+ addChangedLine (nRow);
+ }
+ }
+
+}
+
diff --git a/toolkit/test/accessibility/AccessibleTreeHandler.java b/toolkit/test/accessibility/AccessibleTreeHandler.java
new file mode 100644
index 000000000000..f45db8cb5ab9
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleTreeHandler.java
@@ -0,0 +1,110 @@
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+
+/**
+ * Map the tree of accessibility objects into their
+ * AccessibilityTreeModel counterparts.
+ */
+class AccessibleTreeHandler
+ extends NodeHandler
+{
+ protected XAccessibleContext mxContext;
+
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new AccessibleTreeHandler (xContext);
+ else
+ return null;
+ }
+
+ public AccessibleTreeHandler ()
+ {
+ super();
+ mxContext = null;
+ }
+
+ public AccessibleTreeHandler (XAccessibleContext xContext)
+ {
+ super();
+ mxContext = xContext;
+ if (mxContext != null)
+ // Add one to the number of children to include the string node
+ // that tells you how many children there are.
+ synchronized (maChildList)
+ {
+ maChildList.setSize (1 + mxContext.getAccessibleChildCount());
+ }
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+ if (mxContext != null)
+ {
+ if (nIndex == 0)
+ aChild = new StringNode ("Child count: " + mxContext.getAccessibleChildCount(),
+ aParent);
+ else
+ {
+ // Lower index to skip the string node.
+ nIndex -= 1;
+ try
+ {
+ XAccessible xChild = mxContext.getAccessibleChild (nIndex);
+ aChild = NodeFactory.Instance().createDefaultNode (
+ xChild, aParent);
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aChild = new StringNode ("ERROR: no child with index " + nIndex, aParent);
+ }
+ }
+ }
+ else
+ aChild = new StringNode ("XAccessibleContext interface not supported", aParent);
+ return aChild;
+ }
+
+ /** Try to add the specified accessible child into the lists of
+ children. The insertion position is determined from the
+ getIndexInParent method of the child.
+ */
+ public AccessibleTreeNode addAccessibleChild (AccessibleTreeNode aParent, XAccessible xChild)
+ {
+ AccessibleTreeNode aChild = null;
+
+ if (xChild != null)
+ {
+ XAccessibleContext xContext = xChild.getAccessibleContext();
+ if (xContext != null)
+ {
+ int nIndex = xContext.getAccessibleIndexInParent() + 1;
+ synchronized (maChildList)
+ {
+ if ((nIndex >= 0) || (nIndex <= maChildList.size()))
+ {
+ aChild = NodeFactory.Instance().createDefaultNode (xChild, aParent);
+ maChildList.insertElementAt (aChild, nIndex);
+ }
+ }
+ }
+ }
+ return aChild;
+ }
+
+
+ /** Update only the child count node. Trust on other ways to update the
+ accessible children.
+ */
+ public void update (AccessibleTreeNode aNode)
+ {
+ synchronized (maChildList)
+ {
+ maChildList.setElementAt (null, 0);
+ }
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleTreeNode.java b/toolkit/test/accessibility/AccessibleTreeNode.java
new file mode 100644
index 000000000000..f9b0799e4423
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleTreeNode.java
@@ -0,0 +1,101 @@
+import java.util.Vector;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+/**
+ Base class for all tree nodes.
+ */
+class AccessibleTreeNode
+{
+ /// The parent node. It is null for the root node.
+ protected AccessibleTreeNode maParent;
+
+ /// The object to be displayed.
+ private Object maDisplayObject;
+
+ public AccessibleTreeNode (Object aDisplayObject, AccessibleTreeNode aParent)
+ {
+ maDisplayObject = aDisplayObject;
+ maParent = aParent;
+ }
+
+ public void update ()
+ {
+ // Empty
+ }
+
+ public AccessibleTreeNode getParent ()
+ {
+ return maParent;
+ }
+
+ public Object getDisplayObject ()
+ {
+ return maDisplayObject;
+ }
+
+ public int getChildCount ()
+ {
+ return 0;
+ }
+
+ public AccessibleTreeNode getChild (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ throw new IndexOutOfBoundsException();
+ }
+
+ public AccessibleTreeNode getChildNoCreate (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ throw new IndexOutOfBoundsException();
+ }
+
+ public boolean removeChild (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ throw new IndexOutOfBoundsException();
+ }
+
+ public int indexOf (AccessibleTreeNode aNode)
+ {
+ return -1;
+ }
+
+ /** Create a path to this node by first asking the parent for its path
+ and then appending this object.
+ */
+ public void createPath (java.util.Vector aPath)
+ {
+ if (maParent != null)
+ maParent.createPath (aPath);
+ aPath.add (this);
+ }
+
+ public Object[] createPath ()
+ {
+ Vector aPath = new Vector (1);
+ createPath (aPath);
+ return aPath.toArray();
+ }
+
+ public boolean isLeaf()
+ {
+ return true;
+ }
+
+ public String toString()
+ {
+ return maDisplayObject.toString();
+ }
+
+ /** get names of suported actions */
+ public String[] getActions ()
+ {
+ return new String[] {};
+ }
+
+ /** perform action */
+ public void performAction (int nIndex)
+ {
+ }
+}
diff --git a/toolkit/test/accessibility/AccessibleUNOHandler.java b/toolkit/test/accessibility/AccessibleUNOHandler.java
new file mode 100644
index 000000000000..d52e60cd721f
--- /dev/null
+++ b/toolkit/test/accessibility/AccessibleUNOHandler.java
@@ -0,0 +1,115 @@
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.AccessibleRelation;
+import com.sun.star.accessibility.XAccessibleRelationSet;
+import com.sun.star.accessibility.AccessibleRelationType;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+
+
+/** This handler displays lower level UNO information. These are the
+ supported services, interfaces, and the implementation name.
+*/
+class AccessibleUNOHandler
+ extends NodeHandler
+{
+ public NodeHandler createHandler (XAccessibleContext xContext)
+ {
+ if (xContext == null)
+ return null;
+ else
+ return new AccessibleUNOHandler (xContext);
+ }
+
+ public AccessibleUNOHandler()
+ {
+ }
+
+ public AccessibleUNOHandler (XAccessibleContext xContext)
+ {
+ maChildList.setSize (3);
+ }
+
+ private XServiceInfo GetServiceInfo (AccessibleTreeNode aNode)
+ {
+ XServiceInfo xServiceInfo = null;
+ if (aNode instanceof AccTreeNode)
+ xServiceInfo = (XServiceInfo)UnoRuntime.queryInterface(
+ XServiceInfo.class, ((AccTreeNode)aNode).getContext());
+ return xServiceInfo;
+ }
+ private XTypeProvider GetTypeProvider (AccessibleTreeNode aNode)
+ {
+ XTypeProvider xTypeProvider = null;
+ if (aNode instanceof AccTreeNode)
+ xTypeProvider = (XTypeProvider)UnoRuntime.queryInterface(
+ XTypeProvider.class, ((AccTreeNode)aNode).getContext());
+ return xTypeProvider;
+ }
+
+ public AccessibleTreeNode createChild (AccessibleTreeNode aParent,
+ int nIndex)
+ {
+ AccessibleTreeNode aChild = null;
+ XServiceInfo xServiceInfo;
+ switch (nIndex)
+ {
+ case 0 : // Implemenation name.
+ xServiceInfo = GetServiceInfo (aParent);
+ aChild = new StringNode ("Implementation name: " +
+ (xServiceInfo!=null ? xServiceInfo.getImplementationName()
+ : "<XServiceInfo not supported>"),
+ aParent);
+ break;
+ case 1 :
+ xServiceInfo = GetServiceInfo (aParent);
+ if (xServiceInfo == null)
+ aChild = new StringNode (
+ "Supported services: <XServiceInfo not supported>",
+ aParent);
+ else
+ aChild = CreateServiceTree (aParent, xServiceInfo);
+ break;
+ case 2 :
+ XTypeProvider xTypeProvider = GetTypeProvider (aParent);
+ if (xTypeProvider == null)
+ aChild = new StringNode (
+ "Supported interfaces: <XTypeProvider not supported>",
+ aParent);
+ else
+ aChild = CreateInterfaceTree (aParent, xTypeProvider);
+ break;
+ }
+
+ return aChild;
+ }
+
+
+ private AccessibleTreeNode CreateServiceTree (AccessibleTreeNode aParent,
+ XServiceInfo xServiceInfo)
+ {
+ String[] aServiceNames = xServiceInfo.getSupportedServiceNames();
+ VectorNode aNode = new VectorNode ("Supported Services", aParent);
+
+ int nCount = aServiceNames.length;
+ for (int i=0; i<nCount; i++)
+ aNode.addChild (new StringNode (aServiceNames[i], aParent));
+
+ return aNode;
+ }
+
+ private AccessibleTreeNode CreateInterfaceTree (AccessibleTreeNode aParent,
+ XTypeProvider xTypeProvider)
+ {
+ Type[] aTypes = xTypeProvider.getTypes();
+ VectorNode aNode = new VectorNode ("Supported Interfaces", aParent);
+
+ int nCount = aTypes.length;
+ for (int i=0; i<nCount; i++)
+ aNode.addChild (new StringNode (aTypes[i].getTypeName(), aParent));
+
+ return aNode;
+ }
+}
diff --git a/toolkit/test/accessibility/Canvas.java b/toolkit/test/accessibility/Canvas.java
new file mode 100755
index 000000000000..a1d8fb0f7d08
--- /dev/null
+++ b/toolkit/test/accessibility/Canvas.java
@@ -0,0 +1,448 @@
+import java.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+import javax.swing.tree.*;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.event.TreeSelectionEvent;
+import java.awt.geom.Rectangle2D;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+
+/** 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>
+*/
+class Canvas
+ extends JPanel
+ implements MouseListener, MouseMotionListener, TreeSelectionListener//, Scrollable
+{
+ // This constant can be passed to SetZoomMode to always show the whole screen.
+ public static final int WHOLE_SCREEN = -1;
+
+ public Canvas ()
+ {
+ super (true);
+ maObjects = new java.util.HashMap ();
+ maNodes = new Vector ();
+ maObjectList = new Vector ();
+ maContexts = new Vector ();
+ addMouseListener (this);
+ addMouseMotionListener (this);
+ maBoundingBox = new Rectangle (0,0,100,100);
+ maTree = null;
+ mnHOffset = 0;
+ mnVOffset = 0;
+ mnScale = 1;
+ setShowText(false);
+ setShowDescriptions (true);
+ setShowNames (true);
+ setAntialiasing (true);
+ maLastWidgetSize = new Dimension (0,0);
+ }
+
+ /** Tell the canvas which tree view to use to highlight accessible
+ objects.
+ */
+ public void setTree (JTree aTree)
+ {
+ if (maTree != null)
+ maTree.removeTreeSelectionListener (this);
+ maTree = aTree;
+ if (maTree != null)
+ maTree.addTreeSelectionListener (this);
+ }
+
+
+
+
+ public void addNode (AccTreeNode aNode)
+ {
+ if (maNodes.indexOf (aNode) == -1)
+ {
+ maNodes.add (aNode);
+
+ CanvasShape aObject = (CanvasShape) maObjects.get (aNode);
+ if (aObject == null)
+ {
+ aObject = new CanvasShape (aNode);
+ // Update bounding box that includes all objects.
+ if (maObjects.size() == 0)
+ maBoundingBox = aObject.getBBox();
+ else
+ maBoundingBox = maBoundingBox.union (aObject.getBBox());
+
+ maObjects.put (aNode, aObject);
+ maObjectList.add (aObject);
+
+ }
+ repaint ();
+ }
+ }
+
+ public void removeNode (AccTreeNode aNode)
+ {
+ int i = maNodes.indexOf (aNode);
+ if( i != -1 )
+ {
+ Object aObject = maObjects.get(aNode);
+ maObjectList.remove (aObject);
+ maObjects.remove (aObject);
+ maNodes.remove (aNode);
+ repaint ();
+ }
+ }
+
+ public void updateNode (AccTreeNode aNode)
+ {
+ int i = maNodes.indexOf (aNode);
+ if (i != -1)
+ {
+ CanvasShape aObject = (CanvasShape)maObjects.get(aNode);
+ if (aObject != null)
+ aObject.update();
+ }
+ }
+
+ public void updateNodeGeometry (AccTreeNode aNode)
+ {
+ CanvasShape aObject = (CanvasShape)maObjects.get(aNode);
+ if (aObject != null)
+ aObject.updateGeometry();
+ }
+
+ public void clear ()
+ {
+ while (maNodes.size() > 0)
+ removeNode ((AccTreeNode)maNodes.elementAt(0));
+
+ maNodes.clear();
+ maObjects.clear();
+ maObjectList.clear();
+ }
+
+ public boolean getShowDescriptions ()
+ {
+ return Options.GetBoolean ("ShowDescriptions");
+ }
+
+ public void setShowDescriptions (boolean bNewValue)
+ {
+ Options.SetBoolean ("ShowDescriptions", bNewValue);
+ repaint ();
+ }
+
+ public boolean getShowNames ()
+ {
+ return Options.GetBoolean ("ShowNames");
+ }
+
+ public void setShowNames (boolean bNewValue)
+ {
+ Options.SetBoolean ("ShowNames", bNewValue);
+ repaint ();
+ }
+
+ public boolean getAntialiasing ()
+ {
+ return Options.GetBoolean ("Antialiasing");
+ }
+
+ public void setAntialiasing (boolean bNewValue)
+ {
+ Options.SetBoolean ("Antialiasing", bNewValue);
+ repaint ();
+ }
+
+ public boolean getShowText ()
+ {
+ return Options.GetBoolean ("ShowText");
+ }
+
+ public void setShowText (boolean bNewValue)
+ {
+ Options.SetBoolean ("ShowText", bNewValue);
+ repaint ();
+ }
+
+ public void setZoomMode (int nZoomMode)
+ {
+ Options.SetInteger ("ZoomMode", nZoomMode);
+ repaint ();
+ }
+
+ public int getZoomMode ()
+ {
+ return Options.GetInteger ("ZoomMode", WHOLE_SCREEN);
+ }
+
+
+ public void paintComponent (Graphics g)
+ {
+ synchronized (g)
+ {
+ super.paintComponent (g);
+
+ Graphics2D g2 = (Graphics2D)g;
+ if (getAntialiasing())
+ g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ else
+ g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_OFF);
+
+ setupTransformation ();
+
+ // 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 (
+ mnHOffset,
+ mnVOffset,
+ mnScale*aScreenSize.getWidth(),
+ mnScale*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 (maObjectList)
+ {
+ int nCount = maObjectList.size();
+ boolean bShowDescriptions = getShowDescriptions();
+ boolean bShowNames = getShowNames();
+ boolean bShowText = getShowText();
+ for (int i=0; i<nCount; i++)
+ {
+ CanvasShape aCanvasShape = (CanvasShape)maObjectList.elementAt(i);
+ aCanvasShape.paint (
+ g2,
+ mnHOffset, mnVOffset, mnScale,
+ bShowDescriptions, bShowNames, bShowText);
+ }
+ }
+
+ // Paint highlighted frame around active object as the last thing.
+ if (maActiveObject != null)
+ maActiveObject.paint_highlight (
+ g2,
+ mnHOffset, mnVOffset, mnScale);
+ }
+ }
+
+
+
+
+ /** 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 = getZoomMode();
+ 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;
+ }
+
+
+
+ /** Call getAccessibleAt to determine accessible object under mouse.
+ */
+ public void mouseClicked (MouseEvent e)
+ {
+ }
+
+ public void mousePressed (MouseEvent e)
+ {
+ CanvasShape aObjectUnderMouse = FindCanvasShapeUnderMouse (e);
+ highlightObject (aObjectUnderMouse);
+ if ((e.getModifiers() & InputEvent.CTRL_MASK) != 0)
+ {
+ maTree.expandPath (aObjectUnderMouse.getPath());
+ }
+ }
+
+ public void mouseReleased (MouseEvent e)
+ {
+ }
+
+ public void mouseEntered (MouseEvent e)
+ {
+ }
+
+ public void mouseExited (MouseEvent e)
+ {
+ // Deselect currently active object.
+ if (maActiveObject != null)
+ {
+ maActiveObject.unhighlight ();
+ maActiveObject = null;
+ repaint ();
+ }
+ }
+
+ public void mouseDragged (MouseEvent e)
+ {
+ }
+
+ public void mouseMoved (MouseEvent e)
+ {
+ if ((e.getModifiers() & InputEvent.SHIFT_MASK) != 0)
+ highlightObject (FindCanvasShapeUnderMouse (e));
+ }
+
+ protected CanvasShape FindCanvasShapeUnderMouse (MouseEvent e)
+ {
+ int nObjects = maObjects.size();
+ CanvasShape aObjectUnderMouse = null;
+ int nCount = maObjectList.size();
+ for (int i=nCount-1; i>=0; --i)
+ {
+ CanvasShape aObject = (CanvasShape)maObjectList.elementAt(i);
+ if (aObject != null)
+ if (aObject.contains (e.getX(),e.getY()))
+ {
+ aObjectUnderMouse = aObject;
+ break;
+ }
+ }
+ return aObjectUnderMouse;
+ }
+
+ protected boolean highlightObject (CanvasShape aNewActiveObject)
+ {
+ if (aNewActiveObject != maActiveObject)
+ {
+ if (maActiveObject != null)
+ maActiveObject.unhighlight();
+
+ maActiveObject = aNewActiveObject;
+ if (maActiveObject != null)
+ {
+ if (maTree != null)
+ {
+ maTree.scrollPathToVisible (maActiveObject.getPath());
+ maTree.setSelectionPath (maActiveObject.getPath());
+ maTree.repaint ();
+ }
+ maActiveObject.highlight ();
+ repaint ();
+ }
+ return true;
+ }
+ else
+ return false;
+ }
+
+ /** Called when the selection of the tree changes. Highlight the
+ corresponding graphical representation of the first selected object.
+ */
+ public void valueChanged (javax.swing.event.TreeSelectionEvent event)
+ {
+ TreePath aPath = event.getPath();
+ Object aObject = aPath.getLastPathComponent();
+ if (aObject instanceof AccTreeNode)
+ {
+ CanvasShape aCanvasShape = (CanvasShape)maObjects.get ((AccTreeNode)aObject);
+ if (highlightObject (aCanvasShape))
+ repaint();
+ }
+ }
+
+ private int
+ mnXAnchor,
+ mnYAnchor,
+ maResizeFlag;
+ private double
+ mnHOffset,
+ mnVOffset,
+ mnScale;
+ private CanvasShape
+ maActiveObject;
+ private java.util.HashMap
+ maObjects;
+ private Vector
+ maObjectList,
+ maContexts,
+ maNodes;
+ private Rectangle
+ maBoundingBox;
+ private JTree
+ maTree;
+ // The size of the widget at the last call of setupTransformation()
+ private Dimension
+ maLastWidgetSize;
+}
diff --git a/toolkit/test/accessibility/CanvasShape.java b/toolkit/test/accessibility/CanvasShape.java
new file mode 100644
index 000000000000..57cedebb9e88
--- /dev/null
+++ b/toolkit/test/accessibility/CanvasShape.java
@@ -0,0 +1,330 @@
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.tree.*;
+import java.awt.geom.Rectangle2D;
+
+import com.sun.star.beans.XPropertyChangeListener;
+import com.sun.star.beans.PropertyChangeEvent;
+
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleExtendedComponent;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.accessibility.AccessibleStateType;
+
+class CanvasShape
+{
+ public final Color maHighlightColor = Color.red;
+ public final Color maSelectionColor = Color.green;
+ public final Color maFocusColor = Color.blue;
+
+ // public AccessibleObject (XAccessibleContext xContext, TreePath aPath)
+ public CanvasShape (AccTreeNode aNode)
+ {
+ maNode = aNode;
+ mxContext = aNode.getContext();
+ msName = "name unknown";
+ msDescription = "description unknown";
+ 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;
+ mxComponent = aNode.getComponent();
+
+ update ();
+ }
+
+
+
+ /** Update the data obtained from the xAccessible.
+ */
+ public void update ()
+ {
+ 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,
+ double nXOffset, double nYOffset, double nScaleFactor,
+ 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 * nScaleFactor + nXOffset,
+ maPosition.y * nScaleFactor + nYOffset,
+ maSize.width * nScaleFactor,
+ maSize.height * nScaleFactor);
+
+ // 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,
+ double nXOffset, double nYOffset, double nScaleFactor)
+ {
+ 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 = maNode.getText();
+
+ // 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)
+ {}
+ }
+ }
+
+
+
+
+ /** Callback for disposing events.
+ */
+ public void disposing (com.sun.star.lang.EventObject e)
+ {
+ System.out.println ("Disposing");
+ }
+
+
+
+
+ /** Compute whether the specified point lies inside the object's
+ bounding box.
+ */
+ public boolean contains (int x, int y)
+ {
+ return (maShape.contains (x,y));
+ }
+
+ public void highlight ()
+ {
+ mbHighlighted = true;
+ }
+
+ public void unhighlight ()
+ {
+ mbHighlighted = false;
+ }
+
+ public boolean isHighlighted ()
+ {
+ return mbHighlighted;
+ }
+
+ public Rectangle getBBox ()
+ {
+ return new Rectangle (maPosition, maSize);
+ }
+
+ public Point getOrigin ()
+ {
+ return maPosition;
+ }
+
+ public TreePath getPath ()
+ {
+ return new TreePath (maNode.createPath());
+ }
+
+ 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+"<";
+ }
+
+ private AccTreeNode
+ maNode;
+ private XAccessibleContext
+ mxContext;
+ private XAccessibleComponent
+ mxComponent;
+ private String
+ msDescription,
+ msName;
+ private Rectangle2D.Double
+ maShape;
+ 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/toolkit/test/accessibility/ChildEventHandler.java b/toolkit/test/accessibility/ChildEventHandler.java
new file mode 100644
index 000000000000..b73c90feac6d
--- /dev/null
+++ b/toolkit/test/accessibility/ChildEventHandler.java
@@ -0,0 +1,46 @@
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+
+class ChildEventHandler
+ extends EventHandler
+{
+ public ChildEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ mxOldChild = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.OldValue);
+ mxNewChild = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.NewValue);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ if (mxOldChild != null)
+ out.println (" removing child " + mxOldChild);
+ if (mxNewChild != null)
+ out.println (" adding child " + mxNewChild);
+ }
+
+ public void Process ()
+ {
+ // Insertion and removal of children should be mutually exclusive.
+ // But this is a test tool and should take everything into account.
+ if (mxOldChild != null)
+ {
+ maTreeModel.removeNode (mxOldChild.getAccessibleContext());
+ maTreeModel.updateNode (mxEventSource, AccessibleTreeHandler.class);
+ }
+
+ if (mxNewChild != null)
+ {
+ maTreeModel.addChild (mxEventSource, mxNewChild);
+ }
+ }
+
+
+ private XAccessible mxOldChild;
+ private XAccessible mxNewChild;
+}
diff --git a/toolkit/test/accessibility/ContextEventHandler.java b/toolkit/test/accessibility/ContextEventHandler.java
new file mode 100644
index 000000000000..ab7166fdede1
--- /dev/null
+++ b/toolkit/test/accessibility/ContextEventHandler.java
@@ -0,0 +1,52 @@
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.AnyConverter;
+
+import java.io.PrintStream;
+
+import tools.NameProvider;
+
+class ContextEventHandler
+ extends EventHandler
+{
+ public ContextEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ switch (mnEventId)
+ {
+ case AccessibleEventId.STATE_CHANGED:
+ try
+ {
+ int nOldValue = AnyConverter.toInt (maEvent.OldValue);
+ out.println (" turning off state " + nOldValue + " ("
+ + NameProvider.getStateName (nOldValue) + ")");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {}
+ try
+ {
+ int nNewValue = AnyConverter.toInt (maEvent.NewValue);
+ out.println (" turning on state " + nNewValue + " ("
+ + NameProvider.getStateName (nNewValue) + ")");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {}
+ break;
+
+ default:
+ super.PrintOldAndNew (out);
+ }
+
+ }
+
+ public void Process ()
+ {
+ maTreeModel.updateNode (mxEventSource, AccessibleContextHandler.class);
+ }
+}
diff --git a/toolkit/test/accessibility/EventHandler.java b/toolkit/test/accessibility/EventHandler.java
new file mode 100644
index 000000000000..69f7fd2144f0
--- /dev/null
+++ b/toolkit/test/accessibility/EventHandler.java
@@ -0,0 +1,57 @@
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+
+import tools.NameProvider;
+
+/** Base class for handling of accessibility events.
+*/
+class EventHandler
+{
+ public EventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ maEvent = aEvent;
+ maTreeModel = aTreeModel;
+
+ mnEventId = aEvent.EventId;
+
+ mxEventSource = (XAccessibleContext)UnoRuntime.queryInterface(
+ XAccessibleContext.class, aEvent.Source);
+ if (mxEventSource == null)
+ {
+ XAccessible xAccessible = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.Source);
+ if (xAccessible != null)
+ mxEventSource = xAccessible.getAccessibleContext();
+ }
+ }
+
+ public void Print (PrintStream out)
+ {
+ out.println ("Event id is " + mnEventId
+ + " (" + NameProvider.getEventName(mnEventId)+")"
+ + " for " + mxEventSource.getAccessibleName() + " / "
+ + NameProvider.getRoleName (mxEventSource.getAccessibleRole()));
+ PrintOldAndNew (out);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ out.println (" old value is " + maEvent.OldValue);
+ out.println (" new value is " + maEvent.NewValue);
+ }
+
+ public void Process ()
+ {
+ System.out.println ("processing of event " + maEvent + " not implemented");
+ }
+
+ protected AccessibleEventObject maEvent;
+ protected AccessibilityTreeModel maTreeModel;
+
+ protected int mnEventId;
+ protected XAccessibleContext mxEventSource;
+}
diff --git a/toolkit/test/accessibility/EventListener.java b/toolkit/test/accessibility/EventListener.java
new file mode 100644
index 000000000000..619c7fdd355e
--- /dev/null
+++ b/toolkit/test/accessibility/EventListener.java
@@ -0,0 +1,124 @@
+
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+import javax.swing.event.TreeModelListener;
+import javax.swing.event.TreeModelEvent;
+
+import java.util.Vector;
+import java.util.HashMap;
+import java.util.Enumeration;
+
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.*;
+
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.Any;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lang.XServiceName;
+
+/** Objects of this class (usually one, singleton?) listen to accessible
+ events of all objects in all trees.
+*/
+public class EventListener
+{
+ public boolean mbVerbose = false;
+
+ public EventListener (AccessibilityTreeModel aTreeModel)
+ {
+ maTreeModel = aTreeModel;
+ }
+
+
+ private static String objectToString(Object aObject)
+ {
+ if (aObject == null)
+ return null;
+ else
+ return aObject.toString();
+ }
+
+
+
+ /** This method handles accessibility objects that are being disposed.
+ */
+ public void disposing (XAccessibleContext xContext)
+ {
+ if (mbVerbose)
+ System.out.println("disposing " + xContext);
+ maTreeModel.removeNode (xContext);
+ }
+
+ /** This method is called from accessible objects that broadcast
+ modifications of themselves or from their children. The event is
+ processed only, except printing some messages, if the tree is not
+ locked. It should be locked during changes to its internal
+ structure like expanding nodes.
+ */
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ EventHandler aHandler;
+
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.CHILD:
+ aHandler = new ChildEventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.BOUNDRECT_CHANGED:
+ case AccessibleEventId.VISIBLE_DATA_CHANGED:
+ aHandler = new GeometryEventHandler (aEvent, maTreeModel);
+ break;
+
+
+ case AccessibleEventId.NAME_CHANGED:
+ case AccessibleEventId.DESCRIPTION_CHANGED:
+ case AccessibleEventId.STATE_CHANGED:
+ case AccessibleEventId.SELECTION_CHANGED:
+ aHandler = new ContextEventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.TABLE_MODEL_CHANGED:
+ case AccessibleEventId.TABLE_CAPTION_CHANGED:
+ case AccessibleEventId.TABLE_COLUMN_DESCRIPTION_CHANGED:
+ case AccessibleEventId.TABLE_COLUMN_HEADER_CHANGED:
+ case AccessibleEventId.TABLE_ROW_DESCRIPTION_CHANGED:
+ case AccessibleEventId.TABLE_ROW_HEADER_CHANGED:
+ case AccessibleEventId.TABLE_SUMMARY_CHANGED:
+ aHandler = new TableEventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.ACTION_CHANGED:
+ aHandler = new EventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.HYPERTEXT_CHANGED:
+ aHandler = new EventHandler (aEvent, maTreeModel);
+ break;
+
+ case AccessibleEventId.ACTIVE_DESCENDANT_CHANGED:
+ case AccessibleEventId.CARET_CHANGED:
+ case AccessibleEventId.TEXT_CHANGED:
+ case AccessibleEventId.VALUE_CHANGED:
+ aHandler = new EventHandler (aEvent, maTreeModel);
+ break;
+
+ default:
+ aHandler = null;
+ break;
+ }
+
+ if (aHandler == null)
+ System.out.println (" unhandled event");
+ else
+ {
+ if (mbVerbose)
+ aHandler.Print (System.out);
+ aHandler.Process ();
+ }
+ }
+
+
+ private AccessibilityTreeModel maTreeModel;
+}
diff --git a/toolkit/test/accessibility/EventLogger.java b/toolkit/test/accessibility/EventLogger.java
new file mode 100644
index 000000000000..de0b8e6aee9d
--- /dev/null
+++ b/toolkit/test/accessibility/EventLogger.java
@@ -0,0 +1,31 @@
+import javax.swing.JFrame;
+import javax.swing.JScrollPane;
+
+class EventLogger
+{
+ public static synchronized EventLogger Instance ()
+ {
+ if (maInstance == null)
+ maInstance = new EventLogger();
+ return maInstance;
+ }
+
+ private EventLogger ()
+ {
+ try
+ {
+ maFrame = new JFrame ();
+ maLogger = new TextLogger ();
+ maFrame.setContentPane (new JScrollPane (maLogger));
+
+ maFrame.setSize (400,300);
+ maFrame.setVisible (true);
+ }
+ catch (Exception e)
+ {}
+ }
+
+ private static EventLogger maInstance = null;
+ private JFrame maFrame;
+ private TextLogger maLogger;
+}
diff --git a/toolkit/test/accessibility/EventQueue.java b/toolkit/test/accessibility/EventQueue.java
new file mode 100644
index 000000000000..9c90af9c63b7
--- /dev/null
+++ b/toolkit/test/accessibility/EventQueue.java
@@ -0,0 +1,126 @@
+import com.sun.star.accessibility.*;
+import com.sun.star.lang.EventObject;
+
+import java.util.LinkedList;
+
+/** The event queue singleton dispatches events received from OpenOffice.org
+ applications in a thread separate from the AWB main thread.
+
+ The queue of event objects, LinkedList<Runnable> The queue object will
+ also serve as lock for the consumer/producer type syncronization.
+*/
+class EventQueue
+ implements Runnable
+{
+ public boolean mbVerbose = false;
+ public boolean mbHandleDisposingEventsSynchronous = true;
+
+ public synchronized static EventQueue Instance ()
+ {
+ if (maInstance == null)
+ maInstance = new EventQueue ();
+ return maInstance;
+ }
+
+ public void addEvent (Runnable aEvent)
+ {
+ synchronized (maMonitor)
+ {
+ if (mbVerbose)
+ System.out.println ("queing regular event " + aEvent);
+ maRegularQueue.addLast (aEvent);
+ maMonitor.notify ();
+ }
+ }
+
+
+ public void addDisposingEvent (Runnable aEvent)
+ {
+ if (mbHandleDisposingEventsSynchronous)
+ aEvent.run ();
+ else
+ synchronized (maMonitor)
+ {
+ if (mbVerbose)
+ System.out.println ("queing disposing event " + aEvent);
+ maDisposingQueue.addLast (aEvent);
+ maMonitor.notify ();
+ }
+ }
+
+
+ private EventQueue ()
+ {
+ maMonitor = new Boolean (true);
+ maRegularQueue = new LinkedList();
+ maDisposingQueue = new LinkedList();
+ new Thread(this, "AWB.EventQueue").start();
+ }
+
+
+ /// This thread's main method: deliver all events
+ public void run()
+ {
+ // in an infinite loop, check for events to deliver, then
+ // wait on lock (which will be notified when new events arrive)
+ while( true )
+ {
+ Runnable aEvent = null;
+ do
+ {
+ synchronized (maMonitor)
+ {
+ if (maDisposingQueue.size() > 0)
+ {
+ aEvent = (Runnable)maDisposingQueue.removeFirst();
+ if (mbVerbose)
+ System.out.println ("delivering disposing event " + aEvent);
+ }
+ else if (maRegularQueue.size() > 0)
+ {
+ aEvent = (Runnable)maRegularQueue.removeFirst();
+ if (mbVerbose)
+ System.out.println ("delivering regular event " + aEvent);
+ }
+ else
+ aEvent = null;
+ }
+ if (aEvent != null)
+ {
+ try
+ {
+ aEvent.run();
+ }
+ catch( Throwable e )
+ {
+ System.out.println(
+ "caught exception during event delivery: " + e );
+ e.printStackTrace();
+ }
+ }
+ }
+ while( aEvent != null );
+
+ try
+ {
+ synchronized (maMonitor)
+ {
+ maMonitor.wait();
+ }
+ }
+ catch (Exception e)
+ {
+ // can't wait? odd!
+ System.err.println("Can't wait!");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private static EventQueue maInstance = null;
+ private Object maMonitor;
+ private LinkedList maRegularQueue;
+ private LinkedList maDisposingQueue;
+}
+
+
diff --git a/toolkit/test/accessibility/FrameActionListener.java b/toolkit/test/accessibility/FrameActionListener.java
new file mode 100644
index 000000000000..30324fb9bc52
--- /dev/null
+++ b/toolkit/test/accessibility/FrameActionListener.java
@@ -0,0 +1,21 @@
+import com.sun.star.frame.XFrameActionListener;
+import com.sun.star.frame.FrameActionEvent;
+
+import com.sun.star.lang.EventObject;
+
+public class FrameActionListener
+ implements XFrameActionListener
+{
+ public FrameActionListener ()
+ {
+ }
+
+ public void frameAction (com.sun.star.frame.FrameActionEvent aEvent)
+ {
+ System.out.println ("frame action");
+ }
+
+ public void disposing (com.sun.star.lang.EventObject aEvent)
+ {
+ }
+}
diff --git a/toolkit/test/accessibility/GeometryEventHandler.java b/toolkit/test/accessibility/GeometryEventHandler.java
new file mode 100644
index 000000000000..07236785e862
--- /dev/null
+++ b/toolkit/test/accessibility/GeometryEventHandler.java
@@ -0,0 +1,54 @@
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+import java.util.LinkedList;
+
+class GeometryEventHandler
+ extends EventHandler
+{
+ public GeometryEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ out.println (" children not relevant");
+ }
+
+ public void Process ()
+ {
+ AccTreeNode aNode = maTreeModel.updateNode (mxEventSource,
+ AccessibleComponentHandler.class,
+ AccessibleExtendedComponentHandler.class);
+
+ // Update the graphical representation of aNode in the Canvas.
+ Canvas aCanvas = maTreeModel.getCanvas();
+ if (aCanvas != null)
+ {
+ // Iterate over all nodes in the sub-tree rooted in aNode.
+ LinkedList aShapeQueue = new LinkedList();
+ aShapeQueue.addLast (aNode);
+ while (aShapeQueue.size() > 0)
+ {
+ // Remove the first node from the queue and update its
+ // graphical representation.
+ AccTreeNode aShapeNode = (AccTreeNode) aShapeQueue.getFirst();
+ aShapeQueue.removeFirst();
+ aCanvas.updateNodeGeometry (aShapeNode);
+
+ // Add the node's children to the queue.
+ int nChildCount = maTreeModel.getChildCount (aShapeNode);
+ for (int i=0; i<nChildCount; i++)
+ {
+ Object aTreeNode = maTreeModel.getChildNoCreate (aShapeNode, i);
+ if (aTreeNode instanceof AccTreeNode)
+ aShapeQueue.addLast (aTreeNode);
+ }
+ }
+ aCanvas.repaint ();
+ }
+ }
+}
diff --git a/toolkit/test/accessibility/HelpWindow.java b/toolkit/test/accessibility/HelpWindow.java
new file mode 100644
index 000000000000..74627ad99761
--- /dev/null
+++ b/toolkit/test/accessibility/HelpWindow.java
@@ -0,0 +1,185 @@
+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;
+
+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/toolkit/test/accessibility/InformationWriter.java b/toolkit/test/accessibility/InformationWriter.java
new file mode 100755
index 000000000000..e119d2037350
--- /dev/null
+++ b/toolkit/test/accessibility/InformationWriter.java
@@ -0,0 +1,415 @@
+import java.lang.Thread;
+
+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 ()
+ {
+ }
+
+ 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);
+ MessageArea.println (prefix +
+ xPropertySet.getPropertyValue (name));
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception while getting property "
+ + name + " : " + e);
+ }
+ }
+
+
+
+ public void showShapes (XDrawPage xPage)
+ {
+ try
+ {
+ XIndexAccess xShapeList = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xPage);
+
+ MessageArea.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 ();
+ MessageArea.println (" shape " + i + " : " + sName);
+
+ XPropertySet xPropertySet =
+ (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xShape);
+ Integer nZOrder =
+ (Integer) xPropertySet.getPropertyValue ("ZOrder");
+ MessageArea.println (" zorder = " + nZOrder);
+ }
+ }
+ catch (Exception e)
+ {
+ MessageArea.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
+ {
+ MessageArea.println ("Services:");
+ XMultiServiceFactory xMSF = (XMultiServiceFactory) UnoRuntime.queryInterface (
+ XMultiServiceFactory.class,
+ xObject
+ );
+ if (xMSF == null)
+ MessageArea.println (" object does not support interface XMultiServiceFactory");
+ else
+ {
+ String[] sServiceNames = xMSF.getAvailableServiceNames ();
+ MessageArea.println (" object can create "
+ + sServiceNames.length + " services");
+ for (int i=0; i<sServiceNames.length; i++)
+ MessageArea.println (" service " + i + " : " + sServiceNames[i]);
+ }
+ }
+ catch (Exception e)
+ {
+ MessageArea.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)
+ MessageArea.println (" interface XServiceName not supported");
+ else
+ {
+ MessageArea.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)
+ MessageArea.println (" interface XServiceInfo not supported");
+ else
+ {
+ MessageArea.println (" Implementation name : "
+ + xSI.getImplementationName ());
+ }
+ }
+ catch (Exception e)
+ {
+ MessageArea.println ("caught exception in showInfo : " + e);
+ }
+ }
+
+
+
+
+ /** @descr Print information about supported interfaces.
+ */
+ public void showInterfaces (XInterface xObject)
+ {
+ try
+ {
+ MessageArea.println ("Interfaces:");
+ // Use interface XTypeProvider to retrieve a list of supported
+ // interfaces.
+ XTypeProvider xTP = (XTypeProvider) UnoRuntime.queryInterface (
+ XTypeProvider.class, xObject);
+ if (xTP == null)
+ MessageArea.println (" interface XTypeProvider not supported");
+ else
+ {
+ Type[] aTypeList = xTP.getTypes ();
+ MessageArea.println (" object supports " + aTypeList.length
+ + " interfaces");
+ for (int i=0; i<aTypeList.length; i++)
+ MessageArea.println (" " + i + " : "
+ + aTypeList[i].getTypeName());
+ }
+ }
+ catch (Exception e)
+ {
+ MessageArea.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)
+ {
+ MessageArea.println (sIndent + "given object " + xObject
+ + " is not accessible");
+ return false;
+ }
+ else
+ xContext = xAccessible.getAccessibleContext();
+ }
+
+ // Print information about the accessible context.
+ if (xContext != null)
+ {
+ MessageArea.println (sIndent + "Name : "
+ + xContext.getAccessibleName());
+ MessageArea.println (sIndent + "Description : "
+ + xContext.getAccessibleDescription());
+ MessageArea.println (sIndent + "Role : "
+ + xContext.getAccessibleRole());
+ String sHasParent;
+ if (xContext.getAccessibleParent() != null)
+ {
+ MessageArea.println (sIndent + "Has parent : yes");
+ MessageArea.println (sIndent + "Parent index : "
+ + xContext.getAccessibleIndexInParent());
+ }
+ else
+ MessageArea.println (sIndent + "Has parent : no");
+ MessageArea.println (sIndent + "Child count : "
+ + xContext.getAccessibleChildCount());
+ MessageArea.print (sIndent + "Relation set : ");
+ XAccessibleRelationSet xRelationSet
+ = xContext.getAccessibleRelationSet();
+ if (xRelationSet != null)
+ {
+ MessageArea.print (xRelationSet.getRelationCount() + " (");
+ for (int i=0; i<xRelationSet.getRelationCount(); i++)
+ {
+ if (i > 0)
+ MessageArea.print (", ");
+ MessageArea.print (xRelationSet.getRelation(i).toString());
+ }
+ MessageArea.println (")");
+ }
+ else
+ MessageArea.println ("no relation set");
+
+ MessageArea.print (sIndent + "State set : ");
+ XAccessibleStateSet xStateSet =
+ xContext.getAccessibleStateSet();
+ if (xStateSet != null)
+ {
+ XIndexAccess xStates =
+ (XIndexAccess) UnoRuntime.queryInterface (
+ XIndexAccess.class, xStateSet);
+ MessageArea.print (xStates.getCount() + " (");
+ for (int i=0; i<xStates.getCount(); i++)
+ {
+ if (i > 0)
+ MessageArea.print (", ");
+ MessageArea.print (xStates.getByIndex(i).toString());
+ }
+ MessageArea.println (")");
+ }
+ else
+ MessageArea.println ("no state set");
+
+ showAccessibleComponent (xContext, sIndent);
+ }
+ else
+ MessageArea.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)
+ {
+ MessageArea.println (sIndent + "Position : "
+ + xComponent.getLocation().X+", "
+ + xComponent.getLocation().Y);
+ MessageArea.println (sIndent + "Screen position : "
+ + xComponent.getLocationOnScreen().X+", "
+ + xComponent.getLocationOnScreen().Y);
+ MessageArea.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++)
+ {
+ MessageArea.println (sIndent + "child " + i + " :");
+ showAccessibilityTree (xContext.getAccessibleChild(i),depth+1);
+ }
+ }
+ else
+ MessageArea.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)
+ MessageArea.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++)
+ MessageArea.println (i + " : " + aProperties[i].Name +", " + aProperties[i].Type);
+ }
+ }
+}
diff --git a/toolkit/test/accessibility/MessageArea.java b/toolkit/test/accessibility/MessageArea.java
new file mode 100644
index 000000000000..c9d95995e066
--- /dev/null
+++ b/toolkit/test/accessibility/MessageArea.java
@@ -0,0 +1,123 @@
+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/toolkit/test/accessibility/MessageInterface.java b/toolkit/test/accessibility/MessageInterface.java
new file mode 100755
index 000000000000..ad189bb8214f
--- /dev/null
+++ b/toolkit/test/accessibility/MessageInterface.java
@@ -0,0 +1,5 @@
+interface MessageInterface
+{
+ void message (String text);
+}
+
diff --git a/toolkit/test/accessibility/NodeFactory.java b/toolkit/test/accessibility/NodeFactory.java
new file mode 100644
index 000000000000..403c482e5ea1
--- /dev/null
+++ b/toolkit/test/accessibility/NodeFactory.java
@@ -0,0 +1,147 @@
+import com.sun.star.accessibility.*;
+import java.util.Vector;
+
+import tools.NameProvider;
+
+/** This singleton class creates nodes for given accessible objects.
+*/
+class NodeFactory
+{
+ public synchronized static NodeFactory Instance ()
+ {
+ if (maInstance == null)
+ {
+ maInstance = new NodeFactory();
+ }
+ return maInstance;
+ }
+
+ private NodeFactory ()
+ {
+ mbVerbose = false;
+
+ maContextHandler = new AccessibleContextHandler();
+ maTextHandler = new AccessibleTextHandler();
+ maEditableTextHandler = new AccessibleEditableTextHandler();
+ maComponentHandler = new AccessibleComponentHandler();
+ maExtendedComponentHandler = new AccessibleExtendedComponentHandler();
+ maActionHandler = new AccessibleActionHandler();
+ maImageHandler = new AccessibleImageHandler();
+ maTableHandler = new AccessibleTableHandler();
+ maCellHandler = new AccessibleCellHandler();
+ maHypertextHandler = new AccessibleHypertextHandler();
+ maHyperlinkHandler = new AccessibleHyperlinkHandler();
+ maSelectionHandler = new AccessibleSelectionHandler();
+ maRelationHandler = new AccessibleRelationHandler();
+ maTreeHandler = new AccessibleTreeHandler();
+ maUNOHandler = new AccessibleUNOHandler();
+ }
+
+
+ /** add default handlers based on the supported interfaces */
+ private void addDefaultHandlers (AccTreeNode aNode, XAccessibleContext xContext)
+ {
+ if (false)
+ {
+ // Slow but complete version: try each handler type separately.
+ aNode.addHandler (maContextHandler.createHandler (xContext));
+ aNode.addHandler (maTextHandler.createHandler (xContext));
+ aNode.addHandler (maEditableTextHandler.createHandler (xContext));
+ aNode.addHandler (maComponentHandler.createHandler (xContext));
+ aNode.addHandler (maExtendedComponentHandler.createHandler (xContext));
+ aNode.addHandler (maActionHandler.createHandler (xContext));
+ aNode.addHandler (maImageHandler.createHandler (xContext));
+ aNode.addHandler (maTableHandler.createHandler (xContext));
+ aNode.addHandler (maCellHandler.createHandler (xContext));
+ aNode.addHandler (maHypertextHandler.createHandler (xContext));
+ aNode.addHandler (maHyperlinkHandler.createHandler (xContext));
+ aNode.addHandler (maSelectionHandler.createHandler (xContext));
+ aNode.addHandler (maRelationHandler.createHandler (xContext));
+ aNode.addHandler (maUNOHandler.createHandler (xContext));
+ aNode.addHandler (maTreeHandler.createHandler (xContext));
+ }
+ else
+ {
+ // Exploit dependencies between interfaces.
+ NodeHandler aHandler;
+ aNode.addHandler (maContextHandler.createHandler (xContext));
+
+ aHandler = maTextHandler.createHandler (xContext);
+ if (aHandler != null)
+ {
+ aNode.addHandler (aHandler);
+ aNode.addHandler (maEditableTextHandler.createHandler (xContext));
+ aNode.addHandler (maHypertextHandler.createHandler (xContext));
+ aNode.addHandler (maHyperlinkHandler.createHandler (xContext));
+ }
+ aHandler = maComponentHandler.createHandler (xContext);
+ if (aHandler != null)
+ {
+ aNode.addHandler (aHandler);
+ aNode.addHandler (maExtendedComponentHandler.createHandler (xContext));
+ }
+ aNode.addHandler (maActionHandler.createHandler (xContext));
+ aNode.addHandler (maImageHandler.createHandler (xContext));
+ aNode.addHandler (maTableHandler.createHandler (xContext));
+ aNode.addHandler (maRelationHandler.createHandler (xContext));
+ aNode.addHandler (maCellHandler.createHandler (xContext));
+ aNode.addHandler (maSelectionHandler.createHandler (xContext));
+ aNode.addHandler (maUNOHandler.createHandler (xContext));
+ aNode.addHandler (maTreeHandler.createHandler (xContext));
+ }
+ }
+
+ /** create a node with the default handlers */
+ public AccTreeNode createDefaultNode (XAccessible xAccessible, AccessibleTreeNode aParent)
+ {
+ // default: aObject + aDisplay
+ String sDisplay;
+
+ // if we are accessible, we use the context + name instead
+ XAccessibleContext xContext = null;
+ if (xAccessible != null)
+ xContext = xAccessible.getAccessibleContext();
+ if (xContext != null)
+ {
+ sDisplay = xContext.getAccessibleName();
+ if (sDisplay.length()==0)
+ {
+ sDisplay = "<no name> Role: "
+ + NameProvider.getRoleName (
+ xContext.getAccessibleRole());
+ }
+ }
+ else
+ sDisplay = new String ("not accessible");
+
+
+ // create node, and add default handlers
+ AccTreeNode aNode = new AccTreeNode (xAccessible, xContext, sDisplay, aParent);
+ addDefaultHandlers (aNode, xContext);
+
+ if (aNode == null)
+ System.out.println ("createDefaultNode == null");
+ return aNode;
+ }
+
+ private static NodeFactory maInstance = null;
+
+ private boolean mbVerbose;
+
+ // default handlers
+ private NodeHandler maContextHandler = new AccessibleContextHandler();
+ private NodeHandler maTextHandler = new AccessibleTextHandler();
+ private NodeHandler maEditableTextHandler = new AccessibleEditableTextHandler();
+ private NodeHandler maComponentHandler = new AccessibleComponentHandler();
+ private NodeHandler maExtendedComponentHandler = new AccessibleExtendedComponentHandler();
+ private NodeHandler maActionHandler = new AccessibleActionHandler();
+ private NodeHandler maImageHandler = new AccessibleImageHandler();
+ private NodeHandler maTableHandler = new AccessibleTableHandler();
+ private NodeHandler maCellHandler = new AccessibleCellHandler();
+ private NodeHandler maHypertextHandler = new AccessibleHypertextHandler();
+ private NodeHandler maHyperlinkHandler = new AccessibleHyperlinkHandler();
+ private NodeHandler maSelectionHandler = new AccessibleSelectionHandler();
+ private NodeHandler maRelationHandler = new AccessibleRelationHandler();
+ private NodeHandler maTreeHandler = new AccessibleTreeHandler();
+ private NodeHandler maUNOHandler = new AccessibleUNOHandler();
+}
diff --git a/toolkit/test/accessibility/NodeHandler.java b/toolkit/test/accessibility/NodeHandler.java
new file mode 100644
index 000000000000..b39741b1f398
--- /dev/null
+++ b/toolkit/test/accessibility/NodeHandler.java
@@ -0,0 +1,140 @@
+import java.util.Vector;
+
+
+/**
+ * Map an arbitrary object into parts of a tree node.
+ */
+abstract class NodeHandler
+{
+ /** This vector is used as cache for the child objects.
+ */
+ protected Vector maChildList;
+
+
+ public abstract NodeHandler createHandler (
+ com.sun.star.accessibility.XAccessibleContext xContext);
+
+ public NodeHandler ()
+ {
+ maChildList = new Vector ();
+ }
+
+ /** Clear the cache of child objects.
+ */
+ public void clear ()
+ {
+ synchronized (maChildList)
+ {
+ maChildList = new Vector ();
+ }
+ }
+
+ /** This factory method creates an individual handler for the specified
+ object that may hold information to accelerate the access to its children.
+ */
+ // public abstract NodeHandler createHandler (Object aObject);
+
+ /** return the number of children this object has */
+ public int getChildCount(Object aObject)
+ {
+ synchronized (maChildList)
+ {
+ return maChildList.size();
+ }
+ }
+
+ /**
+ * return a child object. Complex
+ * children have to be AccTreeNode instances.
+ * @see AccTreeNode
+ */
+ public AccessibleTreeNode getChild (AccessibleTreeNode aParent, int nIndex)
+ {
+ synchronized (maChildList)
+ {
+ AccessibleTreeNode aChild = (AccessibleTreeNode)maChildList.get(nIndex);
+ if (aChild == null)
+ {
+ aChild = createChild (aParent, nIndex);
+ if (aChild == null)
+ aChild = new StringNode ("could not create child", aParent);
+ maChildList.setElementAt (aChild, nIndex);
+ }
+ return aChild;
+ }
+ }
+
+ public AccessibleTreeNode getChildNoCreate (AccessibleTreeNode aParent, int nIndex)
+ {
+ synchronized (maChildList)
+ {
+ return (AccessibleTreeNode)maChildList.get(nIndex);
+ }
+ }
+
+ /** Remove the specified child from the list of children.
+ */
+ public boolean removeChild (AccessibleTreeNode aNode, int nIndex)
+ {
+ try
+ {
+ synchronized (maChildList)
+ {
+ System.out.println (" removing child at position " + nIndex + ": "
+ + maChildList.elementAt (nIndex));
+ maChildList.remove (nIndex);
+ }
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public int indexOf (AccessibleTreeNode aNode)
+ {
+ synchronized (maChildList)
+ {
+ return maChildList.indexOf (aNode);
+ }
+ }
+
+ /** Create a child object for the specified data. This method is called
+ usually from getChild and put there into the cache.
+ */
+ public abstract AccessibleTreeNode createChild (
+ AccessibleTreeNode aParent, int nIndex);
+
+ //
+ // The following methods support editing of children and actions.
+ // They have default implementations for no actions and read-only.
+ //
+
+ /** May this child be changed? */
+ public boolean isChildEditable (AccessibleTreeNode aNode, int nIndex)
+ {
+ return false;
+ }
+
+ /** change this child's value */
+ // public void setChild(Object aObject, int nIndex) { }
+
+
+ /** get names of suported actions */
+ public String[] getActions (AccessibleTreeNode aNode)
+ {
+ return new String[] {};
+ }
+
+ /** perform action */
+ public void performAction (AccessibleTreeNode aNode, int nIndex)
+ {
+ }
+
+ /** Update all children.
+ */
+ public void update (AccessibleTreeNode aNode)
+ {
+ }
+}
diff --git a/toolkit/test/accessibility/NodeMap.java b/toolkit/test/accessibility/NodeMap.java
new file mode 100644
index 000000000000..43479278aec4
--- /dev/null
+++ b/toolkit/test/accessibility/NodeMap.java
@@ -0,0 +1,112 @@
+import com.sun.star.accessibility.XAccessibleContext;
+
+import java.util.HashMap;
+
+abstract class NodeMapCallback
+{
+ public abstract void Apply (AccTreeNode aNode);
+}
+
+/** This map translates from XAccessible objects to our internal
+ representations.
+*/
+class NodeMap
+{
+ public NodeMap ()
+ {
+ maXAccessibleToNode = new HashMap ();
+ }
+
+ /** Clear the whole map.
+ */
+ public void Clear ()
+ {
+ maXAccessibleToNode.clear();
+ }
+
+ /** @return
+ whether the new node was different from a previous one
+ repspectively was the first one set.
+ */
+ public boolean InsertNode (XAccessibleContext xContext, AccessibleTreeNode aNode)
+ {
+ AccessibleTreeNode aPreviousNode = (AccessibleTreeNode)maXAccessibleToNode.put (
+ xContext,
+ aNode);
+ return aPreviousNode != aNode;
+ }
+
+ protected void RemoveNode (AccessibleTreeNode aNode)
+ {
+ try
+ {
+ if ((aNode != null) && (aNode instanceof AccTreeNode))
+ {
+ maXAccessibleToNode.remove (((AccTreeNode)aNode).getContext());
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception while removing node "
+ + aNode + " : " + e);
+ e.printStackTrace();
+ }
+ }
+
+
+ public void ForEach (NodeMapCallback aFunctor)
+ {
+ Object[] aNodes = maXAccessibleToNode.values().toArray();
+ for (int i=0; i<aNodes.length; i++)
+ {
+ if (aNodes[i] != null && (aNodes[i] instanceof AccTreeNode))
+ {
+ try
+ {
+ aFunctor.Apply ((AccTreeNode)aNodes[i]);
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception applying functor to "
+ + i + "th node " + aNodes[i] + " : " + e);
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ AccessibleTreeNode GetNode (XAccessibleContext xContext)
+ {
+ return (AccessibleTreeNode)maXAccessibleToNode.get (xContext);
+ }
+
+ AccessibleTreeNode GetNode (Object aObject)
+ {
+ if (aObject instanceof XAccessibleContext)
+ return GetNode ((XAccessibleContext)aObject);
+ else
+ return null;
+ }
+
+ XAccessibleContext GetAccessible (AccessibleTreeNode aNode)
+ {
+ if ((aNode != null) && (aNode instanceof AccTreeNode))
+ return ((AccTreeNode)aNode).getContext();
+ else
+ return null;
+ }
+
+ boolean IsMember (XAccessibleContext xContext)
+ {
+ return maXAccessibleToNode.containsKey(xContext);
+ }
+
+ boolean ValueIsMember (AccessibleTreeNode aNode)
+ {
+ return maXAccessibleToNode.containsValue(aNode);
+ }
+
+
+
+ private HashMap maXAccessibleToNode;
+}
diff --git a/toolkit/test/accessibility/OfficeConnection.java b/toolkit/test/accessibility/OfficeConnection.java
new file mode 100755
index 000000000000..4cc5bee1ed78
--- /dev/null
+++ b/toolkit/test/accessibility/OfficeConnection.java
@@ -0,0 +1,102 @@
+// base classes
+import com.sun.star.uno.UnoRuntime;
+
+// factory for creating components
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.bridge.XUnoUrlResolver;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+
+// Exceptions
+import com.sun.star.uno.RuntimeException;
+
+
+/** @descr This class establishes a connection to a StarOffice application.
+ */
+public class OfficeConnection
+{
+ public OfficeConnection (int nPortNumber)
+ {
+ mnDefaultPort = nPortNumber;
+ connect ();
+ }
+
+ /** @descr Return the service manager that represents the connected
+ StarOffice application
+ */
+ public XMultiServiceFactory getServiceManager ()
+ {
+ if ( ! mbInitialized)
+ connect ();
+ return maServiceManager;
+ }
+
+ /** @descr Return a flag that indicates if the constructor has been able to
+ establish a valid connection.
+ */
+ public boolean connectionIsValid ()
+ {
+ return getServiceManager() != null;
+ }
+
+ /** @descr Connect to a already running StarOffice application.
+ */
+ private void connect ()
+ {
+ connect (msDefaultHost, mnDefaultPort);
+ }
+
+ private void connect (String hostname)
+ {
+ connect (hostname, mnDefaultPort);
+ }
+
+ /** @descr Connect to a already running StarOffice application that has
+ been started with a command line argument like
+ "-accept=socket,host=localhost,port=5678;urp;"
+ */
+ private void connect (String hostname, int portnumber)
+ {
+ mbInitialized = true;
+ // Set up connection string.
+ String sConnectString = "uno:socket,host=" + hostname + ",port=" + portnumber
+ + ";urp;StarOffice.ServiceManager";
+
+
+ // connect to a running office and get the ServiceManager
+ try
+ {
+ // Create a URL Resolver.
+ XMultiServiceFactory aLocalServiceManager =
+ com.sun.star.comp.helper.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)
+ {
+ MessageArea.println ("Could not connect with " + sConnectString + " : " + e);
+ MessageArea.println ("Please start OpenOffice/StarOffice with "
+ + "\"-accept=socket,host=localhost,port=5678;urp;\"");
+ }
+ }
+
+ private int mnDefaultPort = 5678;
+ private final String msDefaultHost = "localhost";
+ private XMultiServiceFactory maServiceManager = null;
+
+ /** 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;
+}
diff --git a/toolkit/test/accessibility/Options.java b/toolkit/test/accessibility/Options.java
new file mode 100644
index 000000000000..9b0f6f01889c
--- /dev/null
+++ b/toolkit/test/accessibility/Options.java
@@ -0,0 +1,88 @@
+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.
+*/
+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);
+ }
+
+ static public String GetString (String sName)
+ {
+ return Instance().getProperty (sName);
+ }
+
+ static public void SetBoolean (String sName, boolean bValue)
+ {
+ Instance().setProperty (sName, Boolean.toString(bValue));
+ }
+
+ static public boolean GetBoolean (String sName)
+ {
+ return Boolean.getBoolean(Instance().getProperty (sName));
+ }
+
+ static public void SetInteger (String sName, int nValue)
+ {
+ Instance().setProperty (sName, Integer.toString(nValue));
+ }
+
+ 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)
+ {
+ try
+ {
+ store (new FileOutputStream (ProvideFile(sBaseName)), null);
+ }
+ catch (java.io.IOException e)
+ {
+ }
+ }
+
+ private Options ()
+ {
+ }
+
+ private File ProvideFile (String sBaseName)
+ {
+ return new File (
+ System.getProperty ("user.home"),
+ sBaseName);
+ }
+
+ static private Options saOptions = null;
+}
diff --git a/toolkit/test/accessibility/Print.java b/toolkit/test/accessibility/Print.java
new file mode 100755
index 000000000000..e4d21dc4e092
--- /dev/null
+++ b/toolkit/test/accessibility/Print.java
@@ -0,0 +1,5 @@
+interface Print
+{
+ void print (String text);
+ void println (String text);
+}
diff --git a/toolkit/test/accessibility/QueuedListener.java b/toolkit/test/accessibility/QueuedListener.java
new file mode 100644
index 000000000000..b92d7ac487e6
--- /dev/null
+++ b/toolkit/test/accessibility/QueuedListener.java
@@ -0,0 +1,55 @@
+import com.sun.star.accessibility.*;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.*;
+import com.sun.star.accessibility.*;
+
+import java.util.LinkedList;
+
+class QueuedListener
+ implements XAccessibleEventListener
+{
+ public QueuedListener (EventListener aListener)
+ {
+ maListener = aListener;
+ }
+
+
+ public void disposing( final EventObject aEvent)
+ {
+ XAccessibleContext xContext = (XAccessibleContext)UnoRuntime.queryInterface(
+ XAccessibleContext.class, aEvent.Source);
+ if (xContext == null)
+ {
+ XAccessible xAccessible = (XAccessible)UnoRuntime.queryInterface(
+ XAccessible.class, aEvent.Source);
+ if (xAccessible != null)
+ xContext = xAccessible.getAccessibleContext();
+ }
+ final XAccessibleContext xSource = xContext;
+ EventQueue.Instance().addDisposingEvent (new Runnable()
+ {
+ public void run()
+ {
+ if (QueuedListener.this.maListener != null)
+ QueuedListener.this.maListener.disposing (xSource);
+ }
+ }
+ );
+ }
+
+ public void notifyEvent( final AccessibleEventObject aEvent )
+ {
+ EventQueue.Instance().addEvent (new Runnable()
+ {
+ public void run()
+ {
+ QueuedListener.this.maListener.notifyEvent( aEvent );
+ }
+ }
+ );
+ }
+
+ private EventListener maListener;
+}
+
+
diff --git a/toolkit/test/accessibility/QueuedTopWindowListener.java b/toolkit/test/accessibility/QueuedTopWindowListener.java
new file mode 100644
index 000000000000..61b3472d2002
--- /dev/null
+++ b/toolkit/test/accessibility/QueuedTopWindowListener.java
@@ -0,0 +1,88 @@
+import com.sun.star.awt.XTopWindowListener;
+import com.sun.star.lang.EventObject;
+
+class QueuedTopWindowListener
+ implements XTopWindowListener
+{
+ public QueuedTopWindowListener (TopWindowListener aListener)
+ {
+ maListener = aListener;
+ }
+
+ public void windowOpened (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ EventQueue.Instance().addEvent (new Runnable()
+ {
+ public void run()
+ {
+ QueuedTopWindowListener.this.maListener.windowOpened (aEvent);
+ }
+ }
+ );
+ }
+
+
+
+
+ public void windowClosing (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ // Ignored.
+ }
+
+
+
+
+ public void windowClosed (final com.sun.star.lang.EventObject aEvent) throws RuntimeException
+ {
+ EventQueue.Instance().addEvent (new Runnable()
+ {
+ public void run()
+ {
+ QueuedTopWindowListener.this.maListener.windowClosed (aEvent);
+ }
+ }
+ );
+ }
+
+
+
+
+ public void windowMinimized (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window minimized: " + aEvent);
+ }
+
+ public void windowNormalized (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window normalized: " + aEvent);
+ }
+
+ public void windowActivated (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window actived: " + aEvent);
+ }
+
+ public void windowDeactivated (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ System.out.println ("QueuedTopWindowListener: Top window deactived: " + aEvent);
+ }
+
+ public void disposing( final EventObject aEvent)
+ {
+ EventQueue.Instance().addDisposingEvent (new Runnable()
+ {
+ public void run()
+ {
+ if (QueuedTopWindowListener.this.maListener != null)
+ QueuedTopWindowListener.this.maListener.disposing (aEvent);
+ }
+ }
+ );
+ }
+
+ private TopWindowListener maListener;
+}
diff --git a/toolkit/test/accessibility/SelectionDialog.java b/toolkit/test/accessibility/SelectionDialog.java
new file mode 100644
index 000000000000..a632e9f77a0c
--- /dev/null
+++ b/toolkit/test/accessibility/SelectionDialog.java
@@ -0,0 +1,179 @@
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleSelection;
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.Vector;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+
+
+
+/**
+ * Display a dialog with a list-box of children and select/deselect buttons
+ */
+class SelectionDialog extends JDialog
+ implements ActionListener
+{
+ public SelectionDialog (AccTreeNode aNode)
+ {
+ super (AccessibilityWorkBench.Instance());
+
+ maNode = aNode;
+
+ Layout();
+ }
+
+ /** build dialog */
+ protected void Layout ()
+ {
+ setTitle( "Select" );
+
+ // vertical stacking of the elements
+ Container aContent = getContentPane();
+
+ // label with explanation
+ aContent.add( new JLabel( "Select/Deselect child elements" ),
+ BorderLayout.NORTH );
+
+ // the JListBox
+ maChildrenSelector = new JList (GetChildrenList());
+ maChildrenSelector.setPreferredSize (new Dimension (500,300));
+ aContent.add (maChildrenSelector, BorderLayout.CENTER);
+ maChildrenSelector.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
+
+ JPanel aButtons = new JPanel();
+ aButtons.setLayout( new FlowLayout() );
+
+ JButton aButton;
+
+ aButton = new JButton( "Select" );
+ aButton.setActionCommand( "Select" );
+ aButton.addActionListener( this );
+ aButtons.add( aButton );
+
+ aButton = new JButton( "Deselect" );
+ aButton.setActionCommand( "Deselect" );
+ aButton.addActionListener( this );
+ aButtons.add( aButton );
+
+ aButton = new JButton( "Select all" );
+ aButton.setActionCommand( "Select all" );
+ aButton.addActionListener( this );
+ aButtons.add( aButton );
+
+ aButton = new JButton( "Clear Selection" );
+ aButton.setActionCommand( "Clear Selection" );
+ aButton.addActionListener( this );
+ aButtons.add( aButton );
+
+ aButton = new JButton( "Close" );
+ aButton.setActionCommand( "Close" );
+ aButton.addActionListener( this );
+ aButtons.add( aButton );
+
+ // add Panel with buttons
+ aContent.add( aButtons, BorderLayout.SOUTH );
+
+ setSize( getPreferredSize() );
+ }
+
+ /** Get a list of all children
+ */
+ private Vector GetChildrenList ()
+ {
+ mxSelection = maNode.getSelection();
+
+ XAccessibleContext xContext = maNode.getContext();
+ int nCount = xContext.getAccessibleChildCount();
+ Vector aChildVector = new Vector();
+ for(int i = 0; i < nCount; i++)
+ {
+ try
+ {
+ XAccessible xChild = xContext.getAccessibleChild(i);
+ XAccessibleContext xChildContext = xChild.getAccessibleContext();
+ aChildVector.add( i + " " + xChildContext.getAccessibleName());
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ aChildVector.add( "ERROR: IndexOutOfBoundsException" );
+ }
+ }
+ return aChildVector;
+ }
+
+
+ void close ()
+ {
+ hide();
+ dispose();
+ }
+
+ void select()
+ {
+ try
+ {
+ mxSelection.selectAccessibleChild (maChildrenSelector.getSelectedIndex());
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ JOptionPane.showMessageDialog( AccessibilityWorkBench.Instance(),
+ "Can't select: IndexOutofBounds",
+ "Error in selectAccessibleChild",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ void deselect()
+ {
+ try
+ {
+ mxSelection.deselectAccessibleChild(
+ maChildrenSelector.getSelectedIndex());
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ JOptionPane.showMessageDialog( AccessibilityWorkBench.Instance(),
+ "Can't deselect: IndexOutofBounds",
+ "Error in deselectAccessibleChild",
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ void selectAll()
+ {
+ mxSelection.selectAllAccessibleChildren();
+ }
+
+ void clearSelection()
+ {
+ mxSelection.clearAccessibleSelection();
+ }
+
+
+
+ public void actionPerformed(ActionEvent e)
+ {
+ String sCommand = e.getActionCommand();
+
+ if( "Close".equals( sCommand ) )
+ close();
+ else if ( "Select".equals( sCommand ) )
+ select();
+ else if ( "Deselect".equals( sCommand ) )
+ deselect();
+ else if ( "Clear Selection".equals( sCommand ) )
+ clearSelection();
+ else if ( "Select all".equals( sCommand ) )
+ selectAll();
+ }
+
+ private JList maChildrenSelector;
+ private XAccessibleSelection mxSelection;
+ private AccTreeNode maNode;
+}
diff --git a/toolkit/test/accessibility/SimpleOffice.java b/toolkit/test/accessibility/SimpleOffice.java
new file mode 100755
index 000000000000..4417267675af
--- /dev/null
+++ b/toolkit/test/accessibility/SimpleOffice.java
@@ -0,0 +1,389 @@
+import java.lang.Thread;
+
+import com.sun.star.awt.Rectangle;
+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;
+
+import com.sun.star.awt.XExtendedToolkit;
+
+
+/** This class tries to simplify some tasks like loading a document or
+ getting various objects.
+*/
+public class SimpleOffice
+{
+ XDesktop mxDesktop = null;
+ OfficeConnection aConnection;
+ int mnPortNumber;
+
+ public SimpleOffice (int nPortNumber)
+ {
+ mnPortNumber = nPortNumber;
+ connect ();
+ getDesktop ();
+ }
+
+ public void connect ()
+ {
+ aConnection = new OfficeConnection (mnPortNumber);
+ mxDesktop = null;
+ getDesktop ();
+ }
+
+ 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 = aConnection.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;
+ try
+ {
+ // Get the factory of the connected office.
+ XMultiServiceFactory xMSF = aConnection.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;
+ }
+
+
+
+ public XAccessible getAccessibleObject (XInterface xObject)
+ {
+ XAccessible xAccessible = null;
+ try
+ {
+ xAccessible = (XAccessible) UnoRuntime.queryInterface(
+ XAccessible.class, xObject);
+ }
+ catch (Exception e)
+ {
+ MessageArea.println (
+ "caught exception while getting accessible object" + e);
+ e.printStackTrace();
+ }
+ return xAccessible;
+ }
+
+ /** 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;
+ }
+}
diff --git a/toolkit/test/accessibility/StringNode.java b/toolkit/test/accessibility/StringNode.java
new file mode 100644
index 000000000000..11a7286c60f1
--- /dev/null
+++ b/toolkit/test/accessibility/StringNode.java
@@ -0,0 +1,13 @@
+import com.sun.star.lang.IndexOutOfBoundsException;
+
+/**
+ Base class for all tree nodes.
+ */
+class StringNode
+ extends AccessibleTreeNode
+{
+ public StringNode (String aDisplayObject, AccessibleTreeNode aParent)
+ {
+ super (aDisplayObject, aParent);
+ }
+}
diff --git a/toolkit/test/accessibility/TableEventHandler.java b/toolkit/test/accessibility/TableEventHandler.java
new file mode 100644
index 000000000000..7655d3a13599
--- /dev/null
+++ b/toolkit/test/accessibility/TableEventHandler.java
@@ -0,0 +1,43 @@
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.AccessibleEventId;
+import com.sun.star.accessibility.AccessibleTableModelChange;
+import com.sun.star.uno.UnoRuntime;
+
+import java.io.PrintStream;
+
+class TableEventHandler
+ extends EventHandler
+{
+ public TableEventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
+ {
+ super (aEvent, aTreeModel);
+ }
+
+ public void PrintOldAndNew (PrintStream out)
+ {
+ switch (mnEventId)
+ {
+ case AccessibleEventId.TABLE_MODEL_CHANGED:
+ AccessibleTableModelChange aModelChange =
+ (AccessibleTableModelChange)maEvent.NewValue;
+ out.println( "Range: StartRow " + aModelChange.FirstRow +
+ " StartColumn " + aModelChange.FirstColumn +
+ " EndRow " + aModelChange.LastRow +
+ " EndColumn " + aModelChange.LastColumn +
+ " Id " + aModelChange.Type);
+ break;
+ default:
+ super.PrintOldAndNew (out);
+ }
+ }
+
+ public void Process ()
+ {
+ maTreeModel.updateNode (mxEventSource, AccessibleTableHandler.class);
+ }
+
+
+ private XAccessible mxOldChild;
+ private XAccessible mxNewChild;
+}
diff --git a/toolkit/test/accessibility/TextLogger.java b/toolkit/test/accessibility/TextLogger.java
new file mode 100644
index 000000000000..e0ee56fd691d
--- /dev/null
+++ b/toolkit/test/accessibility/TextLogger.java
@@ -0,0 +1,52 @@
+import javax.swing.JEditorPane;
+import javax.swing.event.HyperlinkListener;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.text.Document;
+import java.net.URL;
+
+class TextLogger
+ extends JEditorPane
+{
+ public TextLogger ()
+ throws java.io.IOException
+ {
+// maDocument = getEditorKit().createDefaultDocument();
+ super ("http://localhost");
+ try
+ {
+ // setPage (new URL ("http://www.spiegel.de"));
+ }
+ catch (Exception e)
+ {}
+
+ setEditable (false);
+ final JEditorPane finalPane = this;
+ addHyperlinkListener (new HyperlinkListener()
+ {
+ public void hyperlinkUpdate (HyperlinkEvent e)
+ {
+ try
+ {
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
+ finalPane.setPage (e.getURL());
+ }
+ catch (java.io.IOException ex)
+ {
+ ex.printStackTrace(System.err);
+ }
+ }
+ });
+ }
+
+ public void appendText (String sText)
+ {
+ try
+ {
+ maDocument.insertString (maDocument.getLength(), sText, null);
+ }
+ catch (javax.swing.text.BadLocationException e)
+ {}
+ }
+
+ private Document maDocument;
+}
diff --git a/toolkit/test/accessibility/TextUpdateListener.java b/toolkit/test/accessibility/TextUpdateListener.java
new file mode 100644
index 000000000000..0ce990144c67
--- /dev/null
+++ b/toolkit/test/accessibility/TextUpdateListener.java
@@ -0,0 +1,170 @@
+import com.sun.star.accessibility.*;
+import com.sun.star.uno.UnoRuntime;
+
+import javax.swing.tree.*;
+import javax.swing.event.*;
+
+
+
+/** listen to tree model changes in order to update XAccessibleText objects
+*/
+class TextUpdateListener implements TreeModelListener
+{
+ public void treeNodesChanged(TreeModelEvent e)
+ {
+ try {
+ // if the change is to the first child of a DefaultMutableTreeNode
+ // with an XAccessibleText child, then we call updateText
+ int[] aIndices = e.getChildIndices();
+ if( (aIndices != null) &&
+ (aIndices.length > 0) )
+ {
+ // we have a parent... lets check for XAccessibleText then
+ DefaultMutableTreeNode aParent = (DefaultMutableTreeNode)
+ (e.getTreePath().getLastPathComponent());
+ DefaultMutableTreeNode aNode = (DefaultMutableTreeNode)
+ (aParent.getChildAt(aIndices[0]));
+ if( aParent.getUserObject() instanceof XAccessibleText)
+ {
+ // aha! we have an xText. So we can now check for
+ // the various cases we support
+ XAccessibleText xText =
+ (XAccessibleText)aParent.getUserObject();
+
+ if( aIndices[0] == 0 )
+ {
+ // first child! Then we call updateText
+ updateText( xText, aNode.toString() );
+ }
+ else
+ {
+ // JDK 1.4:
+ // // check for pattern "Selection:"
+ // Matcher m = Pattern.compile(
+ // "selection: \\[(-?[0-9]+),(-?[0-9]+)\\] \".*" ).
+ // matcher( aNode.toString() );
+ // if( m.matches() )
+ // {
+ // try
+ // {
+ // // aha! Selection:
+ // setSelection( xText,
+ // Integer.parseInt(m.group(1)),
+ // Integer.parseInt(m.group(2)) );
+ // }
+ // catch( NumberFormatException f )
+ // {
+ // // ignore
+ // }
+ // }
+ }
+ }
+ }
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException aException)
+ {}
+ }
+
+ // don't care:
+ public void treeNodesInserted(TreeModelEvent e) { ; }
+ public void treeNodesRemoved(TreeModelEvent e) { ; }
+ public void treeStructureChanged(TreeModelEvent e) { ; }
+
+ /** update the text */
+ boolean updateText( XAccessibleText xText, String sNew )
+ throws com.sun.star.lang.IndexOutOfBoundsException
+ {
+ // is this text editable? if not, fudge you and return
+ XAccessibleEditableText xEdit =
+ (XAccessibleEditableText) UnoRuntime.queryInterface (
+ XAccessibleEditableText.class, xText);
+ if (xEdit == null)
+ return false;
+
+ String sOld = xText.getText();
+
+ // false alarm? Early out if no change was done!
+ if( sOld.equals( sNew ) )
+ return false;
+
+ // 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) );
+
+ boolean bRet = false;
+ try
+ {
+ // edit the text, and use
+ // (set|insert|delete|replace)Text as needed
+ if( nFront+nBack == 0 )
+ bRet = xEdit.setText( sIns );
+ else if( sDel.length() == 0 )
+ bRet = xEdit.insertText( sIns, nFront );
+ else if( sIns.length() == 0 )
+ bRet = xEdit.deleteText( nFront, sOld.length()-nBack );
+ else
+ bRet = xEdit.replaceText(nFront, sOld.length()-nBack,sIns);
+ }
+ catch( IndexOutOfBoundsException e )
+ {
+ bRet = false;
+ }
+
+ return bRet;
+ }
+
+ boolean setSelection( XAccessibleText xText, int p1, int p2 )
+ {
+ try
+ {
+ return xText.setSelection( p1, p2 );
+ }
+ catch( com.sun.star.lang.IndexOutOfBoundsException f )
+ {
+ return false;
+ }
+ }
+
+ // /** replace the given node with a new xText node */
+ // void updateNode( XAccessibleText xText,
+ // DefaultMutableTreeNode aNode )
+ // {
+ // // create a new node
+ // DefaultMutableTreeNode aNew = newTextTreeNode( xText );
+ //
+ // // get parent (must be DefaultMutableTreeNode)
+ // DefaultMutableTreeNode aParent =
+ // (DefaultMutableTreeNode)aNode.getParent();
+ // if( aParent != null )
+ // {
+ // // remove old sub-tree, and insert new one
+ // int nIndex = aParent.getIndex( aNode );
+ // aParent.remove( nIndex );
+ // aParent.insert( aNew, nIndex );
+ // }
+ // }
+}
diff --git a/toolkit/test/accessibility/TopWindowListener.java b/toolkit/test/accessibility/TopWindowListener.java
new file mode 100644
index 000000000000..c0aea933ece7
--- /dev/null
+++ b/toolkit/test/accessibility/TopWindowListener.java
@@ -0,0 +1,205 @@
+import com.sun.star.awt.XWindow;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import javax.swing.event.TreeModelEvent;
+
+/** Listen for top window events and create or delete children of the tree
+ model accordingly.
+*/
+class TopWindowListener
+{
+ TopWindowListener (AccessibilityTreeModel aModel, SimpleOffice aOffice)
+ {
+ maModel = aModel;
+ maOffice = aOffice;
+ }
+
+
+
+
+ /** Use this function to initially fill the accessibility object tree
+ view with nodes for top level windows.
+ */
+ public void Initialize ()
+ {
+ XExtendedToolkit xToolkit = maOffice.getExtendedToolkit();
+ if (xToolkit != null)
+ {
+ maModel.lock ();
+ int nTopWindowCount = xToolkit.getTopWindowCount();
+ MessageArea.println ("There are " + nTopWindowCount + " top windows.");
+ for (int i=0; i<nTopWindowCount; i++)
+ {
+ try
+ {
+ XAccessible xAccessible = maOffice.getAccessibleObject(
+ xToolkit.getTopWindow (i));
+ // Uncomment the following line to get the real root of
+ // the accessible tree that xAccessible belongs to.
+ // xAccessible = maOffice.getAccessibleRoot(xAccessible);
+ AddTopLevelNode (xAccessible);
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception: " + e);
+ e.printStackTrace();
+ }
+ }
+ maModel.unlock ((AccessibleTreeNode)maModel.getRoot());
+ }
+ }
+
+
+
+ /** Add a new top level node which, to be exact, will be placed on the
+ second layer of the tree.
+ @param xNewTopLevelObject
+ The accessible object of the new top level window.
+ */
+ private void AddTopLevelNode (XAccessible xNewTopLevelObject)
+ {
+ System.out.println ("adding top level window");
+ if (xNewTopLevelObject != null)
+ {
+ XAccessibleContext xContext = xNewTopLevelObject.getAccessibleContext();
+ if (xContext == null)
+ System.out.println ("top level window not accessible");
+ else
+ {
+ if ( ! FilterTopLevelNode (xContext))
+ {
+ Object aRootObject = maModel.getRoot();
+ if (aRootObject instanceof VectorNode)
+ {
+ VectorNode aRoot = (VectorNode) aRootObject;
+ AccessibleTreeNode aNode =
+ NodeFactory.Instance().createDefaultNode (xNewTopLevelObject, aRoot);
+ aRoot.addChild (aNode);
+ maModel.fireTreeNodesInserted (maModel.createEvent (aRoot, aNode));
+ }
+ }
+ }
+ }
+ }
+
+ /** Ignore windows that have no accessible name, i.e. do not represent
+ document windows.
+ @return
+ Returns <true/> when the given object should not be displayed,
+ i.e. filtered out.
+ */
+ private boolean FilterTopLevelNode (XAccessibleContext xContext)
+ {
+ // No filtering at the moment.
+ return false;
+ // return xContext.getAccessibleName().length() == 0;
+ }
+
+
+
+
+ /** Remove an existing top level node from the tree.
+ @param xNewTopLevelObject
+ The accessible object to remove.
+ */
+ private void RemoveTopLevelNode (XAccessible xTopLevelObject)
+ {
+ Object aObject = maModel.getRoot();
+ if (aObject instanceof VectorNode && xTopLevelObject != null)
+ {
+ System.out.println ("removing node " + xTopLevelObject);
+ VectorNode aRoot = (VectorNode) aObject;
+ maModel.removeNode (xTopLevelObject.getAccessibleContext());
+ }
+ }
+
+
+
+
+
+ /** This method exists for debugging. It prints a list of all top
+ level windows.
+ */
+ private void ShowAllTopLevelWindows ()
+ {
+ XExtendedToolkit xToolkit = maOffice.getExtendedToolkit();
+ if (xToolkit != null)
+ {
+ int nTopWindowCount = xToolkit.getTopWindowCount();
+ for (int i=0; i<nTopWindowCount; i++)
+ {
+ try
+ {
+ System.out.println (i + " : " + xToolkit.getTopWindow (i));
+ }
+ catch (Exception e)
+ {
+ System.out.println ("caught exception; " + e);
+ }
+ }
+ }
+ }
+
+
+
+
+ // XTopWindowListener
+ public void windowOpened (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ if (maModel != null)
+ {
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class, aEvent.Source);
+ if (xWindow == null)
+ System.out.println ("event source is no XWindow");
+ else
+ {
+ XAccessible xAccessible = maOffice.getAccessibleObject(xWindow);
+ if (xAccessible == null)
+ System.out.println ("event source is no XAccessible");
+ else
+ AddTopLevelNode (xAccessible);
+ }
+ }
+ }
+
+
+
+
+ public void windowClosed (final com.sun.star.lang.EventObject aEvent)
+ throws RuntimeException
+ {
+ if (maModel != null)
+ {
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(
+ XWindow.class, aEvent.Source);
+ if (xWindow == null)
+ System.out.println ("event source is no XWindow");
+ else
+ {
+ XAccessible xAccessible = maOffice.getAccessibleObject(xWindow);
+ if (xAccessible == null)
+ System.out.println ("event source is no XAccessible");
+ else
+ RemoveTopLevelNode (xAccessible);
+ }
+ }
+ }
+
+ public void disposing (final com.sun.star.lang.EventObject aEvent)
+ {
+ System.out.println ("Top window disposed: " + aEvent);
+ }
+
+
+
+
+ private AccessibilityTreeModel
+ maModel;
+ private SimpleOffice
+ maOffice;
+}
diff --git a/toolkit/test/accessibility/VectorNode.java b/toolkit/test/accessibility/VectorNode.java
new file mode 100644
index 000000000000..282abb595620
--- /dev/null
+++ b/toolkit/test/accessibility/VectorNode.java
@@ -0,0 +1,50 @@
+import com.sun.star.lang.IndexOutOfBoundsException;
+import java.util.Vector;
+
+/** The VectorNode class is a simple container whose list of children is
+ managed entirely by its owner.
+*/
+class VectorNode
+ extends StringNode
+{
+ private Vector maChildren;
+
+ public VectorNode (String sDisplayObject, AccessibleTreeNode aParent)
+ {
+ super (sDisplayObject, aParent);
+
+ maChildren = new Vector ();
+ }
+
+ public void addChild (AccessibleTreeNode aChild)
+ {
+ maChildren.add (aChild);
+ }
+
+ public int getChildCount ()
+ {
+ return maChildren.size();
+ }
+
+ public AccessibleTreeNode getChild (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ return (AccessibleTreeNode)maChildren.elementAt (nIndex);
+ }
+
+ public boolean removeChild (int nIndex)
+ throws IndexOutOfBoundsException
+ {
+ return maChildren.remove (nIndex) != null;
+ }
+
+ public int indexOf (AccessibleTreeNode aNode)
+ {
+ return maChildren.indexOf (aNode);
+ }
+
+ public boolean isLeaf()
+ {
+ return maChildren.isEmpty();
+ }
+}
diff --git a/toolkit/test/accessibility/about.html b/toolkit/test/accessibility/about.html
new file mode 100644
index 000000000000..ff24ed058663
--- /dev/null
+++ b/toolkit/test/accessibility/about.html
@@ -0,0 +1,8 @@
+<html>
+<body>
+<center><h1>About AWB</h1>
+<p>AWB, the <em>A</em>ccessibility <em>W</em>ork <em>B</em>ench.</p>
+<p>Version 1.7</p>
+</center>
+</body>
+</html> \ No newline at end of file
diff --git a/toolkit/test/accessibility/help.html b/toolkit/test/accessibility/help.html
new file mode 100644
index 000000000000..2660013b6733
--- /dev/null
+++ b/toolkit/test/accessibility/help.html
@@ -0,0 +1,91 @@
+<html><body bgcolor="#fffaf0">
+<h1>Help for the AWB v1.7</h1>
+
+<p>The AWB, or <em>A</em>ccessibility <em>W</em>ork <em>B</em>ench, is a tool
+for testing the implementation UNO Accessibility API.</p>
+
+<p>The main window is roughly divided into three areas:
+<ul>
+<li>The <a href="#treeview">tree view</a> on the left shows a part of the
+accessibility tree of one or more StarOffice/OpenOffice applications.</li>
+<li>The <a href="#graphicalview">graphical view</a> on the right side shows
+a graphical representation of the accessibility objects in the tree. To
+make objects missing in the graphical view visible expand the corresponding
+nodes in the tree view.</li>
+
+<li>The text window at the bottom logs important messages.</li>
+</ul>
+</p>
+
+<h2><a name="treeview">Tree View</a></h2>
+<p>The tree view has a top-level node for every open
+ document window of StarOffice/OpenOffice. Expand those nodes to make them
+ visible in the <a href="#graphicalview">graphical view</a>.</p>
+
+<h3>Nodes</h3>
+<p>The nodes in the tree view belong to different classes, some of which
+ have children others do not:
+<ul>
+<li><b>Accessible Object</b><br>
+ The node represents an accessible object and has corresponding shape in
+ the graphical view. Only this kind of node gets highlighted by clicking
+ on those shapes.</li>
+<li><b>Simple Property</b><br>
+ These leaves represent simple properties of their parent nodes. Examples
+ are the position, size, and color of an accessible object.</li>
+<li><b>Complex Properties</b><br>
+ These nodes have children that are not accessible objects. Examples are
+ the lists of interfaces or services supported by an accessible object.</li>
+</ul>
+</p>
+
+<h3>Actions</h3>
+<p>The tree view supports the following actions:
+<ul><li>Left double click expands the node under the mouse pointer.</li>
+<li>Right click shows a context menu. Entries, when supported, are:
+<ul>
+<li><b>Expand Shapes</b><br>
+Expands all nodes in the sub-tree that lie on a path from the root to a shape.</li>
+<li><b>Expand Subtree</b><br>
+Expands all nodes in the sub-tree.</li>
+<li><b>Select...</b><br>
+Show a dialog that gives access to the XAccessibleSelection interface.</li>
+<li><b>select...</b>, <b>copy...</b>, <b>cut...</b>, <b>paste...</b>,
+ <b>edit...</b>, <b>format...</b><br>
+Show dialogs that give access to the XAccessibleText and
+XAccessibleEditableText interfaces.
+</ul></li>
+</ul>
+</p>
+
+
+
+<h2><a name="graphicalview">Graphical View</a></h2>
+<p>The graphical view shows several properties of accessibility objects:
+<ul>
+<li>The bounding box is represented as a rectangle.</li>
+<li>The background color of the accessible object is taken to draw the
+ bounding box rectangle.</li>
+<li>The foreground color is used to fill the bounding box.</li>
+<li>The accessible name is shown when the menu checkbox Options->Show Name
+ is check.</li>
+<li>The accessible description is shown when the menu checkbox Options->Show
+ Descriptons is checked.</li>
+<li>If the XAccessibleText interface is supported and the menu checkbox
+ Options->Show Text is checked then the text of the accessible object is
+ shown.</li>
+</ul>
+</p>
+
+<h3>Actions</h3>
+<p>The graphical view supports three the following actions:
+<ul>
+<li>Left click (no modifiers) highlights the object under the mouse as well
+ as the corresponding node in the tree view.</li>
+<li>Left click with Control modifier expands the object under the
+ mouse.</li>
+<li>Mouse motion with Shift modifier highlights the object under the mouse
+ as well as the corresponding node in the tree view.</li>
+</ul>
+
+</body></html> \ No newline at end of file
diff --git a/toolkit/test/accessibility/jawb.mf b/toolkit/test/accessibility/jawb.mf
new file mode 100644
index 000000000000..939cbdad22ab
--- /dev/null
+++ b/toolkit/test/accessibility/jawb.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: AccessibilityWorkBench
+Class-Path: classes.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar xt.jar xml-apis.jar
diff --git a/toolkit/test/accessibility/makefile.mk b/toolkit/test/accessibility/makefile.mk
new file mode 100644
index 000000000000..cc6f410f7404
--- /dev/null
+++ b/toolkit/test/accessibility/makefile.mk
@@ -0,0 +1,127 @@
+# This is the dmake version.
+
+# 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 port number.
+PORT_NUMBER = 5678
+
+# The following variables probably don't need to be changed.
+JAVAC = javac
+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.
+
+all : AccessibilityWorkBench
+
+JAR_FILES = \
+ unoil.jar \
+ ridl.jar \
+ jurt.jar \
+ juh.jar \
+ java_uno.jar
+
+JAVA_FILES = \
+ AccTreeNode.java \
+ AccessibilityTree.java \
+ AccessibilityTreeModel.java \
+ AccessibilityTreeModelBase.java \
+ AccessibilityWorkBench.java \
+ AccessibleActionHandler.java \
+ AccessibleActionNode.java \
+ AccessibleCellHandler.java \
+ AccessibleComponentHandler.java \
+ AccessibleContextHandler.java \
+ AccessibleEditableTextHandler.java \
+ AccessibleExtendedComponentHandler.java \
+ AccessibleHyperlinkHandler.java \
+ AccessibleHypertextHandler.java \
+ AccessibleImageHandler.java \
+ AccessibleRelationHandler.java \
+ AccessibleSelectionHandler.java \
+ AccessibleTableHandler.java \
+ AccessibleTextHandler.java \
+ AccessibleTreeCellRenderer.java \
+ AccessibleTreeHandler.java \
+ AccessibleTreeNode.java \
+ AccessibleUNOHandler.java \
+ Canvas.java \
+ CanvasShape.java \
+ ChildEventHandler.java \
+ ContextEventHandler.java \
+ EventHandler.java \
+ EventListener.java \
+ EventLogger.java \
+ EventQueue.java \
+ FrameActionListener.java \
+ GeometryEventHandler.java \
+ HelpWindow.java \
+ InformationWriter.java \
+ MessageArea.java \
+ NodeFactory.java \
+ NodeHandler.java \
+ NodeMap.java \
+ OfficeConnection.java \
+ Options.java \
+ QueuedListener.java \
+ QueuedTopWindowListener.java \
+ SelectionDialog.java \
+ SimpleOffice.java \
+ StringNode.java \
+ TableEventHandler.java \
+ TextLogger.java \
+ TextUpdateListener.java \
+ TopWindowListener.java \
+ VectorNode.java
+
+JAVA_CLASSPATHS := \
+ . \
+ $(foreach,i,$(JAR_FILES) $(JAR_PATH)$i) \
+ $(CLASSPATH)
+
+CLASSPATH !:=$(JAVA_CLASSPATHS:t$(PATH_SEPERATOR))
+
+JFLAGS = -deprecation -classpath $(CLASSPATH)
+
+%.class : %.java
+ $(JAVAC) $(JFLAGS) $<
+
+%.class : %.java
+ $(JAVAC) $(JFLAGS) $<
+
+AccessibilityWorkBench : ObjectView Tools $(JAVA_FILES:b:+".class")
+
+ObjectView .SETDIR=ov :
+ @echo "making package ObjectView"
+ dmake
+
+Tools .SETDIR=tools :
+ @echo "making package Tools"
+ dmake
+
+# Remove all class files.
+clean : ObjectView.clean Tools.clean
+ rm *.class
+ rm AccessibilityWorkBench.jar
+ObjectView.clean .SETDIR=ov :
+ rm *.class
+Tools.clean .SETDIR=tools :
+ rm *.class
+
+# Create a jar file of all files neccessary to build and run the work bench.
+dist: AccessibilityWorkBench.jar
+
+AccessibilityWorkBench.jar: $(JAVA_FILES:b:+".class") jawb.mf
+ jar -cfm AccessibilityWorkBench.jar jawb.mf *.class ov\*.class tools\*.class
+
+# Example of how to run the work bench.
+run: all
+ $(JAVA) -classpath $(CLASSPATH) AccessibilityWorkBench -p $(PORT_NUMBER)
+
+runjar: all dist
+ $(JAVA) -classpath $(CLASSPATH) -jar AccessibilityWorkBench.jar -p $(PORT_NUMBER)
+
diff --git a/toolkit/test/accessibility/news.html b/toolkit/test/accessibility/news.html
new file mode 100644
index 000000000000..9e801723f06a
--- /dev/null
+++ b/toolkit/test/accessibility/news.html
@@ -0,0 +1,36 @@
+<html><body bgcolor="#fffaf0">
+<h1>News for AWB v1.7.2</h1>
+<p>Adaption to recent UAA changes:
+<ul>
+<li>Introduction of
+com.sun.star.accessibility.TextSegment structure that is returned by some
+functions of the XAccessibleText interface.</li>
+<li>Removal of the COLLAPSED state.</li>
+<li>Renaming of XAccessibleSelectioni::selectAllAccessible to
+selectAllAccessibleChildren.</li>
+</ul>
+
+<h1>News for AWB v1.7</h1>
+
+<ul>
+
+<li>This help window.</li>
+
+<li>Integrated relocation of UAA files from drafts to final.</li>
+<li>Control left click in the graphical view expands the object that has
+ been clicked at.</li>
+
+<li>Introduction of split panes for easily changing the size of the three
+main widgets.</li>
+
+<li>The graphical view visualizes the screen size.</li>
+
+<li>Removed the "Load" button.</li>
+<li>Removed the status line.</li>
+<li>The tree view shows top level nodes only for document windows.</li>
+<li>New "views" menu that allows you to select the zoom scale of the
+ graphical view.</li>
+
+</ul>
+
+</body></html> \ No newline at end of file
diff --git a/toolkit/test/accessibility/ov/ContextView.java b/toolkit/test/accessibility/ov/ContextView.java
new file mode 100644
index 000000000000..4204c5de7bac
--- /dev/null
+++ b/toolkit/test/accessibility/ov/ContextView.java
@@ -0,0 +1,125 @@
+package ov;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+
+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 tools.NameProvider;
+
+public class ContextView
+ extends ListeningObjectView
+ implements ActionListener
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ System.out.println ("ContextView.CreateView");
+ if (xContext != null)
+ return new ContextView (aContainer);
+ else
+ return null;
+ }
+
+ public ContextView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+ maNameLabel = new JLabel ("Name: ");
+ maName = new JLabel ("");
+ maDescriptionLabel = new JLabel ("Description: ");
+ maDescription = new JLabel ("");
+ maRoleLabel = new JLabel ("Role: ");
+ maRole = new JLabel ("");
+
+ // Make the background of name and description white and opaque so
+ // that leading and trailing spaces become visible.
+ maName.setOpaque (true);
+ maName.setBackground (Color.WHITE);
+ maDescription.setOpaque (true);
+ maDescription.setBackground (Color.WHITE);
+ maRole.setOpaque (true);
+ maRole.setBackground (Color.WHITE);
+
+ GridBagLayout aLayout = new GridBagLayout();
+ setLayout (aLayout);
+ GridBagConstraints constraints = new GridBagConstraints ();
+ constraints.gridx = 0;
+ constraints.gridy = 0;
+ constraints.gridwidth = 1;
+ constraints.gridheight = 1;
+ constraints.weightx = 0;
+ constraints.weighty = 1;
+ constraints.anchor = GridBagConstraints.WEST;
+ constraints.fill = GridBagConstraints.NONE;
+ add (maNameLabel, constraints);
+ constraints.gridy = 1;
+ add (maDescriptionLabel, constraints);
+ constraints.gridy = 2;
+ add (maRoleLabel, constraints);
+ constraints.gridy = 0;
+ constraints.gridx = 1;
+ constraints.weightx = 2;
+ add (maName, constraints);
+ constraints.gridy = 1;
+ add (maDescription, constraints);
+ constraints.gridy = 2;
+ add (maRole, constraints);
+ }
+
+ public void Update ()
+ {
+ if (mxContext == null)
+ {
+ maName.setText ("<null object>");
+ maDescription.setText ("<null object>");
+ maRole.setText ("<null object>");
+ }
+ else
+ {
+ maName.setText (mxContext.getAccessibleName());
+ maDescription.setText (mxContext.getAccessibleDescription());
+ maRole.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,
+ maName,
+ maDescriptionLabel,
+ maDescription,
+ maRoleLabel,
+ maRole;
+}
diff --git a/toolkit/test/accessibility/ov/FocusView.java b/toolkit/test/accessibility/ov/FocusView.java
new file mode 100644
index 000000000000..665fa260e288
--- /dev/null
+++ b/toolkit/test/accessibility/ov/FocusView.java
@@ -0,0 +1,119 @@
+package ov;
+
+import java.awt.Color;
+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 ListeningObjectView
+ 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 ();
+ aConstraints.gridy = 0;
+ aConstraints.weightx = 1;
+ aConstraints.fill = GridBagConstraints.HORIZONTAL;
+ add (maFocused, aConstraints);
+
+ maGrabFocus = new JButton ("grabFocus");
+ 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/toolkit/test/accessibility/ov/ListeningObjectView.java b/toolkit/test/accessibility/ov/ListeningObjectView.java
new file mode 100644
index 000000000000..574fa989b20f
--- /dev/null
+++ b/toolkit/test/accessibility/ov/ListeningObjectView.java
@@ -0,0 +1,60 @@
+package ov;
+
+import com.sun.star.accessibility.AccessibleEventObject;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEventBroadcaster;
+import com.sun.star.accessibility.XAccessibleEventListener;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+
+/** Base class for object views that regsiters as accessibility event
+ listener.
+*/
+abstract class ListeningObjectView
+ extends ObjectView
+ implements XAccessibleEventListener
+{
+ public ListeningObjectView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+ }
+
+ /** Add this object as event listener at the broadcasting
+ accessible object.
+ */
+ public void SetObject (XAccessibleContext xContext)
+ {
+ super.SetObject (xContext);
+ XAccessibleEventBroadcaster xBroadcaster =
+ (XAccessibleEventBroadcaster)UnoRuntime.queryInterface(
+ XAccessibleEventBroadcaster.class, xContext);
+ if (xBroadcaster != null)
+ xBroadcaster.addEventListener (this);
+ }
+
+
+ /** Remove this object as event listener from the broadcasting
+ accessible object.
+ */
+ public void Destroy ()
+ {
+ super.Destroy ();
+ XAccessibleEventBroadcaster xBroadcaster =
+ (XAccessibleEventBroadcaster)UnoRuntime.queryInterface(
+ XAccessibleEventBroadcaster.class, mxContext);
+ if (xBroadcaster != null)
+ xBroadcaster.removeEventListener (this);
+ }
+
+ /** Derived classes have to implement this method to handle incoming
+ events.
+ */
+ abstract public void notifyEvent (AccessibleEventObject aEvent);
+
+ /** The disposing event is ignored per default. If a derived class is
+ interested it can overwrite this method.
+ */
+ public void disposing (EventObject aEvent)
+ {
+ }
+}
diff --git a/toolkit/test/accessibility/ov/ObjectView.java b/toolkit/test/accessibility/ov/ObjectView.java
new file mode 100644
index 000000000000..0c96969e733b
--- /dev/null
+++ b/toolkit/test/accessibility/ov/ObjectView.java
@@ -0,0 +1,77 @@
+package ov;
+
+import javax.swing.JPanel;
+
+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 ();
+
+ /// Reference to the current object to display information about.
+ protected XAccessibleContext mxContext;
+
+ protected ObjectViewContainer maContainer;
+}
diff --git a/toolkit/test/accessibility/ov/ObjectViewContainer.java b/toolkit/test/accessibility/ov/ObjectViewContainer.java
new file mode 100644
index 000000000000..c0bf6a86736b
--- /dev/null
+++ b/toolkit/test/accessibility/ov/ObjectViewContainer.java
@@ -0,0 +1,166 @@
+package ov;
+
+import java.awt.Color;
+import java.awt.Component;
+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 com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleComponent;
+import com.sun.star.accessibility.XAccessibleSelection;
+import com.sun.star.uno.UnoRuntime;
+
+
+public class ObjectViewContainer
+ extends JPanel
+{
+ public ObjectViewContainer ()
+ {
+ maViewTemplates = new Vector ();
+ maViewBorder = BorderFactory.createBevelBorder (BevelBorder.RAISED);
+ setLayout (new GridBagLayout ());
+
+ System.out.println ("ObjectViewContainer");
+ RegisterView (ContextView.class);
+ // RegisterView (StateSetView.class);
+ RegisterView (FocusView.class);
+ RegisterView (TextView.class);
+ }
+
+
+
+ /** Remove all existing views and create new ones according to the
+ interfaces supported by the given object.
+ */
+ public 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 ();
+
+ // 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));
+ }
+
+
+ /** 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)
+ {
+ System.out.println ("registering " + 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);
+ }
+
+ /** 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() > 0)
+ {
+ Component aComponent = getComponent (getComponentCount()-1);
+ GridBagLayout aLayout = (GridBagLayout)getLayout();
+ GridBagConstraints aConstraints = aLayout.getConstraints (aComponent);
+ aConstraints.weighty = 1;
+ aLayout.setConstraints (aComponent, aConstraints);
+ }
+ }
+
+ /// 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;
+}
diff --git a/toolkit/test/accessibility/ov/SelectionView.java b/toolkit/test/accessibility/ov/SelectionView.java
new file mode 100644
index 000000000000..a71f242420ba
--- /dev/null
+++ b/toolkit/test/accessibility/ov/SelectionView.java
@@ -0,0 +1,230 @@
+package ov;
+
+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.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 ListeningObjectView
+ 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 wheter the selection is multi selectable.
+ aConstraints.gridx = 0;
+ aConstraints.gridy = 0;
+ aConstraints.anchor = GridBagConstraints.WEST;
+ maTypeLabel = new JLabel ();
+ 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.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.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;
+ ButtonGroup aButtonGroup = null;
+ if (aStateSet!=null && aStateSet.contains(AccessibleStateType.MULTI_SELECTABLE))
+ {
+ bMultiSelectable = true;
+ maTypeLabel.setText ("multi selectable");
+ }
+ else
+ {
+ maTypeLabel.setText ("single selectable");
+ aButtonGroup = new ButtonGroup ();
+ }
+
+ 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;
+ if (bMultiSelectable)
+ aChild = new JCheckBox (sName);
+ else
+ {
+ aChild = new JRadioButton (sName);
+ aButtonGroup.add (aChild);
+ }
+
+ 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)
+ {
+ if (aEvent.EventId == AccessibleEventId.SELECTION_CHANGED)
+ Update ();
+ }
+
+ private JPanel maChildrenSelector;
+ private XAccessibleSelection mxSelection;
+ private JLabel maTypeLabel;
+}
diff --git a/toolkit/test/accessibility/ov/StateSetView.java b/toolkit/test/accessibility/ov/StateSetView.java
new file mode 100644
index 000000000000..e8997ac0c5a0
--- /dev/null
+++ b/toolkit/test/accessibility/ov/StateSetView.java
@@ -0,0 +1,249 @@
+package ov;
+
+import java.awt.Color;
+import java.awt.BorderLayout;
+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.Shape;
+
+import java.awt.event.MouseListener;
+import java.awt.event.MouseEvent;
+
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.AffineTransform;
+
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.Border;
+
+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 tools.NameProvider;
+
+public class StateSetView
+ extends ListeningObjectView
+ implements MouseListener
+{
+ /** 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)
+ if (mnViewMode == SHOW_ALL_STATES)
+ aView = StateSetAllView.Create (aContainer, xContext);
+ else
+ aView = StateSetSetView.Create (aContainer, xContext);
+ return aView;
+ }
+
+ public StateSetView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ addMouseListener (this);
+ }
+
+ private void SetViewMode (int nViewMode)
+ {
+ mnViewMode = nViewMode;
+ switch (mnViewMode)
+ {
+ case SHOW_SET_STATES :
+ maContainer.ReplaceView (
+ getClass(),
+ StateSetSetView.class);
+ break;
+ case SHOW_ALL_STATES :
+ maContainer.ReplaceView (
+ getClass(),
+ StateSetAllView.class);
+ break;
+ }
+ aContainer.SetObject (mxContext);
+ }
+
+
+
+ public String GetTitle ()
+ {
+ return ("StateSet");
+ }
+
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ if (aEvent.EventId == AccessibleEventId.STATE_CHANGED)
+ Update();
+ }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ switch (mnViewMode)
+ {
+ case SHOW_SET_STATES :
+ SetViewMode (SHOW_ALL_STATES);
+ break;
+ case SHOW_ALL_STATES :
+ SetViewMode (SHOW_SET_STATES);
+ break;
+ }
+ }
+ public void mouseEntered (MouseEvent e) {}
+ public void mouseExited (MouseEvent e) {}
+ public void mousePressed (MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+
+ private static int mnViewMode = SHOW_ALL_STATES;
+ private final static int SHOW_SET_STATES = 0;
+ private final static int SHOW_ALL_STATES = 1;
+
+
+
+public class StateSetAllView
+ extends StateSetView
+{
+ /** Create a FocusView when the given object supports the
+ XAccessibleComponent interface.
+ */
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new StateSetAllView (aContainer);
+ else
+ return null;
+ }
+
+ public StateSetAllView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ setPreferredSize (new Dimension(300,90));
+ setMinimumSize (new Dimension(200,80));
+ }
+
+ public void paintChildren (Graphics g)
+ {
+ 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.getAccessibleStateSet();
+ if (xStateSet != null)
+ {
+ short aStates[] = xStateSet.getStates ();
+ final int nMaxStateIndex = AccessibleStateType.MANAGES_DESCENDANTS;
+ int nStateWidth = (aWidgetArea.width-12) / (nMaxStateIndex+1);
+ AffineTransform aTransform = g.getTransform ();
+ g.setColor (aTextColor);
+ int y = aWidgetArea.y+aWidgetArea.height - 12;
+ double nTextRotation = -0.9;//-java.lang.Math.PI/2;
+ double nScale = 0.6;
+
+ // Create a shape for the boxes.
+ int nBoxWidth = nStateWidth-2;
+ if (nBoxWidth > 8)
+ nBoxWidth = 8;
+ Rectangle aCheckBox = new Rectangle (-nBoxWidth/2,0,nBoxWidth,nBoxWidth);
+
+ for (short i=0; i<=nMaxStateIndex; i++)
+ {
+ int x = nStateWidth + i * nStateWidth;
+ String sStateName = NameProvider.getStateName (i);
+ boolean bStateSet = xStateSet.contains (i);
+ g.setTransform (aTransform);
+ g.translate (x,y);
+ if (bStateSet)
+ {
+ g.setColor (Color.GREEN);
+ 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);
+ }
+ }
+ }
+}
+
+
+public class StateSetSetView
+ extends StateSetView
+{
+ static public ObjectView Create (
+ ObjectViewContainer aContainer,
+ XAccessibleContext xContext)
+ {
+ if (xContext != null)
+ return new StateSetSetView (aContainer);
+ else
+ return null;
+ }
+
+ public StateSetSetView (ObjectViewContainer aContainer)
+ {
+ super (aContainer);
+
+ maStates = null;
+ setPreferredSize (new Dimension(300,90));
+ }
+
+
+ synchronized public void Update ()
+ {
+ XAccessibleStateSet xStateSet = mxContext.getAccessibleStateSet();
+ if (xStateSet != null)
+ {
+ String sStates = new String ();
+ short aStates[] = xStateSet.getStates();
+ for (int i=0; i<aStates.length; i++)
+ {
+ if (i > 0)
+ sStates = sStates + ", ";
+ sStates = sStates + NameProvider.getStateName(aStates[i]);
+ }
+ maStates.setText (sStates);
+ }
+ }
+
+ private JLabel maStates;
+}
+
+}
diff --git a/toolkit/test/accessibility/ov/TextView.java b/toolkit/test/accessibility/ov/TextView.java
new file mode 100644
index 000000000000..094647986e4f
--- /dev/null
+++ b/toolkit/test/accessibility/ov/TextView.java
@@ -0,0 +1,123 @@
+package ov;
+
+import java.awt.Color;
+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.XAccessibleText;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.uno.UnoRuntime;
+
+public class TextView
+ extends ListeningObjectView
+{
+ /** 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);
+
+ setLayout (new GridBagLayout());
+ GridBagConstraints aConstraints = new GridBagConstraints ();
+
+ JLabel aLabel = new JLabel ("Text:");
+ aConstraints.gridy = 0;
+ aConstraints.weightx = 1;
+ aConstraints.fill = GridBagConstraints.HORIZONTAL;
+ add (aLabel, aConstraints);
+
+ maTextLabel = new JLabel ("");
+ aConstraints.gridx = 1;
+ aConstraints.fill = GridBagConstraints.NONE;
+ aConstraints.anchor = GridBagConstraints.WEST;
+ add (maTextLabel, aConstraints);
+
+ aLabel = new JLabel ("Caret position:");
+ aConstraints.gridx = 0;
+ aConstraints.gridy = 1;
+ aConstraints.weightx = 1;
+ aConstraints.fill = GridBagConstraints.HORIZONTAL;
+ add (aLabel, aConstraints);
+
+ maCaretPositionLabel = new JLabel ("");
+ aConstraints.gridx = 1;
+ aConstraints.fill = GridBagConstraints.NONE;
+ aConstraints.anchor = GridBagConstraints.WEST;
+ add (maCaretPositionLabel, aConstraints);
+ }
+
+
+ /** Additionally to the context store a reference to the
+ XAccessibleText interface.
+ */
+ public void SetObject (XAccessibleContext xObject)
+ {
+ mxText = (XAccessibleText)UnoRuntime.queryInterface(
+ XAccessibleText.class, xObject);
+ super.SetObject (xObject);
+ }
+
+ synchronized public void Destroy ()
+ {
+ super.Destroy();
+ }
+
+ synchronized public void Update ()
+ {
+ if (mxText == null)
+ {
+ maTextLabel.setText ("<null object>");
+ maCaretPositionLabel.setText ("<null object>");
+ }
+ else
+ {
+ maTextLabel.setText (mxText.getText());
+ maCaretPositionLabel.setText (Integer.toString(mxText.getCaretPosition()));
+ }
+ }
+
+ public String GetTitle ()
+ {
+ return ("Text");
+ }
+
+ public void notifyEvent (AccessibleEventObject aEvent)
+ {
+ System.out.println (aEvent);
+ switch (aEvent.EventId)
+ {
+ case AccessibleEventId.TEXT_CHANGED :
+ case AccessibleEventId.CARET_CHANGED :
+ Update ();
+ break;
+ }
+ }
+
+ private JLabel
+ maTextLabel,
+ maCaretPositionLabel;
+ private XAccessibleText mxText;
+}
diff --git a/toolkit/test/accessibility/ov/makefile.mk b/toolkit/test/accessibility/ov/makefile.mk
new file mode 100644
index 000000000000..56fb563eeee0
--- /dev/null
+++ b/toolkit/test/accessibility/ov/makefile.mk
@@ -0,0 +1,51 @@
+# This is the dmake version.
+
+# 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 port number.
+PORT_NUMBER = 5678
+
+# The following variables probably don't need to be changed.
+JAVAC = javac
+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.
+
+all : ov
+
+JAR_FILES = \
+ unoil.jar \
+ ridl.jar \
+ jurt.jar \
+ juh.jar \
+ java_uno.jar
+
+JAVA_FILES = \
+ ov/ObjectViewContainer.java \
+ ov/ObjectView.java \
+ ov/ListeningObjectView.java \
+ ov/ContextView.java \
+ ov/FocusView.java \
+ ov/SelectionView.java \
+ ov/TextView.java
+# ov/StateSetView.java \
+
+
+JAVA_CLASSPATHS := \
+ . .. \
+ $(foreach,i,$(JAR_FILES) $(JAR_PATH)$i) \
+ $(CLASSPATH)
+
+CLASSPATH !:=$(JAVA_CLASSPATHS:t$(PATH_SEPERATOR))
+
+JFLAGS = -deprecation -classpath $(CLASSPATH)
+
+%.class : %.java
+ $(JAVAC) $(JFLAGS) $<
+
+ov : $(JAVA_FILES:b:+".class")
diff --git a/toolkit/test/accessibility/tools/NameProvider.java b/toolkit/test/accessibility/tools/NameProvider.java
new file mode 100644
index 000000000000..d9bcab802cbf
--- /dev/null
+++ b/toolkit/test/accessibility/tools/NameProvider.java
@@ -0,0 +1,259 @@
+package tools;
+
+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 or an empty string if an
+ invalid / unknown state id was given.
+ */
+ public static String getStateName (int nStateId)
+ {
+ return (String)maStateMap.get (new Integer(nStateId));
+ }
+
+
+ /** 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/toolkit/test/accessibility/tools/makefile.mk b/toolkit/test/accessibility/tools/makefile.mk
new file mode 100644
index 000000000000..045ba6f65b49
--- /dev/null
+++ b/toolkit/test/accessibility/tools/makefile.mk
@@ -0,0 +1,42 @@
+# 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 port number.
+PORT_NUMBER = 5678
+
+# The following variables probably don't need to be changed.
+JAVAC = javac
+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.
+
+all : tools
+
+JAR_FILES = \
+ unoil.jar \
+ ridl.jar \
+ jurt.jar \
+ juh.jar \
+ java_uno.jar
+
+JAVA_FILES = \
+ tools/NameProvider.java
+
+
+JAVA_CLASSPATHS := \
+ . .. \
+ $(foreach,i,$(JAR_FILES) $(JAR_PATH)$i) \
+ $(CLASSPATH)
+
+CLASSPATH !:=$(JAVA_CLASSPATHS:t$(PATH_SEPERATOR))
+
+JFLAGS = -deprecation -classpath $(CLASSPATH)
+
+%.class : %.java
+ $(JAVAC) $(JFLAGS) $<
+
+tools : $(JAVA_FILES:b:+".class")
diff --git a/toolkit/uiconfig/layout/delzip b/toolkit/uiconfig/layout/delzip
new file mode 100644
index 000000000000..7b4d68d70fca
--- /dev/null
+++ b/toolkit/uiconfig/layout/delzip
@@ -0,0 +1 @@
+empty \ No newline at end of file
diff --git a/toolkit/uiconfig/layout/makefile.mk b/toolkit/uiconfig/layout/makefile.mk
new file mode 100644
index 000000000000..46d0b187b744
--- /dev/null
+++ b/toolkit/uiconfig/layout/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=../..
+PRJNAME=toolkit
+TARGET=layout
+
+.INCLUDE : settings.mk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+
+all: ALLTAR
+
+XML_FILES=\
+ message-box.xml\
+ tab-dialog.xml\
+
+#
+
+.INCLUDE : layout.mk
+
+.ELSE # ENABLE_LAYOUT != TRUE
+all .PHONY:
+.ENDIF # ENABLE_LAYOUT != TRUE
+
+.INCLUDE : target.mk
+
+localize.sdf:
+ echo '#empty' | cat - > $@
+ rm -f *-$@
diff --git a/toolkit/uiconfig/layout/message-box.xml b/toolkit/uiconfig/layout/message-box.xml
new file mode 100644
index 000000000000..61305e443fa3
--- /dev/null
+++ b/toolkit/uiconfig/layout/message-box.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="message-box" _title="" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true" closeable="true">
+ <vbox border="5" spacing="5">
+ <hbox border="5" spacing="20">
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" />
+ </align>
+ <flow/>
+ </hbox>
+ <dialogbuttonhbox border="0" spacing="5">
+ <flow/>
+ <!-- deprecoted vcl/MsgBox compatibility !-->
+ <retrybutton id="BTN_RETRY" />
+ <ignorebutton id="BTN_IGNORE" />
+
+ <yesbutton id="BTN_YES"/>
+ <cancelbutton id="BTN_CANCEL"/>
+ <helpbutton id="BTN_HELP"/>
+ <nobutton id="BTN_NO" xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/uiconfig/layout/tab-dialog.xml b/toolkit/uiconfig/layout/tab-dialog.xml
new file mode 100644
index 000000000000..da75f03e9df5
--- /dev/null
+++ b/toolkit/uiconfig/layout/tab-dialog.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ _title="layout::TabDialog" optimumsize="true"
+ id="tab-dialog"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <tabcontrol id="ID_TABCONTROL"/>
+ <dialogbuttonhbox border="5" spacing="5" cnt:expand="false">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_OK" show="false"/>
+ <pushbutton id="BTN_USER" _label="&lt;User&gt;" show="false"/>
+ <cancelbutton id="BTN_CANCEL" show="false"/>
+ <helpbutton id="BTN_HELP" show="false"/>
+ <resetbutton id="BTN_RESET" show="false"/>
+ <pushbutton id="BTN_BASEFMT" _label="&lt;Base Format&gt;" show="false"/>
+ </dialogbuttonhbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/util/makefile.mk b/toolkit/util/makefile.mk
new file mode 100644
index 000000000000..48d534a8a9b3
--- /dev/null
+++ b/toolkit/util/makefile.mk
@@ -0,0 +1,85 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# tk.dxp should contain all c functions that have to be exported. MT 2001/11/29
+
+PRJ=..
+
+PRJNAME=toolkit
+TARGET=tk
+TARGET2=tka
+USE_DEFFILE=TRUE
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+
+# --- Allgemein ----------------------------------------------------------
+
+# ========================================================================
+# = tk lib: the "classic" toolkit library
+
+LIB1TARGET= $(SLB)$/$(TARGET).lib
+LIB1FILES= $(SLB)$/awt.lib \
+ $(SLB)$/tree.lib \
+ $(SLB)$/grid.lib \
+ $(SLB)$/controls.lib \
+ $(SLB)$/helper.lib\
+ $(SLB)$/layout-core.lib \
+ $(SLB)$/layout-vcl.lib
+
+SHL1TARGET= tk$(DLLPOSTFIX)
+SHL1IMPLIB= itk
+SHL1USE_EXPORTS=name
+
+SHL1STDLIBS=\
+ $(VCLLIB) \
+ $(UNOTOOLSLIB) \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPUHELPERLIB) \
+ $(CPPULIB) \
+ $(SALLIB)
+
+SHL1LIBS= $(LIB1TARGET)
+SHL1DEF= $(MISC)$/$(SHL1TARGET).def
+SHL1DEPN=$(LIB1TARGET)
+
+DEF1NAME =$(SHL1TARGET)
+DEF1DEPN =$(LIB1TARGET)
+DEF1DES =TK
+DEFLIB1NAME =tk
+
+RESLIB1IMAGES=$(PRJ)$/source$/awt
+RES1FILELIST=$(SRS)$/awt.srs
+RESLIB1NAME=$(TARGET)
+RESLIB1SRSFILES=$(RES1FILELIST)
+
+# --- Footer -------------------------------------------------------------
+.INCLUDE : target.mk
diff --git a/toolkit/util/makefile.pmk b/toolkit/util/makefile.pmk
new file mode 100644
index 000000000000..f04a39bac91b
--- /dev/null
+++ b/toolkit/util/makefile.pmk
@@ -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.
+#
+#*************************************************************************
+
+# Reduction of exported symbols:
+CDEFS += -DTOOLKIT_DLLIMPLEMENTATION
+VISIBILITY_HIDDEN=TRUE
+
+CFLAGS+=-I$(PRJ)/source
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+CFLAGS+=-DTEST_LAYOUT=1
+.ENDIF # ENABLE_LAYOUT == TRUE
diff --git a/toolkit/util/toolkit.xml b/toolkit/util/toolkit.xml
new file mode 100644
index 000000000000..2fb4588550bc
--- /dev/null
+++ b/toolkit/util/toolkit.xml
@@ -0,0 +1,750 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"[]>
+<module-description xmlns:xlink="http://www.w3.org/1999/xlink">
+ <module-name>toolkit</module-name>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.Toolkit</name>
+ <description>Toolkit...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.Toolkit</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlContainer</name>
+ <description>UnoControlContainer...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlContainer</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlContainerModel</name>
+ <description>UnoControlContainerModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlContainerModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.TabController</name>
+ <description>TabController...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.TabController</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.TabControllerModel</name>
+ <description>TabControllerModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.TabControllerModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlDialog</name>
+ <description>UnoControlDialog...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlDialog</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlDialogModel</name>
+ <description>UnoControlDialogModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlDialogModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlEdit</name>
+ <description>UnoControlEdit...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlEdit</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlEditModel</name>
+ <description>UnoControlEditModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlEditModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlFileControl</name>
+ <description>UnoControlFileControl...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlFileControl</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlFileControlModel</name>
+ <description>UnoControlFileControlModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlFileControlModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlButton</name>
+ <description>UnoControlButton...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlButton</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlButtonModel</name>
+ <description>UnoControlButtonModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlButtonModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlImageControl</name>
+ <description>UnoControlImageControl...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlImageControl</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlImageControlModel</name>
+ <description>UnoControlImageControlModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlImageControlModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlRadioButton</name>
+ <description>UnoControlRadioButton...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlRadioButton</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlRadioButtonModel</name>
+ <description>UnoControlRadioButtonModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlRadioButtonModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlCheckBox</name>
+ <description>UnoControlCheckBox...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlCheckBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlCheckBoxModel</name>
+ <description>UnoControlCheckBoxModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlCheckBoxModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlListBox</name>
+ <description>UnoControlListBox...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlListBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlListBoxModel</name>
+ <description>UnoControlListBoxModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlListBoxModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlComboBox</name>
+ <description>UnoControlComboBox...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlComboBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlComboBoxModel</name>
+ <description>UnoControlComboBoxModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlComboBoxModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlFixedText</name>
+ <description>UnoControlFixedText...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlFixedText</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlFixedTextModel</name>
+ <description>UnoControlFixedTextModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlFixedTextModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlGroupBox</name>
+ <description>UnoControlGroupBox...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlGroupBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlGroupBoxModel</name>
+ <description>UnoControlGroupBoxModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlGroupBoxModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlDateField</name>
+ <description>UnoControlDateField...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlDateField</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlDateFieldModel</name>
+ <description>UnoControlDateFieldModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlDateFieldModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlTimeField</name>
+ <description>UnoControlTimeField...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlTimeField</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlTimeFieldModel</name>
+ <description>UnoControlTimeFieldModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlTimeFieldModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlNumericField</name>
+ <description>UnoControlNumericField...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlNumericField</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlNumericFieldModel</name>
+ <description>UnoControlNumericFieldModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlNumericFieldModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlCurrencyField</name>
+ <description>UnoControlCurrencyField...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlCurrencyField</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlCurrencyFieldModel</name>
+ <description>UnoControlCurrencyFieldModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlCurrencyFieldModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlPatternField</name>
+ <description>UnoControlPatternField...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlPatternField</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlPatternFieldModel</name>
+ <description>UnoControlPatternFieldModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlPatternFieldModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlFormattedField</name>
+ <description>UnoControlFormattedField...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlFormattedField</supported-service>
+ </component-description>
+ <component-description>
+ <author>Malte Timmermann</author>
+ <name>com.sun.star.awt.UnoControlFormattedFieldModel</name>
+ <description>UnoControlFormattedFieldModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlFormattedFieldModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.awt.UnoControlProgressBarModel</name>
+ <description>UnoControlProgressBarModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlProgressBarModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.awt.UnoControlScrollBarModel</name>
+ <description>UnoControlScrollBarModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlScrollBarModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>stardiv.toolkit.UnoScrollBarControl</name>
+ <description>UnoScrollBarControl...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlScrollBar</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.awt.UnoControlFixedLineModel</name>
+ <description>UnoControlFixedLineModel...</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlFixedLineModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleWindow</name>
+ <description>specifies accessibility support for a window.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleWindow</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleButton</name>
+ <description>specifies accessibility support for a button.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleButton</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleRadioButton</name>
+ <description>specifies accessibility support for a radio button.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleRadioButton</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleCheckBox</name>
+ <description>specifies accessibility support for a check box.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleCheckBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleFixedText</name>
+ <description>specifies accessibility support for a fixed text.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleFixedText</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleEdit</name>
+ <description>specifies accessibility support for an edit.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleEdit</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleScrollBar</name>
+ <description>specifies accessibility support for a scroll bar.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleScrollBar</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleListBox</name>
+ <description>specifies accessibility support for a list box.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleListBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleList</name>
+ <description>specifies accessibility support for a list.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleList</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleListItem</name>
+ <description>specifies accessibility support for a list item.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleListItem</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleDropDownListBox</name>
+ <description>specifies accessibility support for a dropdown list box.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleDropDownListBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleComboBox</name>
+ <description>specifies accessibility support for a combo box.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleComboBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleDropDownComboBox</name>
+ <description>specifies accessibility support for a dropdown combo box.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleDropDownComboBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleToolBox</name>
+ <description>specifies accessibility support for a tool box.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleToolBox</supported-service>
+ </component-description>
+ <component-description>
+ <author>Peter Burow</author>
+ <name>com.sun.star.comp.toolkit.AccessibleToolBoxItem</name>
+ <description>specifies accessibility support for a tool box item.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleToolBoxItem</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessiblePopupMenu</name>
+ <description>specifies accessibility support for a popup menu.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessiblePopupMenu</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleMenuBar</name>
+ <description>specifies accessibility support for a menu bar.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleMenuBar</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleMenu</name>
+ <description>specifies accessibility support for a menu.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleMenu</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleMenuItem</name>
+ <description>specifies accessibility support for a menu item.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleMenuItem</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleMenuSeparator</name>
+ <description>specifies accessibility support for a menu separator.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleMenuSeparator</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleTabControl</name>
+ <description>specifies accessibility support for a tab control.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleTabControl</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleTabPage</name>
+ <description>specifies accessibility support for a tab page.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleTabPage</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleStatusBar</name>
+ <description>specifies accessibility support for a status bar.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleStatusBar</supported-service>
+ </component-description>
+ <component-description>
+ <author>Thomas Benisch</author>
+ <name>com.sun.star.comp.toolkit.AccessibleStatusBarItem</name>
+ <description>specifies accessibility support for a status bar item.</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.AccessibleStatusBarItem</supported-service>
+ </component-description>
+ <component-description>
+ <author>Frank Schönheit</author>
+ <name>com.sun.star.comp.toolkit.UnoSpinButtonControlModel</name>
+ <description>specifies the model of a spin button control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlModel</supported-service>
+ <supported-service>com.sun.star.awt.UnoControlSpinButtonModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Frank Schönheit</author>
+ <name>com.sun.star.comp.toolkit.UnoSpinButtonControl</name>
+ <description>specifies a spin button control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControl</supported-service>
+ <supported-service>com.sun.star.awt.UnoControlSpinButton</supported-service>
+ </component-description>
+ <component-description>
+ <author>Dirk Voelzke</author>
+ <name>com.sun.star.comp.toolkit.UnoSimpleAnimationControlModel</name>
+ <description>specifies the model of a simple animation control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlModel</supported-service>
+ <supported-service>com.sun.star.awt.UnoSimpleAnimationControlModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Dirk Voelzke</author>
+ <name>com.sun.star.comp.toolkit.UnoSimpleAnimationControl</name>
+ <description>specifies a simple animation control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControl</supported-service>
+ <supported-service>com.sun.star.awt.UnoSimpleAnimationControl</supported-service>
+ </component-description>
+ <component-description>
+ <author>Dirk Voelzke</author>
+ <name>com.sun.star.comp.toolkit.UnoThrobberControlModel</name>
+ <description>specifies the model of a throbber control (a spinning wheel)</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControlModel</supported-service>
+ <supported-service>com.sun.star.awt.UnoThrobberControlModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Dirk Voelzke</author>
+ <name>com.sun.star.comp.toolkit.UnoThrobberControl</name>
+ <description>specifies a throbber control (a spinning wheel)</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="final" />
+ <supported-service>com.sun.star.awt.UnoControl</supported-service>
+ <supported-service>com.sun.star.awt.UnoThrobberControl</supported-service>
+ </component-description>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>stardiv.Toolkit.UnoTreeModel</name>
+ <description>specifies the model of a tree control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.tree.TreeControlModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>stardiv.Toolkit.UnoTreeControl</name>
+ <description>specifies a tree control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.tree.TreeControl</supported-service>
+ </component-description>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>toolkit.MutableTreeDataModel</name>
+ <description>specifies the mutable data model of a tree control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.tree.MutableTreeDataModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Christian Lippka</author>
+ <name>toolkit.MutableTreeNode</name>
+ <description>specifies a mutable tree node</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.tree.MutableTreeNode</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.UnoGridModel</name>
+ <description>specifies the model of a grid control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.UnoControlGridModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.UnoGridControl</name>
+ <description>specifies a grid control</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.UnoControlGrid</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.DefaultGridDataModel</name>
+ <description>specifies the grid control default data model</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.DefaultGridDataModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.DefaultGridColumnModel</name>
+ <description>specifies the grid control default column model</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.DefaultGridColumnModel</supported-service>
+ </component-description>
+ <component-description>
+ <author>Tobias Krause</author>
+ <name>stardiv.Toolkit.GridColumn</name>
+ <description>specifies the grid coloumn model</description>
+ <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
+ <language>c++</language>
+ <status value="beta" />
+ <supported-service>com.sun.star.awt.grid.GridColumn</supported-service>
+ </component-description>
+
+</module-description> \ No newline at end of file
diff --git a/toolkit/workben/controls.cxx b/toolkit/workben/controls.cxx
new file mode 100644
index 000000000000..9047e914a76d
--- /dev/null
+++ b/toolkit/workben/controls.cxx
@@ -0,0 +1,449 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_toolkit.hxx"
+#include <tools/debug.hxx>
+
+#include <vcl/window.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <vcl/msgbox.hxx>
+
+
+#include <stardiv/uno/awt/window.hxx>
+#include <stardiv/uno/awt/vclwin.hxx>
+#include <stardiv/uno/awt/printer.hxx>
+#include <stardiv/uno/repos/serinfo.hxx>
+#include <stardiv/uno/lang/factory.hxx>
+
+
+#include <unoctrl.hxx>
+// #include <unoctrl2.hxx>
+
+#include <svtools/unoiface.hxx> // InitExtToolkit
+
+UsrAny UsrAny_UINT16( UINT16 n )
+{
+ UsrAny aVal;
+ aVal.setUINT16( n );
+ return aVal;
+}
+
+// -----------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main();
+};
+
+MyApp aMyApp;
+
+// -----------------------------------------------------------------------
+
+class MyWin : public WorkWindow
+{
+ XControlRef xCtrl;
+ XPropertySetRef xCtrlModel;
+ XControlContainerRef xCont;
+ XPropertySetRef xContModel;
+ XControlRef xDrawCtrl;
+ XGraphicsRef xG;
+
+public:
+ MyWin( Window* pParent, WinBits nWinStyle );
+ ~MyWin();
+
+ void MouseButtonDown( const MouseEvent& rMEvt );
+ void Resize();
+ void Paint( const Rectangle& r );
+};
+
+// -----------------------------------------------------------------------
+
+void MyApp::Main()
+{
+ createAndSetDefaultServiceManager();
+
+ MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
+ aMainWin.SetText( "Uno-Controls - Workbench" );
+ aMainWin.Show();
+ Execute();
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::MyWin( Window* pParent, WinBits nWinStyle ) :
+ WorkWindow( pParent, nWinStyle )
+{
+}
+
+// -----------------------------------------------------------------------
+MyWin::~MyWin()
+{
+ XComponentRef xC1( xCont, USR_QUERY );
+ xC1->dispose();
+ XComponentRef xC2( xContModel, USR_QUERY );
+ xC2->dispose();
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( rMEvt.GetClicks() == 2 )
+ {
+ XViewRef xV( xDrawCtrl, USR_QUERY );
+ XWindowRef xC( xDrawCtrl, USR_QUERY );
+ xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
+
+ // Printer Testen...
+/*
+ XServiceManagerRef xProv = getGlobalServiceManager();
+ XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.PrinterServer" );
+ XPrinterServerRef xPrinterServer( xSSI->createInstance(), USR_QUERY );
+
+ Sequence< UString > aPrinterNames = xPrinterServer->getPrinterNames();
+ USHORT nPrinters = aPrinterNames.getLen();
+ String aInfo( "Printers: " );
+ aInfo += nPrinters;
+ if ( nPrinters )
+ {
+ for ( USHORT n = 0; n < nPrinters; n++ )
+ {
+ aInfo += '\n';
+ aInfo += OUStringToString( aPrinterNames.getConstArray()[n], CHARSET_SYSTEM );
+ }
+
+ XPrinterRef xPrinter = xPrinterServer->createPrinter( aPrinterNames.getConstArray()[0] );
+ xPrinter->start( L"UNOPrinterTest", 1, TRUE );
+ XDeviceRef xDev = xPrinter->startPage();
+ XGraphicsRef xGraphics = xDev->createGraphics();
+ xGraphics->drawText( 200, 200, L"Printed with UNO" );
+ xPrinter->endPage();
+ xPrinter->end();
+ }
+ InfoBox( this, aInfo ).Execute();
+*/
+ }
+ else if( rMEvt.GetClicks() == 1 )
+ {
+ if( xContModel )
+ {
+ static INT32 nColor = 0x001788ab;
+ xContModel->setPropertyValue( L"BackgroundColor", UsrAny( nColor ) );
+ nColor += 0x00111111;
+ nColor &= 0xFFFFFF;
+ }
+ else
+ {
+ XServiceManagerRef xProv = getGlobalServiceManager();
+
+ XMultiServiceFactoryRef xMSF = NAMESPACE_USR( getProcessServiceManager )();
+
+ XServiceProviderRef xSSI = xProv->queryServiceProvider( L"stardiv.vcl.VclToolkit" );
+ XToolkitRef xToolkit( xMSF->createInstance( L"stardiv.vcl.VclToolkit" ), USR_QUERY );
+ DBG_ASSERT( xToolkit, "No Toolkit!" );
+
+ // Uno Container + Model erzeugen
+ XServiceProviderRef xModelProv; // = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ControlContainer" );
+ XInterfaceRef xCMRef( xMSF->createInstance(L"stardiv.vcl.controlmodel.ControlContainer") );
+ xCMRef->queryInterface( XPropertySet::getSmartUik(), xContModel );
+ xContModel->setPropertyValue( L"Border", UsrAny_UINT16( 1 ) );
+ xContModel->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00CCCCCC) );
+
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ControlContainer" );
+ XInterfaceRef xCCRef( xModelProv->createInstance(), USR_QUERY );
+ xCCRef->queryInterface( XControlContainer::getSmartUik(), xCont );
+
+ XControlModelRef xCM( xContModel, USR_QUERY );
+ XControlRef xContControl( xCont, USR_QUERY );
+ xContControl->setModel( xCM );
+ XWindowRef xContComp( xCont, USR_QUERY );
+ xContComp->setPosSize( 0, 0, 500, 600, PosSize_POSSIZE );
+
+ // Zwei EditControls auf einem Model...
+// xModelProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEditModel" );
+ XInterfaceRef xModel( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEditModel") );
+ DBG_ASSERT( xModel, "No Model!" );
+
+ XPropertySetRef xPSet( xModel, USR_QUERY );
+ xPSet->setPropertyValue( L"Text", UsrAny( UString( L"Hallo!" ) ) );
+ xPSet->setPropertyValue( L"FontName", UsrAny( UString( L"Times New Roman" ) ) );
+// xPSet->setPropertyValue( L"FontWeight", UsrAny( 200 ) );
+
+ XServiceProviderRef xEditCtrlProv = xProv->queryServiceProvider( L"stardiv.uno.awt.UnoControlEdit" );
+ // Edit1
+ XControlRef xEdit1( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
+ xModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xEdit1->setModel( xCM );
+ XWindowRef xEditCmp1( xEdit1, USR_QUERY );
+ xEditCmp1->setPosSize( 50, 50, 100, 60, PosSize_POSSIZE );
+ xCont->addControl( L"", xEdit1 );
+ // Edit2
+ XControlRef xEdit2( xMSF->createInstance(L"stardiv.uno.awt.UnoControlEdit"), USR_QUERY );
+ xModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xEdit2->setModel( xCM );
+ XWindowRef xEditCmp2( xEdit2, USR_QUERY );
+ XLayoutConstrainsRef xL( xEdit2, USR_QUERY );
+ if ( xL.is() )
+ {
+ Size aSz = xL->getPreferredSize();
+ xEditCmp2->setPosSize( 100, 180, aSz.Width(), aSz.Height(), PosSize_POSSIZE );
+ }
+ else
+ xEditCmp2->setPosSize( 100, 180, 100, 40, PosSize_POSSIZE );
+ xCont->addControl( L"", xEdit2 );
+
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.NumericField" );
+ XInterfaceRef xNumModel( xModelProv->createInstance(), USR_QUERY );
+ DBG_ASSERT( xNumModel, "No Model!" );
+
+
+ XServiceProviderRef xNumFieldProv = xProv->queryServiceProvider( L"stardiv.vcl.control.NumericField" );
+ XControlRef xNumField( xNumFieldProv->createInstance(), USR_QUERY );
+ xNumModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xNumField->setModel( xCM );
+ XWindowRef xNumFieldWin( xNumField, USR_QUERY );
+ xNumFieldWin->setPosSize( 50, 250, 100, 60, PosSize_POSSIZE );
+ xCont->addControl( L"", xNumField );
+
+ XMultiPropertySetRef xPSet2( xNumModel, USR_QUERY );
+ Sequence<UString> Names( 2 );
+ Names.getArray()[0] = L"Value";
+ Names.getArray()[1] = L"ValueMin";
+ Sequence<UsrAny> Values( 2 );
+ Values.getArray()[0] = UsrAny( -2000000.0 );
+ Values.getArray()[1] = UsrAny( -2000000.0 );
+ xPSet2->setPropertyValues( Names, Values );
+
+
+ // Button...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.Button" );
+ xModelProv->createInstance()->queryInterface( XInterface::getSmartUik(), xModel );
+ DBG_ASSERT( xModel, "No Model!" );
+
+ xModel->queryInterface( XPropertySet::getSmartUik(), xPSet );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Press!" ) );
+
+ XServiceProviderRef xButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.Button" );
+ XControlRef xButton1( xButtonCtrlProv->createInstance(), USR_QUERY );
+ xModel->queryInterface( XControlModel::getSmartUik(), xCM );
+ xButton1->setModel( xCM );
+ XWindowRef xButtonCmp1( xButton1, USR_QUERY );
+ xButtonCmp1->setPosSize( 170, 80, 80, 80, PosSize_POSSIZE );
+ // Unsichtbar, nur im MBDown mit DrawRoutine bei Doppel-Klick...
+ xButtonCmp1->setVisible( FALSE );
+ xDrawCtrl = xButton1;
+
+ xCont->addControl( L"", xButton1 );
+
+/*
+
+ // ListBox...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.ListBox" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ Sequence<UString> aSeq( 7 );
+ aSeq.getArray()[0] = L"Item1";
+ aSeq.getArray()[1] = L"Item2";
+ aSeq.getArray()[2] = L"Item3";
+ aSeq.getArray()[3] = L"Item4";
+ aSeq.getArray()[4] = L"Item5";
+ aSeq.getArray()[5] = L"Item6";
+ aSeq.getArray()[6] = L"Item7";
+ xPSet->setPropertyValue( L"StringItemList", UsrAny( &aSeq, Sequence<UString>::getReflection() ) );
+ xPSet->setPropertyValue( L"LineCount", UsrAny_UINT16( 4 ) );
+ xPSet->setPropertyValue( L"Dropdown", UsrAny( (BOOL)TRUE ) );
+
+ XServiceProviderRef xListBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.ListBox" );
+ XControlRef xListBox1 = (XControl*)xListBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xListBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xListBoxCmp1 = (XWindow*)xListBox1->queryInterface( XWindow::getSmartUik() );
+ xListBoxCmp1->setPosSize( 20, 250, 200, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xListBox1 );
+
+ // FixedText...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.FixedText" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ DBG_ASSERT( xModel, "No Model!" );
+
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Label:" ) );
+ xPSet->setPropertyValue( L"BackgroundColor", UsrAny( (UINT32)0x00888888) );
+
+ Font_Attribs aFontAttrs;
+ aFontAttrs.Italic = ITALIC_NORMAL;
+ xPSet->setPropertyValue( L"Font_Attribs", UsrAny( &aFontAttrs, Font_Attribs_getReflection() ) );
+
+ XPropertyStateRef xState = (XPropertyState*)xPSet->queryInterface( XPropertyState::getSmartUik() );
+ xState->getPropertyState( L"Font_Attribs" );
+ xState->getPropertyState( L"Font_Size" );
+
+ XServiceProviderRef xFixedTextCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.FixedText" );
+ XControlRef xFixedText1 = (XControl*)xFixedTextCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ DBG_ASSERT( xFixedText1, "No FixedText!" );
+ xFixedText1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xFixedTextCmp1 = (XWindow*)xFixedText1->queryInterface( XWindow::getSmartUik() );
+ xFixedTextCmp1->setPosSize( 20, 20, 120, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xFixedText1 );
+
+ // TabTest...
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.GroupBox" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio-Test:" ) );
+ XServiceProviderRef xGroupBoxCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.GroupBox" );
+ XControlRef xGroupBox1 = (XControl*)xGroupBoxCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xGroupBox1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xGroupBoxCmp1 = (XWindow*)xGroupBox1->queryInterface( XWindow::getSmartUik() );
+ xGroupBoxCmp1->setPosSize( 30, 410, 100, 130, PosSize_POSSIZE );
+ xCont->addControl( L"", xGroupBox1 );
+
+ XServiceProviderRef xRadioButtonModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.RadioButton" );
+ XServiceProviderRef xRadioButtonCtrlProv = xProv->queryServiceProvider( L"stardiv.vcl.control.RadioButton" );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT1 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT1->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC1 = (XWindow*)xT1->queryInterface( XWindow::getSmartUik() );
+ xTC1->setPosSize( 40, 430, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT1 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio1" ) );
+ xPSet->setPropertyValue( L"State", UsrAny_UINT16( 1 ) );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT2 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT2->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC2 = (XWindow*)xT2->queryInterface( XWindow::getSmartUik() );
+ xTC2->setPosSize( 40, 470, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT2 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio2" ) );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT3 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT3->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC3 = (XWindow*)xT3->queryInterface( XWindow::getSmartUik() );
+ xTC3->setPosSize( 40, 510, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT3 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio3" ) );
+
+ xModel = (XInterface*)xRadioButtonModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XControlRef xT4 = (XControl*)xRadioButtonCtrlProv->createInstance()->queryInterface( XControl::getSmartUik() );
+ xT4->setModel( (XControlModel*)xModel->queryInterface( XControlModel::getSmartUik() ) );
+ XWindowRef xTC4 = (XWindow*)xT4->queryInterface( XWindow::getSmartUik() );
+ xTC4->setPosSize( 40, 550, 80, 20, PosSize_POSSIZE );
+ xCont->addControl( L"", xT4 );
+ xPSet = (XPropertySet*)xModel->queryInterface( XPropertySet::getSmartUik() );
+ xPSet->setPropertyValue( L"Label", UsrAny( L"Radio4 - no" ) );
+ xPSet->setPropertyValue( L"Tabstop", UsrAny( (BOOL)TRUE ) );
+
+ // TabController:
+ xModelProv = xProv->queryServiceProvider( L"stardiv.vcl.controlmodel.TabController" );
+ xModel = (XInterface*)xModelProv->createInstance()->queryInterface( XInterface::getSmartUik() );
+ XTabControllerModelRef xTCModel = (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() );
+
+ XServiceProviderRef xTCProv = xProv->queryServiceProvider( L"stardiv.vcl.control.TabController" );
+ XTabControllerRef xTC = (XTabController*)xTCProv->createInstance()->queryInterface( XTabController::getSmartUik() );
+ xTC->setModel( (XTabControllerModel*)xModel->queryInterface( XTabControllerModel::getSmartUik() ) );
+ XUnoControlContainerRef xUCC = (XUnoControlContainer*)xCont->queryInterface( XUnoControlContainer::getSmartUik() );
+ xUCC->addTabController( xTC );
+
+ Sequence<XControlModelRef> aControls( 5 );
+ aControls.getArray()[0] = xGroupBox1->getModel();
+ aControls.getArray()[1] = xT1->getModel();
+ aControls.getArray()[2] = xT3->getModel();
+ aControls.getArray()[3] = xT2->getModel();
+ aControls.getArray()[4] = xT4->getModel();
+ xTCModel->setControls( aControls );
+
+ Sequence<XControlModelRef> aGroup( 3 );
+ aGroup.getArray()[0] = xT1->getModel();
+ aGroup.getArray()[1] = xT3->getModel();
+ aGroup.getArray()[2] = xT2->getModel();
+ xTCModel->setGroup( aGroup, L"test" );
+*/
+ // Container anzeigen...
+ // Als Child zu diesem Fenster
+ xContControl->createPeer( XToolkitRef(), GetComponentInterface( TRUE ) );
+
+ XDeviceRef xD( xContControl->getPeer(), USR_QUERY );
+ xG = xD->createGraphics();
+ XViewRef xV ( xDrawCtrl, USR_QUERY );
+ xV->setGraphics( xG );
+
+// ((UnoControl*)(XControl*)xNumField))->updateFromModel();
+
+/*
+ // TEST:
+ WindowDecriptor aDescr;
+ aDescr.ComponentServiceName = "window";
+ aDescr.Type = VCLCOMPONENTTYPE_CONTAINER;
+ aDescr.Parent = GetComponentInterface( TRUE );
+ aDescr.WindowAttributes = WA_SHOW|WA_BORDER;
+ aDescr.Bounds = Rectangle( Point( 500, 50 ), Size( 300, 200 ) );
+ XVclWindowPeerRef xSPWin = xToolkit->createComponent( aDescr );
+
+ WindowDecriptor aDescr2;
+ aDescr2.ComponentServiceName = "scrollbar";
+ aDescr2.Type = VCLCOMPONENTTYPE_SIMPLE;
+ aDescr2.Parent = xSPWin;
+ aDescr2.WindowAttributes = WA_SHOW|WA_BORDER|WA_VSCROLL;
+ aDescr2.Bounds = Rectangle( Point( 250, 0 ), Size( 50, 200 ) );
+ XVclWindowPeerRef xSB = xToolkit->createComponent( aDescr2 );
+*/
+ }
+ return;
+ }
+ WorkWindow::MouseButtonDown( rMEvt );
+}
+
+
+// -----------------------------------------------------------------------
+
+void MyWin::Resize()
+{
+ WorkWindow::Resize();
+}
+
+void MyWin::Paint( const Rectangle& r )
+{
+ // Muss ueber PaintListener geschehen...
+ if ( xDrawCtrl.is() )
+ {
+ XViewRef xV( xDrawCtrl, USR_QUERY );
+ XWindowRef xC( xDrawCtrl, USR_QUERY );
+ xV->draw( xC->getPosSize().Left(), xC->getPosSize().Top() );
+ }
+
+}
+
diff --git a/toolkit/workben/layout/.gitignore b/toolkit/workben/layout/.gitignore
new file mode 100644
index 000000000000..142ba57c1444
--- /dev/null
+++ b/toolkit/workben/layout/.gitignore
@@ -0,0 +1,4 @@
+/de
+/en-US
+/nl
+/ja \ No newline at end of file
diff --git a/toolkit/workben/layout/README b/toolkit/workben/layout/README
new file mode 100644
index 000000000000..3b83bbfc00cd
--- /dev/null
+++ b/toolkit/workben/layout/README
@@ -0,0 +1,43 @@
+Testing workbench and editor for Layout engine.
+
+* Configure using --enable-layout.
+
+* [d]make all
+
+* export OOO_INSTALL_PREFIX=$(pwd)/ooo-layout
+
+* [d]make install DESTDIR=$OOO_INSTALL_PREFIX
+
+* Compile test program in toolkit/workben/layout
+
+ cd toolkit/workben/layout && dmake all
+
+* FIXME: New three layer install/rpath feature needs these workarounds
+|
+| test -d $OOO_INSTALL_PREFIX/openoffice.org3 && export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX/openoffice.org3 || export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX
+| cp -f ../..$INPATH/lib/libtkx.so $OOO_PREFIX/openoffice.org/basis3.0/program
+| export LD_LIBRARY_PATH=$OOO_PREFIX_BRAND/basis-link/program:$OOO_PREFIX_BRAND/basis-link/ure-link/lib
+|
+| (see source/layout/helper.cxx)
+
+* Run it on any .xml file
+
+ ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] zoom.xml
+
+* Run it for specific dialogs, see test.cxx
+
+ ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] --test zoom
+ ../../$INPATH/bin/test [--inst $OOO_INSTALL_PREFIX] --test wordcount
+
+* Or source refresh in workben/layout, do something like
+
+ cd toolkit/workben/layout && . ./refresh [--inst $OOO_INSTALL_PREFIX]
+
+Integration into OOo:
+
+* After instaling, run
+
+ cd ooo-cvs/program
+ ./soffice.bin
+
+ Start a [Writer] document and choose View/Zoom or Extra/Word count.
diff --git a/toolkit/workben/layout/TEST b/toolkit/workben/layout/TEST
new file mode 100755
index 000000000000..8a04a6628da8
--- /dev/null
+++ b/toolkit/workben/layout/TEST
@@ -0,0 +1,11 @@
+#! /bin/sh
+for d in $(cd ../../../../.. && pwd)/ooo-svn /usr/lib/ooo3/; do
+ if test -d $d; then
+ export OOO_INSTALL_PREFIX=$d
+ break
+ fi
+done
+export SAL_ALLOW_LINKOO_SYMLINKS=1
+test -d $OOO_INSTALL_PREFIX/openoffice.org3 && export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX/openoffice.org3 || export OOO_PREFIX_BRAND=$OOO_INSTALL_PREFIX
+export LD_LIBRARY_PATH="$OOO_PREFIX_BRAND/basis-link/program:$OOO_PREFIX_BRAND/basis-link/ure-link/lib"
+../../unx*.pro/bin/test "$@"
diff --git a/toolkit/workben/layout/adjust.xml b/toolkit/workben/layout/adjust.xml
new file mode 100644
index 000000000000..186a94bf5e6a
--- /dev/null
+++ b/toolkit/workben/layout/adjust.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ id="window1" title="Text Editor" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <!-- Ver Top -->
+ <hbox>
+ <align v-align="0" h-align="0" v-fill="0" h-fill="0">
+ <pushbutton label="Top Left" />
+ </align>
+ <align>
+ <pushbutton label="Top Middle" v-align="0" h-align="0.5" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Top Right" v-align="0" h-align="1" v-fill="0" h-fill="0" />
+ </align>
+ </hbox>
+ <!-- Ver Middle -->
+ <hbox>
+ <align>
+ <pushbutton label="Middle Left" v-align="0.5" h-align="0" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Middle Middle" v-align="0.5" h-align="0.5" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Middle Right" v-align="0.5" h-align="1" v-fill="0" h-fill="0" />
+ </align>
+ </hbox>
+ <!-- Ver Bottom -->
+ <hbox>
+ <align>
+ <pushbutton label="Bottom Left" v-align="1" h-align="0" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Bottom Middle" v-align="1" h-align="0.5" v-fill="0" h-fill="0" />
+ </align>
+ <align>
+ <pushbutton label="Bottom Right" v-align="1" h-align="1" v-fill="0" h-fill="0" />
+ </align>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/align-test.xml b/toolkit/workben/layout/align-test.xml
new file mode 100644
index 000000000000..60c34b4655a5
--- /dev/null
+++ b/toolkit/workben/layout/align-test.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Align Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <fixedline/>
+ <hbox spacing="0" border="0">
+ <vbox spacing="5" border="5">
+ <fixedline _text="X" cnt:expand="false"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ <pushbutton label="foo"/>
+ </vbox>
+ <vbox spacing="5" border="5">
+ <fixedline _text="X" cnt:expand="false"/>
+ <pushbutton label="bar"/>
+ </vbox>
+ </hbox>
+ <fixedline/>
+ <min-size cnt:spacing="0" min-width="200"/>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/align.xml b/toolkit/workben/layout/align.xml
new file mode 100644
index 000000000000..85aee220fc78
--- /dev/null
+++ b/toolkit/workben/layout/align.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Align Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <!-- Ver Top -->
+ <hbox>
+ <align halign="0" valign="0">
+ <pushbutton label="Top Left" />
+ </align>
+ <align halign="0.5" valign="0">
+ <pushbutton label="Top Middle" />
+ </align>
+ <align halign="1" valign="0">
+ <pushbutton label="Top Right" />
+ </align>
+ </hbox>
+ <!-- Ver Middle -->
+ <hbox>
+ <align halign="0" valign="0.5">
+ <pushbutton label="Middle Left" />
+ </align>
+ <align halign="0.5" valign="0.5">
+ <pushbutton label="Middle Middle" />
+ </align>
+ <align halign="1" valign="0.5">
+ <pushbutton label="Middle Right" />
+ </align>
+ </hbox>
+ <!-- Ver Bottom -->
+ <hbox>
+ <align halign="0" valign="1">
+ <pushbutton label="Bottom Left" />
+ </align>
+ <align halign="0.5" valign="1">
+ <pushbutton label="Bottom Middle" />
+ </align>
+ <align halign="1" valign="1">
+ <pushbutton label="Bottom Right" />
+ </align>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/boxtest.xml b/toolkit/workben/layout/boxtest.xml
new file mode 100644
index 000000000000..24ead837c057
--- /dev/null
+++ b/toolkit/workben/layout/boxtest.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Box Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <table>
+ <vbox>
+ <hbox cnt:expand="false" cnt:fill="false">
+ <pushbutton label="XML Left"
+ cnt:expand="false" cnt:fill="false"/>
+ <pushbutton label="XML Middle"
+ cnt:expand="true" cnt:fill="false"/>
+ <pushbutton label="XML Right"
+ cnt:expand="true" cnt:fill="true"/>
+ </hbox>
+ <hbox cnt:expand="true" cnt:fill="false">
+ <pushbutton label="XML Left"
+ cnt:expand="false" cnt:fill="false"/>
+ <pushbutton label="XML Middle"
+ cnt:expand="true" cnt:fill="false"/>
+ <pushbutton label="XML Right"
+ cnt:expand="true" cnt:fill="true"/>
+ </hbox>
+ <hbox cnt:expand="true" cnt:fill="true">
+ <pushbutton label="XML Left"
+ cnt:expand="false" cnt:fill="false"/>
+ <pushbutton label="XML Middle"
+ cnt:expand="true" cnt:fill="false"/>
+ <pushbutton label="XML Right"
+ cnt:expand="true" cnt:fill="true"/>
+ </hbox>
+ </vbox>
+ </table>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/dialogbuttons-ok.xml b/toolkit/workben/layout/dialogbuttons-ok.xml
new file mode 100644
index 000000000000..86c7a1b13818
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-ok.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/dialogbuttons-reset.xml b/toolkit/workben/layout/dialogbuttons-reset.xml
new file mode 100644
index 000000000000..6c1c613fe96d
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-reset.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <okbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Alternate"/>
+ <resetbutton/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/dialogbuttons-save.xml b/toolkit/workben/layout/dialogbuttons-save.xml
new file mode 100644
index 000000000000..38bd90773d0e
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-save.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <yesbutton label="~Save"/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton label="~Don't save"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/dialogbuttons-yes.xml b/toolkit/workben/layout/dialogbuttons-yes.xml
new file mode 100644
index 000000000000..78845598bffc
--- /dev/null
+++ b/toolkit/workben/layout/dialogbuttons-yes.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Dialog Button Ordering" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windows">
+ <flow/>
+ <yesbutton/>
+ <cancelbutton/>
+ <helpbutton/>
+ <nobutton xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/editor-normal.xml b/toolkit/workben/layout/editor-normal.xml
new file mode 100644
index 000000000000..7f0dc0b69e74
--- /dev/null
+++ b/toolkit/workben/layout/editor-normal.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Would be cool to have others Editor layouts (e.g. Glade-like with
+ a window for each function). -->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Layout Editor" sizeable="true" >
+ <vbox>
+ <hbox>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Layout:" cnt:expand="false" />
+ <hbox>
+ <listbox id="layout-tree" has_border="true" />
+ <vbox cnt:expand="false">
+ <pushbutton id="layout-up-button" cnt:expand="false" />
+ <pushbutton id="layout-down-button" cnt:expand="false" />
+ <fixedtext cnt:expand="true" />
+ <pushbutton id="layout-remove-button" cnt:expand="false" />
+ </vbox>
+ </hbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120">
+ <vbox>
+ <fixedtext label="Preview:" cnt:expand="false" />
+ <vbox border="50">
+ <bin id="preview-box" />
+ </vbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Properties:" cnt:expand="false" />
+ <table id="properties-box" columns="3" />
+ </vbox>
+ </min-size>
+ </hbox>
+ <hfixedline cnt:expand="false" />
+ <vbox cnt:expand="false">
+ <fixedtext label="Create widgets:" cnt:expand="false" />
+ <flow id="create-widget" homogeneous="true" spacing="2" />
+ <fixedtext label="Create containers:" cnt:expand="false" />
+ <flow id="create-container" homogeneous="true" spacing="2" />
+ </vbox>
+ <hbox cnt:expand="false">
+ <vbox><fixedline /><fixedline /><fixedline /><fixedline /></vbox>
+<!-- <pushbutton id="import-button" label="Import..." cnt:expand="false"/>-->
+ <pushbutton id="export-button" label="Export (stdout)" cnt:expand="false"/>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/editor.cxx b/toolkit/workben/layout/editor.cxx
new file mode 100644
index 000000000000..699c103d2ee8
--- /dev/null
+++ b/toolkit/workben/layout/editor.cxx
@@ -0,0 +1,1944 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "editor.hxx"
+
+#undef NDEBUG
+
+/*
+#include <stdio.h>
+#include <string.h>
+*/
+
+#include <cassert>
+#include <cstdio>
+#include <cstring>
+#include <list>
+#include <vector>
+
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XLayoutContainer.hpp>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <toolkit/helper/property.hxx>
+#include <vcl/lstbox.h>
+
+using namespace layout::css;
+
+using rtl::OUString;
+
+// FIXME:
+//#define FILEDLG
+
+#include <layout/core/helper.hxx>
+#include <layout/core/root.hxx>
+#include <layout/core/helper.hxx>
+
+// TODO: automatically generated
+struct WidgetSpec {
+ const char *pLabel, *pName, *pIconName;
+ bool bIsContainer; };
+static const WidgetSpec WIDGETS_SPECS[] = {
+ { "Label", "fixedtext" , "sc_label.png", false },
+ { "Button", "pushbutton" , "sc_pushbutton.png", false },
+ { "Radio Button", "radiobutton" , "sc_radiobutton.png", false },
+ { "Check Box", "checkbox" , "sc_checkbox.png", false },
+ { "Line Edit", "edit" , "sc_edit.png", false },
+ { "Numeric Field", "numericfield", "sc_numericfield.png", false },
+ { "List Box ", "listbox" , NULL, false },
+ // containers
+ { "Hor Box", "hbox" , NULL, true },
+ { "Ver Box", "vbox" , NULL, true },
+ { "Table", "table" , NULL, true },
+ { "Alignment", "align" , NULL, true },
+ { "Tab Control", "tabcontrol" , NULL, true },
+ { "Hor Splitter", "hsplitter" , NULL, true },
+ { "Ver Splitter", "vsplitter" , NULL, true },
+ { "Scroller", "scroller" , NULL, true },
+};
+const int WIDGETS_SPECS_LEN = sizeof (WIDGETS_SPECS) / sizeof (WidgetSpec);
+
+using namespace layout;
+using namespace layoutimpl;
+namespace css = ::com::sun::star;
+
+static rtl::OUString anyToString (uno::Any value)
+{
+ try
+ {
+ switch (value.getValueTypeClass()) {
+ case uno::TypeClass_STRING:
+ return value.get<rtl::OUString>();
+ case uno::TypeClass_CONSTANT:
+ return rtl::OUString::valueOf (value.get<sal_Int32>());
+ case uno::TypeClass_LONG:
+ return rtl::OUString::valueOf (value.get<sal_Int64>());
+ case uno::TypeClass_SHORT:
+ // FIXME: seems broken
+ return rtl::OUString::valueOf ((sal_Int32) value.get<short>());
+
+ case uno::TypeClass_FLOAT:
+ return rtl::OUString::valueOf (value.get<float>());
+ case uno::TypeClass_DOUBLE:
+ return rtl::OUString::valueOf (value.get<double>());
+
+ case uno::TypeClass_BOOLEAN:
+ {
+ bool val = value.get<sal_Bool>();
+ return rtl::OUString( val ? "1" : "0", 1, RTL_TEXTENCODING_ASCII_US );
+/* if ( val )
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "true" ) );
+ else
+ return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "false" ) );*/
+ }
+ default:
+ break;
+ }
+ }
+ catch(...) {}
+ return rtl::OUString();
+}
+
+static inline long anyToNatural (uno::Any value)
+{ return sal::static_int_cast<long>(anyToString( value ).toInt64()); }
+static inline double anyToDecimal (uno::Any value)
+{ return anyToString( value ).toDouble(); }
+
+/* XLayoutContainer/XLayoutConstrains are a bit of a hasle to work with.
+ Let's wrap them. */
+class Widget : public layoutimpl::LayoutWidget
+{
+ friend class EditorRoot;
+
+ Widget *mpParent;
+ std::vector< Widget *> maChildren;
+ bool mbForeign;
+
+ rtl::OUString mrId;
+ rtl::OUString mrLabel, mrUnoName;
+
+// TODO: store original properties. And some property handling methods.
+ long mnOriAttrbs;
+ layoutimpl::PropList maOriProps, maOriChildProps;
+
+public:
+
+ // to be used to wrap the root
+ Widget( uno::Reference< awt::XLayoutConstrains > xImport, const char *label )
+ : mpParent( 0 ), mbForeign( true )
+ {
+ mxWidget = xImport;
+ mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
+
+ mrLabel = rtl::OUString( label, strlen( label ), RTL_TEXTENCODING_UTF8 );
+
+#if 0 /* obsolete */
+ // FIXME: this code is meant to import a XML file. Just use the importer,
+ // then pass the root widget. But information like the ID string is lost.
+ // So, this needs to be more closely tight to the importer.
+ uno::Sequence< uno::Reference< awt::XLayoutConstrains > > aChildren;
+ for ( int i = 0; i < aChildren.getLength(); i++ )
+ {
+ Widget *pChild = new Widget( aChildren[ i ], "---" );
+ maChildren.push_back( pChild );
+ pChild->mpParent = this;
+ }
+#endif
+ }
+
+ Widget( rtl::OUString id, uno::Reference< awt::XToolkit > xToolkit,
+ uno::Reference< awt::XLayoutContainer > xParent,
+ rtl::OUString unoName, long nAttrbs )
+ : mpParent( 0 ), mbForeign( false ), mrId( id ),
+ mnOriAttrbs( nAttrbs )
+ {
+ while ( xParent.is() && !uno::Reference< awt::XWindow >( xParent, uno::UNO_QUERY ).is() )
+ {
+ uno::Reference< awt::XLayoutContainer > xContainer( xParent, uno::UNO_QUERY );
+ OSL_ASSERT( xContainer.is() );
+ xParent = uno::Reference< awt::XLayoutContainer >( xContainer->getParent(), uno::UNO_QUERY );
+ }
+
+ mxWidget = WidgetFactory::createWidget( xToolkit, xParent, unoName, nAttrbs );
+ OSL_ASSERT( mxWidget.is() );
+ mxContainer = uno::Reference< awt::XLayoutContainer >( mxWidget, uno::UNO_QUERY );
+
+ mrLabel = mrUnoName = unoName;
+ // try to get a nicer label for the widget
+ for ( int i = 0; i < WIDGETS_SPECS_LEN; i++ )
+ if ( unoName.equalsAscii( WIDGETS_SPECS[ i ].pName ) )
+ {
+ const char *label = WIDGETS_SPECS[ i ].pLabel;
+ mrLabel = rtl::OUString( label, strlen( label ), RTL_TEXTENCODING_UTF8 );
+ break;
+ }
+
+ // set default Text property
+ // TODO: disable editing of text fields, check boxes selected, etc...
+#if 0
+ uno::Reference< awt::XVclWindowPeer> xVclPeer( mxWidget, uno::UNO_QUERY )
+ if ( xVclPeer.is() ) // XVclWindowPeer ignores missing / incorrect properties
+
+//FIXME: it looks odd on widgets like NumericField seeing text which is deleted
+// when you interact with it... We can avoid it for those widgets, by doing a getProp
+// of "Text" and check if it is empty or not.
+
+ xVclPeer->setProperty( rtl::OUString::createFromAscii( "Text" ),
+ uno::makeAny( rtl::OUString::createFromAscii( "new widget" ) ) );
+#endif
+
+ // store original properties
+ {
+ PropertyIterator it( this, WINDOW_PROPERTY );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ rtl::OUString name( prop.Name );
+ rtl::OUString value( getProperty( name, WINDOW_PROPERTY ) );
+#if DEBUG_PRINT
+ fprintf(stderr, "original property: %s = %s\n", OUSTRING_CSTR(name), OUSTRING_CSTR(value));
+#endif
+ std::pair< rtl::OUString, rtl::OUString > pair( name, value );
+ maOriProps.push_back( pair );
+ }
+ }
+
+ }
+
+ ~Widget()
+ {
+ for ( std::vector< Widget *>::const_iterator it = maChildren.begin();
+ it != maChildren.end(); it++ )
+ delete *it;
+ if ( !mbForeign )
+ {
+ uno::Reference< lang::XComponent > xComp( mxWidget, uno::UNO_QUERY );
+ if ( xComp.is() )
+ // some widgets, like our containers, don't implement this interface...
+ xComp->dispose();
+ }
+ }
+
+ uno::Reference< awt::XLayoutConstrains > impl()
+ {
+ return mxWidget;
+ }
+
+ // LayoutWidget
+ virtual bool addChild( LayoutWidget *pChild )
+ {
+ return addChild( static_cast< Widget * >( pChild ) );
+ }
+
+ virtual void setProperties( const PropList &rProps )
+ {
+// maOriProps = rProps;
+ LayoutWidget::setProperties( rProps );
+ }
+
+ virtual void setChildProperties( LayoutWidget *pChild, const PropList &rProps )
+ {
+ maOriChildProps = rProps;
+ LayoutWidget::setChildProperties( pChild, rProps );
+ }
+
+ // tree travel
+ Widget *up()
+ {
+ return mpParent;
+ }
+
+ Widget *down()
+ {
+ if ( maChildren.empty() )
+ return NULL;
+ return maChildren.front();
+ }
+
+ Widget *next()
+ {
+ if ( mpParent )
+ {
+ int pos = mpParent->getChildPos( this );
+ return mpParent->getChild( pos+1 );
+ }
+ return NULL;
+ }
+
+ Widget *prev()
+ {
+ if ( mpParent )
+ {
+ int pos = mpParent->getChildPos( this );
+ return mpParent->getChild( pos-1 );
+ }
+ return NULL;
+ }
+
+ // handle
+ bool addChild( Widget *pChild, int pos = 0xffff )
+ {
+ if ( !mxContainer.is() )
+ return false;
+
+ uno::Sequence< uno::Reference < awt::XLayoutConstrains > > aChildren;
+ aChildren = mxContainer->getChildren();
+ int nChildrenLen = aChildren.getLength();
+
+ // ugly, but let's check if the container is next to full...
+ try {
+ mxContainer->addChild( pChild->mxWidget );
+ }
+ catch( awt::MaxChildrenException ex ) {
+ return false;
+ }
+
+ if ( pos < nChildrenLen )
+ { // if its on the middle, we need to make space for it
+ mxContainer->removeChild( pChild->mxWidget );
+ for ( int i = pos; i < nChildrenLen; i++ )
+ mxContainer->removeChild( aChildren[ i ] );
+ mxContainer->addChild( pChild->mxWidget );
+ for ( int i = pos; i < nChildrenLen; i++ )
+ mxContainer->addChild( aChildren[ i ] );
+ maChildren.insert( maChildren.begin()+pos, pChild );
+ }
+ else
+ maChildren.push_back( pChild );
+
+ OSL_ASSERT( pChild->mpParent == NULL );
+ pChild->mpParent = this;
+
+ // store container props
+ {
+ pChild->maOriChildProps.clear();
+ PropertyIterator it( pChild, CONTAINER_PROPERTY );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ rtl::OUString name( prop.Name );
+ try {
+ rtl::OUString value( pChild->getProperty( name, CONTAINER_PROPERTY ) );
+ std::pair< rtl::OUString, rtl::OUString > pair( name, value );
+ pChild->maOriChildProps.push_back( pair );
+ } catch ( beans::UnknownPropertyException &rEx ) {
+ fprintf (stderr, "ERROR: widget reports that it has a property it cannot return: '%s' this normally means that someone screwed up their PROPERTY_SET_INFO macro usage.\n",
+ rtl::OUStringToOString (rEx.Message, RTL_TEXTENCODING_UTF8).getStr());
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool removeChild( Widget *pChild )
+ {
+ if ( !mxContainer.is() || pChild->mpParent != this )
+ return false;
+
+ mxContainer->removeChild( pChild->mxWidget );
+
+ unsigned int pos = getChildPos( pChild );
+ if ( pos < maChildren.size() )
+ maChildren.erase( maChildren.begin()+pos );
+ pChild->mpParent = NULL;
+
+ return true;
+ }
+
+ bool swapWithChild( Widget *pChild )
+ {
+ if ( !pChild->isContainer() )
+ return false;
+
+ // remove all child's childrens, and try to add them here
+ removeChild( pChild );
+
+ // keep a copy for failure
+ std::vector< Widget *> aChildren = maChildren;
+ std::vector< Widget *> aChildChildren = pChild->maChildren;
+
+ for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin();
+ it != aChildChildren.end(); it++ )
+ pChild->removeChild( *it );
+
+ for ( std::vector< Widget *>::const_iterator it = aChildChildren.begin();
+ it != aChildChildren.end(); it++ )
+ if ( !addChild( *it ) )
+ { // failure
+ for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin();
+ jt != it; jt++ )
+ removeChild( *jt );
+ for ( std::vector< Widget *>::const_iterator jt = aChildChildren.begin();
+ jt != aChildChildren.end(); jt++ )
+ pChild->addChild( *jt );
+ return false;
+ }
+
+ Widget *pParent = up();
+
+ if ( pParent )
+ {
+ pParent->removeChild( this );
+ pParent->addChild( pChild );
+ }
+ pChild->addChild( this );
+ return true;
+ }
+
+ unsigned int getChildPos( Widget *pChild )
+ {
+ int i = 0;
+ for ( std::vector< Widget *>::const_iterator it = maChildren.begin();
+ it != maChildren.end(); it++, i++ )
+ if ( *it == pChild )
+ break;
+ return i;
+ }
+
+ Widget *getChild( int pos )
+ {
+ if ( pos >= 0 && pos < (signed) maChildren.size() )
+ return *(maChildren.begin() + pos);
+ return NULL;
+ }
+
+ bool isContainer()
+ { return mxContainer.is(); }
+ unsigned int getChildrenLen()
+ { return maChildren.size(); }
+
+ rtl::OUString getLabel() const
+ { return mrLabel; }
+ rtl::OUString getUnoName() const
+ { return mrUnoName; }
+
+ int getDepth()
+ {
+ int depth = 0;
+ for ( Widget *pWidget = mpParent; pWidget; pWidget = pWidget->mpParent )
+ depth++;
+ return depth;
+ }
+
+ enum PropertyKind {
+ WINDOW_PROPERTY, CONTAINER_PROPERTY, WINBITS_PROPERTY
+ };
+
+ static rtl::OUString findProperty( const PropList &props, rtl::OUString propName )
+ {
+ for ( PropList::const_iterator it = props.begin(); it != props.end(); it++ )
+ if ( it->first.equalsIgnoreAsciiCase( propName ) )
+ return it->second;
+#if DEBUG_PRINT
+ fprintf(stderr, "Serious error: property '%s' not found\n", OUSTRING_CSTR(propName));
+#endif
+ return rtl::OUString();
+ }
+
+ rtl::OUString getOriginalProperty( rtl::OUString rPropName, PropertyKind rKind )
+ {
+ rtl::OUString rValue;
+ switch ( rKind ) {
+ case WINDOW_PROPERTY:
+ rValue = findProperty( maOriProps, rPropName );
+ break;
+ case CONTAINER_PROPERTY:
+ rValue = findProperty( maOriChildProps, rPropName );
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+
+ return rValue;
+ }
+
+ rtl::OUString getProperty( rtl::OUString rPropName, PropertyKind rKind )
+ {
+ rtl::OUString rValue;
+ switch ( rKind ) {
+ case WINDOW_PROPERTY:
+ rValue = anyToString( layoutimpl::prophlp::getProperty( mxWidget, rPropName ) );
+ break;
+ case CONTAINER_PROPERTY:
+ if ( mpParent )
+ rValue = anyToString( layoutimpl::prophlp::getProperty(
+ mpParent->mxContainer->getChildProperties( mxWidget ), rPropName ) );
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+
+ return rValue;
+ }
+
+ bool isPropertyTouched( rtl::OUString propName, PropertyKind rKind )
+ {
+ rtl::OUString oriValue = getOriginalProperty( propName, rKind );
+ rtl::OUString newValue = getProperty( propName, rKind );
+ bool isTouched = oriValue != newValue;
+#if DEBUG_PRINT
+ fprintf(stderr, "is property '%s' touched? %s (%s vs %s)\n", OUSTRING_CSTR(propName), isTouched ? "yes" : "no", OUSTRING_CSTR(oriValue), OUSTRING_CSTR(newValue));
+#endif
+ return isTouched;
+ }
+
+ using LayoutWidget::setProperty;
+
+ void setProperty( rtl::OUString rPropName, PropertyKind rKind, uno::Any rValue )
+ {
+ switch ( rKind ) {
+ case WINDOW_PROPERTY:
+ layoutimpl::prophlp::setProperty( mxWidget, rPropName, rValue );
+ break;
+ case CONTAINER_PROPERTY:
+ if ( mpParent )
+ layoutimpl::prophlp::setProperty(
+ mpParent->mxContainer->getChildProperties( mxWidget ), rPropName, rValue );
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+ }
+
+ struct PropertyIterator {
+ friend class Widget;
+ PropertyKind mrKind;
+ uno::Sequence< beans::Property > maProps;
+ int nPropIt;
+
+ PropertyIterator( Widget *pWidget, PropertyKind rKind )
+ : mrKind( rKind ), nPropIt( 0 )
+ {
+ switch ( rKind )
+ {
+ case WINDOW_PROPERTY:
+ if ( layoutimpl::prophlp::canHandleProps( pWidget->mxWidget ) )
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo
+ = layoutimpl::prophlp::queryPropertyInfo( pWidget->mxWidget );
+ if ( !xInfo.is() )
+ return;
+
+ maProps = xInfo->getProperties();
+ }
+ break;
+ case CONTAINER_PROPERTY:
+ if ( pWidget->mpParent )
+ {
+ uno::Reference< beans::XPropertySet >xParentSet(
+ pWidget->mpParent->mxContainer->getChildProperties( pWidget->mxWidget ) );
+ if ( xParentSet.is())
+ {
+ uno::Reference< beans::XPropertySetInfo > xInfo( xParentSet->getPropertySetInfo() );
+ if ( xInfo.is() )
+ maProps = xInfo->getProperties();
+ }
+ }
+ break;
+ case WINBITS_PROPERTY:
+ // TODO
+ break;
+ }
+ }
+
+ bool hasNext()
+ {
+ return nPropIt < maProps.getLength();
+ }
+
+ beans::Property next()
+ {
+/* rtl::OUString propName, propValue;
+ propName = maProps[ nPropIt ];
+ propValue = getProperty( propName, mrKind, false);
+ nPropIt++;
+ return std::pair< rtl::OUString, rtl::OUString > propPair( propName, propValue );*/
+ return maProps[ nPropIt++ ];
+ }
+ };
+};
+
+class EditorRoot : public layoutimpl::LayoutRoot {
+ Widget *mpParent;
+
+public:
+ EditorRoot( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ Widget *pParent )
+ : layoutimpl::LayoutRoot( xFactory ), mpParent( pParent )
+ {
+ }
+
+ // generation
+ virtual layoutimpl::LayoutWidget *create( rtl::OUString id, const rtl::OUString unoName,
+ long attrbs, uno::Reference< awt::XLayoutContainer > xParent )
+ {
+ if ( unoName.compareToAscii( "dialog" ) == 0 )
+ return mpParent;
+
+ // TODO: go through specs to map unoName to a more human-readable label
+ Widget *pWidget = new Widget( id, mxToolkit, xParent, unoName, attrbs );
+ if ( !mxWindow.is() )
+ mxWindow = uno::Reference< awt::XWindow >( pWidget->getPeer(), uno::UNO_QUERY );
+
+ if ( pWidget->mxContainer.is() )
+ pWidget->mxContainer->setLayoutUnit( mpParent->mxContainer->getLayoutUnit() );
+
+ return pWidget;
+ }
+};
+
+/* Working with the layout in 1D, as if it was a flat list. */
+namespace FlatLayout
+{
+Widget *next( Widget *pWidget )
+{
+ Widget *pNext;
+ pNext = pWidget->down();
+ if ( pNext ) return pNext;
+ pNext = pWidget->next();
+ if ( pNext ) return pNext;
+ for ( Widget *pUp = pWidget->up(); pUp != NULL; pUp = pUp->up() )
+ if ( (pNext = pUp->next()) != NULL )
+ return pNext;
+ return NULL;
+}
+
+/*
+ Widget *prev( Widget *pWidget )
+ {
+ Widget *pPrev;
+ pPrev = pWidget->prev();
+ if ( !pPrev )
+ return pWidget->up();
+
+ Widget *pBottom = pPrev->down();
+ if ( pBottom )
+ {
+ while ( pBottom->down() || pBottom->next() )
+ {
+ for ( Widget *pNext = pBottom->next(); pNext; pNext = pNext->next() )
+ pBottom = pNext;
+ Widget *pDown = pBottom->down();
+ if ( pDown )
+ pBottom = pDown;
+ }
+ return pBottom;
+ }
+ return pPrev;
+ }
+*/
+
+bool moveWidget( Widget *pWidget, bool up /*or down*/ )
+{
+ // Keep child parent&pos for in case of failure
+ Widget *pOriContainer = pWidget->up();
+ unsigned int oriChildPos = pOriContainer->getChildPos( pWidget );
+
+ // Get parent&sibling before removing it, since relations get cut
+ Widget *pSibling = up ? pWidget->prev() : pWidget->next();
+ Widget *pContainer = pWidget->up();
+ if ( !pContainer )
+ return false;
+
+ // try to swap with parent or child
+ // We need to allow for this at least for the root node...
+ if ( !pSibling )
+ {
+ if ( up )
+ {
+ if ( pContainer->swapWithChild( pWidget ) )
+ return true;
+ }
+ else
+ {
+// TODO: this is a nice feature, but we probably want to do it explicitely...
+#if 0
+ if ( pWidget->down() && pWidget->swapWithChild( pWidget->down() ) )
+ return true;
+#endif
+ }
+ }
+
+ pContainer->removeChild( pWidget );
+
+ // if has up sibling -- append to it, else swap with it
+ if ( pSibling )
+ {
+ if ( pSibling->addChild( pWidget, up ? 0xffff : 0 ) )
+ return true;
+
+ unsigned int childPos = pContainer->getChildPos( pSibling );
+ if ( pContainer->addChild( pWidget, childPos + (up ? 0 : 1) ) )
+ return true; // should always be succesful
+ }
+ // go through parents -- try to get prepended to them
+ else
+ {
+ for ( ; pContainer && pContainer->up(); pContainer = pContainer->up() )
+ {
+ unsigned int childPos = pContainer->up()->getChildPos( pContainer );
+ if ( pContainer->up()->addChild( pWidget, childPos + (up ? 0 : 1) ) )
+ return true;
+ }
+ }
+
+ // failed -- try to get it to its old position
+ if ( !pOriContainer->addChild( pWidget, oriChildPos ) )
+ {
+ // a parent should never reject a child back. but if it ever
+ // happens, just kill it, we don't run an orphanate here ;P
+ delete pWidget;
+ return true;
+ }
+ return false;
+}
+
+// NOTE: root is considered to be number -1
+Widget *get( Widget *pRoot, int nb )
+{
+ Widget *it;
+ for ( it = pRoot; it != NULL && nb >= 0; it = next( it ) )
+ nb--;
+ return it;
+}
+
+int get( Widget *pRoot, Widget *pWidget )
+{
+ int nRet = -1;
+ Widget *it;
+ for ( it = pRoot; it != NULL && it != pWidget; it = next( it ) )
+ nRet++;
+ return nRet;
+}
+}
+
+//** PropertiesList widget
+
+class PropertiesList : public layout::Table
+{
+ class PropertyEntry
+ {
+ friend class PropertiesList;
+
+ /* wrapper between the widget and Any */
+ struct AnyWidget
+ {
+ DECL_LINK( ApplyPropertyHdl, layout::Window* );
+ DECL_LINK( FlagToggledHdl, layout::CheckBox* );
+
+ AnyWidget( Widget *pWidget, rtl::OUString aPropName, Widget::PropertyKind aPropKind )
+ : mpWidget( pWidget ), maPropName( aPropName ), maPropKind( aPropKind )
+ {
+ mpFlag = 0;
+ mbBlockFlagCallback = false;
+ bFirstGet = true;
+ }
+
+ virtual ~AnyWidget()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "~AnyWidget\n");
+#endif
+ }
+
+ void save( uno::Any aValue )
+ {
+ mpWidget->setProperty( maPropName, maPropKind, aValue );
+ checkProperty();
+ }
+
+ void checkProperty()
+ {
+ bool flag = mpWidget->isPropertyTouched( maPropName, maPropKind );
+
+ if ( mpFlag && mpFlag->IsChecked() != (BOOL)flag )
+ {
+ CheckFlag( flag, true );
+ }
+ }
+
+ void CheckFlag( bool bValue, bool bBlockCallback )
+ {
+ if ( bBlockCallback )
+ mbBlockFlagCallback = true;
+ mpFlag->Check( bValue );
+ mbBlockFlagCallback = false;
+ }
+
+ bool bFirstGet; // HACK
+ rtl::OUString getValue()
+ {
+// return mpWidget->getOriProperty( maPropName );
+ rtl::OUString value;
+ if ( bFirstGet ) // king of ugliness
+ value = mpWidget->getProperty( maPropName, maPropKind );
+ else
+ value = mpWidget->getOriginalProperty( maPropName, maPropKind );
+ bFirstGet = false;
+ return value;
+ }
+
+ // FIXME: wrapper should have a base class for this...
+ virtual layout::Window *getWindow() = 0;
+ virtual layout::Container *getContainer() { return NULL; }
+
+ virtual void load() = 0;
+ virtual void store() = 0;
+
+ Widget *mpWidget;
+ rtl::OUString maPropName;
+ Widget::PropertyKind maPropKind;
+ layout::CheckBox *mpFlag;
+ bool mbBlockFlagCallback;
+ };
+
+ struct AnyEdit : public AnyWidget, layout::HBox
+ {
+ layout::Edit *mpEdit;
+ bool mbMultiLine;
+ layout::PushButton *mpExpand;
+ DECL_LINK( ExpandEditHdl, layout::PushButton* );
+
+ // so we can create widgets (like transforming the Edit into a
+ // MultiLineEdit)
+ layout::Window *mpWinParent;
+
+ AnyEdit( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, layout::Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::HBox( 0, false ), mpWinParent( pWinParent )
+ {
+ mpEdit = NULL;
+ mpExpand = new layout::PushButton( pWinParent, WB_TOGGLE );
+ mpExpand->SetToggleHdl( LINK( this, AnyEdit, ExpandEditHdl ) );
+ setAsMultiLine( false );
+
+ load();
+ }
+
+ virtual ~AnyEdit()
+ {
+ delete mpEdit;
+ delete mpExpand;
+ }
+
+ virtual layout::Window *getWindow()
+ { return NULL; }
+ virtual layout::Container *getContainer()
+ { return this; }
+
+ void setAsMultiLine( bool bMultiLine )
+ {
+ Clear();
+ XubString text;
+ if ( mpEdit )
+ {
+ text = mpEdit->GetText();
+ printf("Remove mpEdit and expand\n");
+ Remove( mpEdit );
+ Remove( mpExpand );
+ delete mpEdit;
+ }
+
+ if ( bMultiLine )
+ {
+ mpEdit = new layout::Edit( mpWinParent, WB_BORDER );
+ mpExpand->SetText( String::CreateFromAscii( "-" ) );
+ }
+ else
+ {
+ mpEdit = new layout::Edit( mpWinParent, WB_BORDER );
+ mpExpand->SetText( String::CreateFromAscii( "+" ) );
+ }
+
+ mpEdit->SetText( text );
+ mpEdit->SetModifyHdl( LINK( this, AnyEdit, ApplyPropertyHdl ) );
+
+ Add( mpEdit, true, true, 0 );
+ Add( mpExpand, false, true, 0 );
+
+ mbMultiLine = bMultiLine;
+ }
+
+#if 0
+ // TODO: make this global... We'll likely need it for export...
+ struct Translate {
+ const char *ori, *dest;
+ };
+ static rtl::OUString stringReplace( rtl::OUString _str,
+ Translate *trans )
+ {
+ const sal_Unicode *str = _str.getStr();
+ rtl::OUStringBuffer buf;
+ int i, j, k;
+ for ( i = 0; i < _str.getLength(); i++ )
+ {
+ for ( j = 0; trans[ j ].ori; j++ )
+ {
+ const char *ori = trans[ j ].ori;
+ for ( k = 0; ori[ k ] && i+k < _str.getLength(); k++ )
+ if ( ori[ k ] != str[ i+k ] )
+ break;
+ if ( !ori[ k ] )
+ {
+ // found substring
+ buf.appendAscii( trans[ j ].dest );
+ i += k;
+ continue;
+ }
+ }
+ buf.append( str[ i ] );
+ }
+ return buf.makeStringAndClear();
+ }
+#endif
+
+ virtual void load()
+ {
+#if 0
+ // replace end of lines by "\\n" strings
+ Translate trans[] = {
+ { "\\", "\\\\" }, { "\n", "\\n" }, { 0, 0 }
+ };
+ rtl::OUString str = anyToString( getValue() );
+ str = stringReplace( str, trans );
+ SetText( str );
+#endif
+ mpEdit->SetText( getValue() );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+#if 0
+ // replace "\\n" strings by actual end of lines
+ Translate trans[] = {
+ { "\\\\", "\\" }, { "\\n", "\n" },
+ { "\\", "" }, { 0, 0 }
+ };
+ rtl::OUString str = GetText();
+ str = stringReplace( str, trans );
+ save( uno::makeAny( str ) );
+#endif
+ save( uno::makeAny( (rtl::OUString) mpEdit->GetText() ) );
+ }
+ };
+
+ struct AnyInteger : public AnyWidget, NumericField
+ {
+ AnyInteger( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), NumericField( pWinParent, WB_SPIN|WB_BORDER )
+ {
+ load();
+ SetModifyHdl( LINK( this, AnyInteger, ApplyPropertyHdl ) );
+ }
+
+ virtual Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+ OUString text = getValue();
+ SetText( text.getStr() );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "store number: %ld\n", rtl::OUString( GetText() ).toInt64());
+#endif
+ save( uno::makeAny( rtl::OUString( GetText() ).toInt64() ) );
+ }
+ };
+
+ struct AnyFloat : public AnyInteger
+ {
+ AnyFloat( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyInteger( pWidget, aPropName, aPropKind, pWinParent )
+ {}
+
+ virtual void store()
+ {
+ save( uno::makeAny( rtl::OUString( GetText() ).toDouble() ) );
+ }
+ };
+
+ struct AnyCheckBox : public AnyWidget, layout::CheckBox
+ {
+ AnyCheckBox( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, layout::Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::CheckBox( pWinParent )
+ {
+ // adding some whitespaces to make the hit area larger
+// SetText( String::CreateFromAscii( "" ) );
+ load();
+ SetToggleHdl( LINK( this, AnyWidget, ApplyPropertyHdl ) );
+ }
+
+ virtual ~AnyCheckBox()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "~AnyCheckBox\n");
+#endif
+ }
+
+ virtual layout::Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "loading boolean value\n");
+#endif
+ Check( getValue().toInt64() != 0 );
+ setLabel();
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+ save( uno::makeAny( IsChecked() ) );
+ setLabel();
+ }
+
+ void setLabel()
+ {
+ SetText( String::CreateFromAscii( IsChecked() ? "true" : "false" ) );
+ }
+ };
+
+ struct AnyListBox : public AnyWidget, layout::ListBox
+ {
+ AnyListBox( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::ListBox( pWinParent, WB_DROPDOWN )
+ {
+ SetSelectHdl( LINK( this, AnyWidget, ApplyPropertyHdl ) );
+ }
+
+ virtual layout::Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+ SelectEntryPos( sal::static_int_cast< USHORT >( getValue().toInt32() ) );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+ save( uno::makeAny( (short) GetSelectEntryPos() ) );
+ }
+ };
+
+ struct AnyAlign : public AnyListBox
+ {
+ AnyAlign( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyListBox( pWidget, aPropName, aPropKind, pWinParent )
+ {
+ InsertEntry( XubString::CreateFromAscii( "Left" ) );
+ InsertEntry( XubString::CreateFromAscii( "Center" ) );
+ InsertEntry( XubString::CreateFromAscii( "Right" ) );
+ load();
+ }
+ };
+
+ /* AnyListBox and AnyComboBox different in that a ComboBox allows the user
+ to add other options, operating in strings, instead of constants.
+ (its more like a suggestive AnyEdit) */
+ struct AnyComboBox : public AnyWidget, layout::ComboBox
+ {
+ AnyComboBox( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyWidget( pWidget, aPropName, aPropKind ), layout::ComboBox( pWinParent, WB_DROPDOWN )
+ {
+ SetModifyHdl( LINK( this, AnyComboBox, ApplyPropertyHdl ) );
+ }
+
+ virtual layout::Window *getWindow()
+ { return this; }
+
+ virtual void load()
+ {
+ SetText( getValue() );
+ checkProperty();
+ }
+
+ virtual void store()
+ {
+ save( uno::makeAny( (rtl::OUString) GetText() ) );
+ }
+ };
+
+ struct AnyFontStyle : public AnyComboBox
+ {
+ AnyFontStyle( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, Window *pWinParent )
+ : AnyComboBox( pWidget, aPropName, aPropKind, pWinParent )
+ {
+ InsertEntry( XubString::CreateFromAscii( "Bold" ) );
+ InsertEntry( XubString::CreateFromAscii( "Italic" ) );
+ InsertEntry( XubString::CreateFromAscii( "Bold Italic" ) );
+ InsertEntry( XubString::CreateFromAscii( "Fett" ) );
+ load();
+ }
+ };
+
+ layout::FixedText *mpLabel;
+ layout::CheckBox *mpFlag;
+ AnyWidget *mpValue;
+
+ public:
+ PropertyEntry( layout::Window *pWinParent, AnyWidget *pAnyWidget )
+ {
+ mpLabel = new layout::FixedText( pWinParent );
+ {
+ // append ':' to aPropName
+ rtl::OUStringBuffer buf( pAnyWidget->maPropName );
+ buf.append( sal_Unicode (':') );
+ mpLabel->SetText( buf.makeStringAndClear() );
+ }
+ mpValue = pAnyWidget;
+ mpFlag = new layout::CheckBox( pWinParent );
+ mpFlag->SetToggleHdl( LINK( mpValue, AnyWidget, FlagToggledHdl ) );
+ mpValue->mpFlag = mpFlag;
+ }
+
+ ~PropertyEntry()
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "REMOVING label, flag and value\n");
+#endif
+ delete mpLabel;
+ delete mpFlag;
+ delete mpValue;
+ }
+
+ // Use this factory rather than the constructor -- check for NULL
+ static PropertyEntry *construct( Widget *pWidget, rtl::OUString aPropName,
+ Widget::PropertyKind aPropKind, sal_uInt16 nType,
+ layout::Window *pWinParent )
+ {
+ AnyWidget *pAnyWidget;
+ switch (nType) {
+ case uno::TypeClass_STRING:
+ if ( aPropName.compareToAscii( "FontStyleName" ) == 0 )
+ {
+ pAnyWidget = new AnyFontStyle( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ }
+ pAnyWidget = new AnyEdit( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ case uno::TypeClass_SHORT:
+ if ( aPropName.compareToAscii( "Align" ) == 0 )
+ {
+ pAnyWidget = new AnyAlign( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ }
+ // otherwise, treat as any other number...
+ case uno::TypeClass_LONG:
+ case uno::TypeClass_UNSIGNED_LONG:
+ pAnyWidget = new AnyInteger( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ case uno::TypeClass_FLOAT:
+ case uno::TypeClass_DOUBLE:
+ pAnyWidget = new AnyFloat( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ case uno::TypeClass_BOOLEAN:
+ pAnyWidget = new AnyCheckBox( pWidget, aPropName, aPropKind, pWinParent );
+ break;
+ default:
+ return NULL;
+ }
+ return new PropertyEntry( pWinParent, pAnyWidget );
+ }
+ };
+
+ layout::Window *mpParentWindow;
+
+ std::list< PropertyEntry* > maPropertiesList;
+ layout::FixedLine *mpSeparator;
+
+ // some properties are obscure, or simply don't make sense in this
+ // context. Let's just ignore them.
+ // Maybe we could offer them in an expander or something...
+ static bool toIgnore( rtl::OUString prop )
+ {
+ // binary search -- keep the list sorted alphabetically
+ static char const *toIgnoreList[] = {
+ "DefaultControl", "FocusOnClick", "FontCharWidth", "FontCharset",
+ "FontEmphasisMark", "FontFamily", "FontHeight", "FontKerning", "FontName",
+ "FontOrientation", "FontPitch", "FontRelief", "FontSlant", "FontStrikeout",
+ "FontType", "FontWordLineMode", "HelpText", "HelpURL", "MultiLine",
+ "Printable", "Repeat", "RepeatDelay", "Tabstop"
+ };
+
+#if 0
+ // checks list sanity -- enable this when you add some entries...
+ for ( unsigned int i = 1; i < sizeof( toIgnoreList )/sizeof( char * ); i++ )
+ {
+ if ( strcmp(toIgnoreList[i-1], toIgnoreList[i]) >= 0 )
+ {
+ printf("ignore list not ordered properly: "
+ "'%s' should come before '%s'\n",
+ toIgnoreList[i], toIgnoreList[i-1]);
+ exit(-1);
+ }
+ }
+#endif
+
+ int min = 0, max = sizeof( toIgnoreList )/sizeof( char * ) - 1, mid, cmp;
+ do {
+ mid = min + (max - min)/2;
+ cmp = prop.compareToAscii( toIgnoreList[ mid ] );
+ if ( cmp > 0 )
+ min = mid+1;
+ else if ( cmp < 0 )
+ max = mid-1;
+ else
+ return true;
+ } while ( min <= max );
+ return false;
+ }
+
+public:
+ PropertiesList( layout::Dialog *dialog )
+ : layout::Table( dialog, "properties-box" )
+ , mpParentWindow( dialog ), mpSeparator( 0 )
+ {
+ }
+
+ ~PropertiesList()
+ {
+ clear();
+ }
+
+private:
+ // auxiliary, add properties from the peer to the list
+ void addProperties( Widget *pWidget, Widget::PropertyKind rKind )
+ {
+ Widget::PropertyIterator it( pWidget, rKind );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ rtl::OUString name( prop.Name );
+ if ( toIgnore( name ) )
+ continue;
+ sal_uInt16 type = static_cast< sal_uInt16 >( prop.Type.getTypeClass() );
+
+ PropertyEntry *propEntry = PropertyEntry::construct(
+ pWidget, name, rKind, type, mpParentWindow );
+
+ if ( propEntry )
+ {
+ Add( propEntry->mpLabel, false, false );
+
+ // HACK: one of these will return Null...
+ Add( propEntry->mpValue->getWindow(), true, false );
+ Add( propEntry->mpValue->getContainer(), true, false );
+
+ Add( propEntry->mpFlag, false, false );
+ maPropertiesList.push_back( propEntry );
+ }
+ }
+ }
+
+public:
+ void selectedWidget( Widget *pWidget )
+ {
+ clear();
+
+ if ( !pWidget )
+ return;
+
+ addProperties( pWidget, Widget::CONTAINER_PROPERTY );
+
+ mpSeparator = new layout::FixedLine( mpParentWindow );
+ // TODO: we may want to have to separate list widgets here...
+ Add( mpSeparator, false, false, 3, 1 );
+
+ addProperties( pWidget, Widget::WINDOW_PROPERTY );
+
+ ShowAll( true );
+ }
+
+ void clear()
+ {
+ ///FIXME: crash
+ Container::Clear();
+
+ for ( std::list< PropertyEntry* >::iterator it = maPropertiesList.begin();
+ it != maPropertiesList.end(); it++)
+ delete *it;
+ maPropertiesList.clear();
+
+ delete mpSeparator;
+ mpSeparator = NULL;
+ }
+};
+
+IMPL_LINK( PropertiesList::PropertyEntry::AnyWidget, ApplyPropertyHdl, layout::Window *, pWin )
+{
+ (void) pWin;
+ store();
+ return 0;
+}
+
+IMPL_LINK( PropertiesList::PropertyEntry::AnyWidget, FlagToggledHdl, layout::CheckBox *, pCheck )
+{
+#if DEBUG_PRINT
+ fprintf(stderr, "Property flag pressed -- is: %d\n", pCheck->IsChecked());
+#endif
+ if ( !mbBlockFlagCallback )
+ {
+ bool checked = pCheck->IsChecked();
+ if ( !checked ) // revert
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "revert\n");
+#endif
+ load();
+ }
+ else
+ {
+#if DEBUG_PRINT
+ fprintf(stderr, "user can't dirty the flag!\n");
+#endif
+ // User can't flag the property as dirty
+ // Actually, we may want to allow the designer to force a property to be stored.
+ // Could be useful when the default value of some new property wasn't yet decided...
+ CheckFlag( false, true );
+ }
+ }
+#if DEBUG_PRINT
+ else
+ fprintf(stderr, "Property flag pressed -- BLOCKED\n");
+#endif
+ return 0;
+}
+
+IMPL_LINK( PropertiesList::PropertyEntry::AnyEdit, ExpandEditHdl, layout::PushButton *, pBtn )
+{
+ setAsMultiLine( pBtn->IsChecked() );
+ return 0;
+}
+
+//** SortListBox auxiliary widget
+
+class SortListBox
+{ // For a manual sort ListBox; asks for a ListBox and Up/Down/Remove
+ // buttons to wrap
+ DECL_LINK( ItemSelectedHdl, layout::ListBox* );
+ DECL_LINK( UpPressedHdl, layout::Button* );
+ DECL_LINK( DownPressedHdl, layout::Button* );
+ DECL_LINK( RemovePressedHdl, layout::Button* );
+ layout::PushButton *mpUpButton, *mpDownButton, *mpRemoveButton;
+
+protected:
+ layout::ListBox *mpListBox;
+
+ virtual void upPressed( USHORT nPos )
+ {
+ XubString str = mpListBox->GetSelectEntry();
+ mpListBox->RemoveEntry( nPos );
+ nPos = mpListBox->InsertEntry( str, nPos-1 );
+ mpListBox->SelectEntryPos( nPos );
+ }
+
+ virtual void downPressed( USHORT nPos )
+ {
+ XubString str = mpListBox->GetSelectEntry();
+ mpListBox->RemoveEntry( nPos );
+ nPos = mpListBox->InsertEntry( str, nPos+1 );
+ mpListBox->SelectEntryPos( nPos );
+ }
+
+ virtual void removePressed( USHORT nPos )
+ {
+ mpListBox->RemoveEntry( nPos );
+ }
+
+ virtual void itemSelected( USHORT nPos )
+ {
+ // if we had some XLayoutContainer::canAdd() or maxChildren() function
+ // we could make a function to check if we can move selected and enable/
+ // /disable the move buttons as appropriate
+
+ if ( nPos == LISTBOX_ENTRY_NOTFOUND )
+ {
+ mpUpButton->Disable();
+ mpDownButton->Disable();
+ mpRemoveButton->Disable();
+ }
+ else
+ {
+ mpUpButton->Enable();
+ mpDownButton->Enable();
+ mpRemoveButton->Enable();
+ }
+ }
+
+public:
+ SortListBox( layout::ListBox *pListBox, layout::PushButton *pUpButton, layout::PushButton *pDownButton,
+ layout::PushButton *pRemoveButton )
+ : mpUpButton( pUpButton), mpDownButton( pDownButton), mpRemoveButton( pRemoveButton ),
+ mpListBox( pListBox )
+ {
+ mpListBox->SetSelectHdl( LINK( this, SortListBox, ItemSelectedHdl ) );
+
+ mpUpButton->SetModeImage( layout::Image ( "res/commandimagelist/lc_moveup.png" ) );
+ mpUpButton->SetImageAlign( IMAGEALIGN_LEFT );
+ mpUpButton->SetClickHdl( LINK( this, SortListBox, UpPressedHdl ) );
+
+ mpDownButton->SetModeImage( layout::Image ( "res/commandimagelist/lc_movedown.png" ) );
+ mpDownButton->SetImageAlign( IMAGEALIGN_LEFT );
+ mpDownButton->SetClickHdl( LINK( this, SortListBox, DownPressedHdl ) );
+
+ // "res/commandimagelist/lch_delete.png", "res/commandimagelist/lc_delete.png"
+ mpRemoveButton->SetModeImage( layout::Image ( "res/commandimagelist/sc_closedoc.png" ) );
+ mpRemoveButton->SetImageAlign( IMAGEALIGN_LEFT );
+ mpRemoveButton->SetClickHdl( LINK( this, SortListBox, RemovePressedHdl ) );
+
+ // fire an un-select event
+ itemSelected( LISTBOX_ENTRY_NOTFOUND );
+ }
+
+ virtual ~SortListBox();
+};
+
+SortListBox::~SortListBox()
+{
+ delete mpListBox;
+ delete mpUpButton;
+ delete mpDownButton;
+ delete mpRemoveButton;
+}
+
+IMPL_LINK( SortListBox, UpPressedHdl, layout::Button *, pBtn )
+{
+ (void) pBtn;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ if ( pos > 0 && pos != LISTBOX_ENTRY_NOTFOUND )
+ upPressed( pos );
+ return 0;
+}
+
+IMPL_LINK( SortListBox, DownPressedHdl, layout::Button *, pBtn )
+{
+ (void) pBtn;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ if ( pos < mpListBox->GetEntryCount() && pos != LISTBOX_ENTRY_NOTFOUND )
+ downPressed( pos );
+ return 0;
+}
+
+IMPL_LINK( SortListBox, RemovePressedHdl, layout::Button *, pBtn )
+{
+ (void) pBtn;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ if ( pos != LISTBOX_ENTRY_NOTFOUND )
+ removePressed( pos );
+ return 0;
+}
+
+IMPL_LINK( SortListBox, ItemSelectedHdl, layout::ListBox *, pList )
+{
+ (void) pList;
+ USHORT pos = mpListBox->GetSelectEntryPos();
+ itemSelected( pos );
+ return 0;
+}
+
+//** LayoutTree widget
+
+class LayoutTree : public SortListBox
+{
+public:
+ struct Listener
+ {
+ virtual void widgetSelected( Widget *pWidget ) = 0;
+ };
+
+private:
+ Listener *mpListener;
+
+public:
+ Widget *mpRootWidget;
+
+ LayoutTree( layout::Dialog *dialog )
+ : SortListBox( new layout::ListBox( dialog, "layout-tree" ),
+ new layout::PushButton( dialog, "layout-up-button" ),
+ new layout::PushButton( dialog, "layout-down-button" ),
+ new layout::PushButton( dialog, "layout-remove-button" ) )
+ {
+ layout::PeerHandle handle = dialog->GetPeerHandle( "preview-box" );
+ uno::Reference< awt::XLayoutConstrains > xWidget( handle, uno::UNO_QUERY );
+ mpRootWidget = new Widget( xWidget, "root" );
+ }
+
+ virtual ~LayoutTree();
+
+ Widget *getWidget( int nPos )
+ {
+ if ( nPos != LISTBOX_ENTRY_NOTFOUND )
+ return FlatLayout::get( mpRootWidget, nPos );
+ return NULL;
+ }
+
+ Widget *getSelectedWidget()
+ {
+ Widget *pWidget = getWidget( mpListBox->GetSelectEntryPos() );
+ if ( !pWidget ) // return root, if none selected
+ pWidget = mpRootWidget;
+ return pWidget;
+ }
+
+ void selectWidget( Widget *pWidget )
+ {
+ int pos = FlatLayout::get( mpRootWidget, pWidget );
+ if ( pos == -1 )
+ // if asked to select hidden root, select visible root
+ pos = 0;
+ mpListBox->SelectEntryPos( sal::static_int_cast< USHORT >( pos ) );
+ }
+
+ void rebuild()
+ {
+ struct inner
+ {
+ // pads a string with whitespaces
+ static rtl::OUString padString( rtl::OUString name, int depth )
+ {
+ rtl::OStringBuffer aBuf( depth * 4 + name.getLength() + 2 );
+ for (int i = 0; i < depth; i++)
+ aBuf.append( " " );
+ aBuf.append( rtl::OUStringToOString( name, RTL_TEXTENCODING_ASCII_US ) );
+ return rtl::OUString( aBuf.getStr(), aBuf.getLength(),
+ RTL_TEXTENCODING_UTF8 );
+ }
+ };
+
+ mpListBox->Clear();
+ for ( Widget *i = FlatLayout::next( mpRootWidget ); i; i = FlatLayout::next( i ) )
+ mpListBox->InsertEntry( inner::padString( i->getLabel(), i->getDepth()-1 ) );
+
+ // any selection, no longer is. ListBox doesn't fire the event on this case;
+ // force it.
+ itemSelected( LISTBOX_ENTRY_NOTFOUND );
+ }
+
+ void setListener( Listener *pListener )
+ { mpListener = pListener; }
+
+ // print in XML format...
+
+ static rtl::OUString toXMLNaming (const rtl::OUString &string)
+ {
+ rtl::OUStringBuffer buffer (string.getLength());
+ sal_Unicode *str = string.pData->buffer;
+ for (int i = 0; i < string.getLength(); i++) {
+ if ( str[i] >= 'A' && str[i] <= 'Z' )
+ {
+ if ( i > 0 )
+ buffer.append ((sal_Unicode) '-');
+ buffer.append ((sal_Unicode) (str[i] - 'A' + 'a'));
+ }
+ else
+ buffer.append ((sal_Unicode) str[i]);
+ }
+
+ return buffer.makeStringAndClear();
+ }
+
+ void print()
+ {
+ printf("\t\tExport:\n");
+ printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<dialog xmlns=\"http://openoffice.org/2007/layout\"\n"
+ " xmlns:cnt=\"http://openoffice.org/2007/layout/container\"\n"
+ " id=\"dialog\" title=\"Unnamed\" sizeable=\"true\" >\n");
+
+ for ( Widget *i = FlatLayout::next( mpRootWidget ); i; i = FlatLayout::next( i ) )
+ {
+ for ( int d = i->getDepth(); d > 0; d-- )
+ printf(" ");
+ printf("<%s ", OUSTRING_CSTR( i->getUnoName() ) );
+
+ for ( int kind = 0; kind < 2; kind++ )
+ {
+ Widget::PropertyKind wKind = kind == 0 ? Widget::WINDOW_PROPERTY
+ : Widget::CONTAINER_PROPERTY;
+ Widget::PropertyIterator it( i, wKind );
+ while ( it.hasNext() )
+ {
+ beans::Property prop = it.next();
+ if ( !i->isPropertyTouched( prop.Name, wKind ) )
+ continue;
+
+ rtl::OUString value = i->getProperty( prop.Name, wKind );
+ if ( prop.Type.getTypeClass() == uno::TypeClass_BOOLEAN )
+ {
+ if ( value.compareToAscii( "0" ) )
+ value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("false") );
+ else
+ value = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("true") );
+ }
+
+ if ( value.getLength() > 0 )
+ printf("%s%s=\"%s\" ",
+ kind == 0 ? "" : "cnt:",
+ OUSTRING_CSTR( toXMLNaming( prop.Name ) ), OUSTRING_CSTR( value )
+ );
+
+ }
+ }
+ printf("/>\n");
+ }
+ printf("</dialog>\n");
+ }
+
+protected:
+ virtual void upPressed( USHORT nPos )
+ {
+ Widget *pWidget = getWidget( nPos );
+ if ( FlatLayout::moveWidget( pWidget, true ) )
+ rebuild();
+ selectWidget( pWidget );
+ }
+
+ virtual void downPressed( USHORT nPos )
+ {
+ Widget *pWidget = getWidget( nPos );
+ if ( FlatLayout::moveWidget( pWidget, false ) )
+ rebuild();
+ selectWidget( pWidget );
+ }
+
+ virtual void removePressed( USHORT nPos )
+ {
+ Widget *pWidget = getWidget( nPos );
+ if ( pWidget )
+ {
+ pWidget->up()->removeChild( pWidget );
+ delete pWidget;
+ rebuild();
+ }
+ }
+
+ virtual void itemSelected( USHORT nPos )
+ {
+ mpListener->widgetSelected( getWidget( nPos ) );
+ SortListBox::itemSelected( nPos );
+ }
+};
+
+LayoutTree::~LayoutTree()
+{
+ delete mpRootWidget;
+}
+
+//** EditorImpl
+
+class EditorImpl : public LayoutTree::Listener
+{
+ void createWidget( const char *unoName );
+
+ PropertiesList *mpPropertiesList;
+ LayoutTree *mpLayoutTree;
+
+ layout::PushButton *pImportButton, *pExportButton;
+#ifdef FILEDLG
+ FileDialog *pImportDialog;
+#endif
+ DECL_LINK( ImportButtonHdl, layout::PushButton* );
+ DECL_LINK( ExportButtonHdl, layout::PushButton* );
+#ifdef FILEDLG
+ DECL_LINK( ImportDialogHdl, FileDialog* );
+#endif
+
+ // framework stuff
+ uno::Reference< lang::XMultiServiceFactory > mxFactory;
+ uno::Reference< awt::XToolkit > mxToolkit;
+ uno::Reference< awt::XWindow > mxToplevel;
+
+ virtual void widgetSelected( Widget *pWidget );
+ DECL_LINK( CreateWidgetHdl, layout::Button* );
+
+ std::list< layout::PushButton *> maCreateButtons;
+
+public:
+
+ EditorImpl( layout::Dialog *dialog,
+ // we should probable open this channel (or whatever its called) ourselves
+ uno::Reference< lang::XMultiServiceFactory > xMSF );
+ virtual ~EditorImpl();
+
+ void loadFile( const rtl::OUString &aTestFile );
+};
+
+EditorImpl::EditorImpl( layout::Dialog *dialog,
+ uno::Reference< lang::XMultiServiceFactory > xFactory )
+ : mxFactory( xFactory )
+ , mxToplevel( dialog->GetPeerHandle( "dialog" ), uno::UNO_QUERY )
+ // FIXME: any of these should work
+ //dialog->getContext()->getRoot(), uno::UNO_QUERY )
+ // dialog->GetPeer(), uno::UNO_QUERY )
+{
+#if DEBUG_PRINT
+ fprintf (stderr, "EditorImpl()\n");
+#endif
+ // framework
+ mxToolkit = uno::Reference< awt::XToolkit >(
+ mxFactory->createInstance(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ),
+ uno::UNO_QUERY );
+ OSL_ASSERT( mxToolkit.is() );
+
+ // custom widgets
+#if DEBUG_PRINT
+ fprintf (stderr, "custom widgets\n");
+#endif
+ mpPropertiesList = new PropertiesList( dialog );
+
+ mpLayoutTree = new LayoutTree( dialog );
+ mpLayoutTree->setListener( this );
+
+/* if ( xImport.is() )
+ mpLayoutTree->getWidget( -1 )->addChild( new Widget( xImport, "import" ) );*/
+
+ // create buttons
+ layout::Container aWidgets( dialog, "create-widget" );
+ layout::Container aContainers( dialog, "create-container" );
+ for ( int i = 0; i < WIDGETS_SPECS_LEN; i++ )
+ {
+ layout::PushButton *pBtn = new layout::PushButton( (layout::Window *) dialog );
+ pBtn->SetText( rtl::OUString::createFromAscii( WIDGETS_SPECS[ i ].pLabel ) );
+ pBtn->SetClickHdl( LINK( this, EditorImpl, CreateWidgetHdl ) );
+ if ( WIDGETS_SPECS[ i ].pIconName != NULL )
+ {
+ rtl::OString aPath ("res/commandimagelist/");
+ aPath += WIDGETS_SPECS[ i ].pIconName;
+ layout::Image aImg( aPath );
+ pBtn->SetModeImage( aImg );
+ pBtn->SetImageAlign( IMAGEALIGN_LEFT );
+ }
+ pBtn->Show();
+ maCreateButtons.push_back( pBtn );
+ layout::Container *pBox = WIDGETS_SPECS[ i ].bIsContainer ? &aContainers : &aWidgets;
+ pBox->Add( pBtn );
+ }
+
+#ifdef FILEDLG
+ fprintf(stderr,"creating file dialog\n");
+ pImportDialog = new FileDialog( NULL/*(layout::Window *) dialog*/, 0 );
+ fprintf(stderr,"connecting it\n");
+ pImportDialog->SetFileSelectHdl( LINK( this, EditorImpl, ImportDialogHdl ) );
+ fprintf(stderr,"done file dialog\n");
+#endif
+
+/* pImportButton = new layout::PushButton( dialog, "import-button" );
+ pImportButton->SetClickHdl( LINK( this, EditorImpl, ImportButtonHdl ) );*/
+ pExportButton = new layout::PushButton( dialog, "export-button" );
+ pExportButton->SetClickHdl( LINK( this, EditorImpl, ExportButtonHdl ) );
+}
+
+EditorImpl::~EditorImpl()
+{
+ delete mpPropertiesList;
+ delete mpLayoutTree;
+ for ( std::list< layout::PushButton * >::const_iterator i = maCreateButtons.begin();
+ i != maCreateButtons.end(); i++)
+ delete *i;
+ delete pImportButton;
+ delete pExportButton;
+#ifdef FILEDLG
+ delete pImportDialog;
+#endif
+}
+
+void EditorImpl::loadFile( const rtl::OUString &aTestFile )
+{
+ fprintf( stderr, "TEST: layout instance\n" );
+ uno::Reference< awt::XLayoutRoot > xRoot
+ ( new EditorRoot( mxFactory, mpLayoutTree->mpRootWidget ) );
+
+/*
+ mxMSF->createInstance
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.awt.Layout" ) ),
+ uno::UNO_QUERY );
+*/
+ if ( !xRoot.is() )
+ {
+ throw uno::RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("could not create awt Layout component!") ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: initing root\n" );
+#endif
+
+ uno::Reference< lang::XInitialization > xInit( xRoot, uno::UNO_QUERY );
+ if ( !xInit.is() )
+ {
+ throw uno::RuntimeException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("Layout has no XInitialization!") ),
+ uno::Reference< uno::XInterface >() );
+ }
+
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: running parser\n" );
+#endif
+ uno::Sequence< uno::Any > aParams( 1 );
+ aParams[0] <<= aTestFile;
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: do it\n" );
+#endif
+ xInit->initialize( aParams );
+#if DEBUG_PRINT
+ fprintf( stderr, "TEST: file loaded\n" );
+#endif
+
+ mpLayoutTree->rebuild();
+}
+
+void EditorImpl::createWidget( const char *name )
+{
+ Widget *pWidget = mpLayoutTree->getSelectedWidget();
+
+ Widget *pChild = new Widget( rtl::OUString(), mxToolkit, uno::Reference< awt::XLayoutContainer >( mxToplevel, uno::UNO_QUERY ), rtl::OUString::createFromAscii( name ), awt::WindowAttribute::SHOW );
+ if ( !pWidget->addChild( pChild ) )
+ {
+ delete pChild;
+ // we may want to popup an error message
+ }
+ else
+ {
+ mpLayoutTree->rebuild();
+ mpLayoutTree->selectWidget( pWidget );
+ }
+}
+
+void EditorImpl::widgetSelected( Widget *pWidget )
+{
+ // we know can't add widget to a non-container, so let's disable the create
+ // buttons then. Would be nice to have a method to check if a container is
+ // full as well...
+ if ( !pWidget || pWidget->isContainer() )
+ {
+ for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
+ it != maCreateButtons.end(); it++)
+ (*it)->Enable();
+ }
+ else
+ {
+ for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
+ it != maCreateButtons.end(); it++)
+ (*it)->Disable();
+ }
+
+ mpPropertiesList->selectedWidget( pWidget );
+}
+
+IMPL_LINK( EditorImpl, CreateWidgetHdl, layout::Button *, pBtn )
+{
+ int i = 0;
+ for ( std::list< layout::PushButton *>::const_iterator it = maCreateButtons.begin();
+ it != maCreateButtons.end(); it++, i++ )
+ {
+ if ( pBtn == *it )
+ break;
+ }
+ OSL_ASSERT( i < WIDGETS_SPECS_LEN );
+ createWidget( WIDGETS_SPECS[i].pName );
+ return 0;
+}
+
+IMPL_LINK( EditorImpl, ImportButtonHdl, layout::PushButton *, pBtn )
+{
+ (void) pBtn;
+#if DEBUG_PRINT
+ fprintf(stderr, "IMPORT!\n");
+#endif
+#ifdef FILEDLG
+ pImportDialog->Execute();
+#endif
+
+ return 0;
+}
+
+#ifdef FILEDLG
+IMPL_LINK( EditorImpl, ImportDialogHdl, FileDialog *, pDialog )
+{
+ UniString path = pDialog->GetPath();
+//fprintf(stderr, "Executing import dialog!\n");
+
+#if DEBUG_PRINT
+ fprintf(stderr, "got import file: %s\n",rtl::OUStringToOString( path, RTL_TEXTENCODING_ASCII_US ).getStr() );
+#endif
+
+ return 0;
+}
+#endif
+
+IMPL_LINK( EditorImpl, ExportButtonHdl, layout::PushButton *, pBtn )
+{
+ (void) pBtn;
+ mpLayoutTree->print();
+ return 0;
+}
+
+//** Editor, the Dialog
+
+Editor::Editor( uno::Reference< lang::XMultiServiceFactory > xFactory,
+ rtl::OUString aFile )
+ : layout::Dialog( (Window*) (NULL), "editor.xml", "dialog" )
+ , mpImpl( new EditorImpl( this, xFactory ) )
+{
+ if ( aFile.getLength() )
+ mpImpl->loadFile( aFile );
+
+ // parent:
+ FreeResource();
+}
+
+Editor::~Editor()
+{
+ delete mpImpl;
+}
diff --git a/toolkit/workben/layout/editor.hxx b/toolkit/workben/layout/editor.hxx
new file mode 100644
index 000000000000..b955732e32c9
--- /dev/null
+++ b/toolkit/workben/layout/editor.hxx
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef EDITOR_HXX
+#define EDITOR_HXX
+
+#include <layout/layout.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+class EditorImpl;
+
+class Editor : public layout::Dialog
+{
+EditorImpl *mpImpl;
+
+public:
+ Editor( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xMSF,
+ rtl::OUString aFile );
+ ~Editor();
+
+ void loadFile( const rtl::OUString &aTestFile );
+};
+
+#endif /*EDITOR_HXX*/
diff --git a/toolkit/workben/layout/editor.xml b/toolkit/workben/layout/editor.xml
new file mode 100644
index 000000000000..4126dea8b289
--- /dev/null
+++ b/toolkit/workben/layout/editor.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Normal skin -->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Layout Editor" sizeable="true">
+ <vbox>
+ <hbox>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Layout:" cnt:expand="false" />
+ <hbox>
+ <listbox id="layout-tree" has_border="true" />
+ <vbox cnt:expand="false">
+ <pushbutton id="layout-up-button" cnt:expand="false" />
+ <pushbutton id="layout-down-button" cnt:expand="false" />
+ <fixedtext cnt:expand="true" />
+ <pushbutton id="layout-remove-button" cnt:expand="false" />
+ </vbox>
+ </hbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120">
+ <vbox>
+ <fixedtext label="Preview:" cnt:expand="false" />
+ <vbox border="50">
+ <bin id="preview-box" />
+ </vbox>
+ </vbox>
+ </min-size>
+ <min-size min-width="120" cnt:expand="false">
+ <vbox>
+ <fixedtext label="Properties:" cnt:expand="false" />
+ <table id="properties-box" columns="3" />
+ </vbox>
+ </min-size>
+ </hbox>
+ <hfixedline cnt:expand="false" />
+ <vbox cnt:expand="false">
+ <fixedtext label="Create widgets:" cnt:expand="false" />
+ <flow id="create-widget" homogeneous="true" spacing="2" />
+ <fixedtext label="Create containers:" cnt:expand="false" />
+ <flow id="create-container" homogeneous="true" spacing="2" />
+ </vbox>
+ <hbox cnt:expand="false">
+ <vbox><fixedline /><fixedline /><fixedline /><fixedline /></vbox>
+<!-- <pushbutton id="import-button" label="Import..." cnt:expand="false"/>-->
+ <pushbutton id="export-button" label="Export (stdout)" cnt:expand="false"/>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/empty.xml b/toolkit/workben/layout/empty.xml
new file mode 100644
index 000000000000..a8408e55719e
--- /dev/null
+++ b/toolkit/workben/layout/empty.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Empty Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="1" border="10">
+ <min-size min-width="200"/>
+ <fixedline height="1"/>
+ <vbox spacing="10">
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ <vbox show="false"/>
+ </vbox>
+ <fixedline height="1"/>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/flow-container.xml b/toolkit/workben/layout/flow-container.xml
new file mode 100644
index 000000000000..3d48b1683216
--- /dev/null
+++ b/toolkit/workben/layout/flow-container.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <flow>
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ </flow>
+ <hbox cnt:expand="false">
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0.3" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0.5" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="0.7" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0" cnt:halign="1" />
+ </align>
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/flow.xml b/toolkit/workben/layout/flow.xml
new file mode 100644
index 000000000000..03e879bb13c1
--- /dev/null
+++ b/toolkit/workben/layout/flow.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Flowing" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5">
+ <flow>
+ <pushbutton label="Button 1" />
+ <pushbutton label="Button 2" />
+ <pushbutton label="Button 3" />
+ <pushbutton label="Button 4" />
+ <pushbutton label="Button 5" />
+ <pushbutton label="Button 6" />
+ <pushbutton label="Button 7" />
+ </flow>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/insert-sheet.xml b/toolkit/workben/layout/insert-sheet.xml
new file mode 100644
index 000000000000..2350da9aec77
--- /dev/null
+++ b/toolkit/workben/layout/insert-sheet.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="true" moveable="true" output-size="true" id="RID_SCDLG_INSERT_TABLE" sv-look="true" _title="Insert Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_POSITION" _text="Position"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-position" id="RB_BEFORE" tabstop="true" _label="B~efore current sheet"/>
+ <radiobutton radiogroup="insert-sheet-position" id="RB_BEHIND" tabstop="true" _label="~After current sheet"/>
+ </vbox>
+ </hbox>
+ <fixedline id="FL_TABLE" _text="Sheet"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-source" id="RB_NEW" _label="~New sheet"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5" cnt:fill="false" cnt:expand="false">
+ <fixedtext id="FT_COUNT" _label="N~o. of sheets"/>
+ <fixedtext id="FT_NAME" _label="Na~me"/>
+ </vbox>
+ <vbox>
+ <hbox>
+ <numericfield has_border="true" maximum="256" minimum="1" repeat="true" id="NF_COUNT" spin="true" spin-size="1" tabstop="true" value="1" cnt:fill="true" cnt:expand="false"/>
+ </hbox>
+ <edit has_border="true" id="ED_TABNAME" cnt:fill="true" cnt:expand="true"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <radiobutton radiogroup="insert-sheet-source" id="RB_FROMFILE" _label="~From file"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <hbox>
+ <multilistbox auto-hscroll="true" has_border="true" id="LB_TABLES" simple-mode="true" string-item-list=" : : : : " cnt:fill="true" cnt:expand="true"/>
+ <vbox cnt:fill="false" cnt:expand="false" spacing="5">
+ <pushbutton id="BTN_BROWSE" _label="~Browse..." cnt:expand="false"/>
+ <checkbox id="CB_LINK" _label="Lin~k" cnt:expand="false"/>
+ <flow/>
+ </vbox>
+ </hbox>
+ <fixedtext id="FT_PATH" label="FT-PATH"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <dialogbuttonhbox border="5" spacing="5">
+ <okbutton defbutton="true" id="BTN_OK"/>
+ <cancelbutton id="BTN_CANCEL"/>
+ <helpbutton id="BTN_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/interactable-containers.xml b/toolkit/workben/layout/interactable-containers.xml
new file mode 100644
index 000000000000..fa1bbfc5ed15
--- /dev/null
+++ b/toolkit/workben/layout/interactable-containers.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <hsplitter>
+ <scroller>
+ <vbox>
+ <pushbutton label="Some Label" />
+ <edit has_border="true" text="Some Text" />
+ <listbox has_border="true" string-item-list="Item One:Item Two:Item Three:Item Four:Item Five:Item Six:Item Seven" />
+ <combobox has_border="true" string-item-list="Item One:Item Two:Item Three" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ <pushbutton label="Some Label" />
+ </vbox>
+ </scroller>
+ <vsplitter>
+ <pushbutton label="Corner" />
+ <tabcontrol>
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <vbox cnt:title="Page 2">
+ <pushbutton label="1" />
+ <pushbutton label="2" />
+ <pushbutton label="3" />
+ <pushbutton label="4" />
+ </vbox>
+ <pushbutton label="Content 3" cnt:title="Page 3" />
+ <pushbutton label="Content 4" cnt:title="Page 4" />
+ <pushbutton label="Content 5" cnt:title="Page 5" />
+ </tabcontrol>
+ </vscroll>
+ </hsplitter>
+</dialog>
diff --git a/toolkit/workben/layout/layout-flat.xml b/toolkit/workben/layout/layout-flat.xml
new file mode 100644
index 000000000000..0d3b969020fb
--- /dev/null
+++ b/toolkit/workben/layout/layout-flat.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<framewindow xmlns="http://openoffice.org/2007/layout"
+ id="window1" title="Test-Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true"
+ width="800" height="300">
+ <pushbutton label="XML Left" toggle="true" show="true"
+ x="10" y="10" width="400" height="200"/>
+ <pushbutton label="XML Right" toggle="true" show="true"
+ x="420" y="10" width="400" height="200"/>
+ <checkbox label="XML cool ?" enabled="true" show="true"
+ state="1" tristate="true" align="1"
+ x="10" y="210" width="800" height="100"/>
+</framewindow> \ No newline at end of file
diff --git a/toolkit/workben/layout/layout.xml b/toolkit/workben/layout/layout.xml
new file mode 100644
index 000000000000..4d9e71bbc5b9
--- /dev/null
+++ b/toolkit/workben/layout/layout.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="window1" title="Test-Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <hbox border="20" spacing="10" homogeneous="true">
+ <pushbutton label="XML Left"
+ cnt:expand="true" cnt:fill="true" />
+ <pushbutton label="XML Center"
+ cnt:expand="true" cnt:fill="false" />
+ <pushbutton label="XML Right"
+ cnt:expand="false" cnt:fill="false" />
+ </hbox>
+</dialog>
diff --git a/toolkit/workben/layout/makefile.mk b/toolkit/workben/layout/makefile.mk
new file mode 100644
index 000000000000..53797e5a3102
--- /dev/null
+++ b/toolkit/workben/layout/makefile.mk
@@ -0,0 +1,151 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General 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=toolkit
+TARGET=test
+TARGETTYPE=GUI
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+.INCLUDE : settings.mk
+
+.IF "$(ENABLE_LAYOUT)" == "TRUE"
+
+# Allow zoom and wordcount to be built without depending on svx,sv,sfx2
+CFLAGS += -I../$(PRJ)/svx/inc -I../$(PRJ)/svtools/inc -I../$(PRJ)/sfx2/inc -I../$(PRJ)/sc/inc -I../$(PRJ)/sc/source/ui/inc -I../$(PRJ)/sw/inc
+
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+.IF "$(COMNAME)" == "gcc3"
+CFLAGS+=-Wall -Wno-non-virtual-dtor
+.ENDIF
+
+CXXFILES=\
+ editor.cxx \
+ plugin.cxx \
+ recover.cxx \
+ wordcountdialog.cxx \
+ test.cxx \
+ zoom.cxx
+
+OBJFILES=\
+ $(OBJ)$/editor.obj \
+ $(OBJ)$/plugin.obj \
+ $(OBJ)$/recover.obj \
+ $(OBJ)$/test.obj \
+ $(OBJ)$/tpsort.obj \
+ $(OBJ)$/sortdlg.obj \
+ $(OBJ)$/wordcountdialog.obj \
+ $(OBJ)$/zoom.obj
+
+APP1TARGET=$(TARGET)
+APP1OBJS=$(OBJFILES)
+APP1STDLIBS= \
+ $(TOOLSLIB) \
+ $(COMPHELPERLIB) \
+ $(VCLLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(SALLIB) \
+ $(XMLSCRIPTLIB) \
+ $(TKLIB) \
+ $(SVXLIB) \
+ $(ISCLIB) \
+#
+
+svtools = $(INCCOM)/svtools
+default: ALLTAR
+
+.INCLUDE : target.mk
+
+XML_FILES=\
+ insert-sheet.xml\
+ message-box.xml\
+ move-copy-sheet.xml\
+ recover.xml\
+ sort-options.xml\
+ string-input.xml\
+ tab-dialog.xml\
+ wordcount.xml\
+ zoom.xml\
+
+TRALAY=$(AUGMENT_LIBRARY_PATH) tralay
+XML_LANGS=$(alllangiso)
+
+ALLTAR: localize.sdf $(BIN)/testrc $(svtools) $(foreach,i,$(XML_FILES) en-US/$i)
+
+$(XML_LANGS:f:t"/%.xml ")/%.xml: %.xml
+ $(TRALAY) -m localize.sdf -o . -l $(XML_LANGS:f:t" -l ") $<
+ rm -rf en-US
+
+$(BIN)/%: %.in
+ cp $< $@
+
+$(svtools):
+# FIXME: there's a bug in svtools layout or usage
+# Include files are in svtools/inc, but are referenced as <svtools/..>
+# They probably should be in svtools/inc/svtools
+# This means that include files can only be included after svtools
+# is built, which would mean a circular dependency,
+# because svtools depends on toolkit.
+ ln -sf ..$/$(PRJ)$/svtools$/inc $(INCCOM)$/svtools
+
+dist .PHONY :
+ cp -pv message-box.xml $(PRJ)/uiconfig/layout
+ cp -pv tab-dialog.xml $(PRJ)/uiconfig/layout
+ $(SHELL) ./un-test.sh zoom.cxx > ../$(PRJ)/svx/source/dialog/zoom.cxx
+ $(SHELL) ./un-test.sh zoom.hxx > ../$(PRJ)/svx/source/dialog/zoom.hxx
+ touch ../$(PRJ)/svx/source/dialog/dlgfact.cxx
+ cp -pv zoom.xml ../$(PRJ)/svx/uiconfig/layout
+ $(SHELL) ./un-test.sh wordcountdialog.cxx > ../$(PRJ)/sw/source/ui/dialog/wordcountdialog.cxx
+ $(SHELL) ./un-test.sh wordcountdialog.hxx > ../$(PRJ)/sw/source/ui/inc/wordcountdialog.hxx
+ touch ../$(PRJ)/sw/source/ui/dialog/swdlgfact.cxx
+ cp -pv wordcount.xml ../$(PRJ)/sw/uiconfig/layout
+ # FIXME: broken setup
+ ln -sf ../inc/wordcountdialog.hxx ../$(PRJ)/sw/source/ui/dialog/wordcountdialog.hxx
+ $(SHELL) ./un-test.sh tpsort.cxx > ../$(PRJ)/sc/source/ui/dbgui/tpsort.cxx
+ $(SHELL) ./un-test.sh tpsort.hxx > ../$(PRJ)/sc/source/ui/inc/tpsort.hxx
+ $(SHELL) ./un-test.sh sortdlg.cxx > ../$(PRJ)/sc/source/ui/dbgui/sortdlg.cxx
+ $(SHELL) ./un-test.sh sortdlg.hxx > ../$(PRJ)/sc/source/ui/inc/sortdlg.hxx
+ touch ../$(PRJ)/sc/source/ui/attrdlg/scdlgfact.cxx
+ touch ../$(PRJ)/sc/source/ui/view/cellsh2.cxx
+ cp -pv insert-sheet.xml ../$(PRJ)/sc/uiconfig/layout
+ cp -pv move-copy-sheet.xml ../$(PRJ)/sc/uiconfig/layout
+ cp -pv sort-options.xml ../$(PRJ)/sc/uiconfig/layout
+ cp -pv string-input.xml ../$(PRJ)/sc/uiconfig/layout
+
+localize.sdf: $(PRJ)/../svx/source/dialog/localize.sdf $(PRJ)/../sw/source/ui/dialog/localize.sdf $(PRJ)/../sc/source/ui/src/localize.sdf
+ grep sortdlg.src $(PRJ)/../sc/source/ui/src/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sc\\uiconfig\\layout\\sort-options.xml", $$3, "layout", $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SCDLG_SORT_title/' > sort-options-$@
+ grep wordcountdialog.src $(PRJ)/../sw/source/ui/dialog/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "sw\\uiconfig\\layout\\wordcount.xml", $$3, "layout", $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tDLG_WORDCOUNT_title/' > wordcount-$@
+ grep zoom.src $(PRJ)/source/dialog/localize.sdf | awk -F'\t' '{{printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", "layout", "svx\\uiconfig\\layout\\zoom.xml", $$3, "layout", $$6 "_label", "", "", $$8, "0", $$10, $$11, $$12, "", $$14, $$15}}' | sed -e 's/\(\(FL\|STR\)_[^\t]*\)_label/\1_text/' -e 's/\t_label/\tRID_SVXDLG_ZOOM_title/' > zoom-$@
+ echo '#empty' | cat - sort-options-$@ wordcount-$@ zoom-$@ > $@
+ rm -f *-$@
+
+.ELSE # ENABLE_LAYOUT != TRUE
+all .PHONY:
+.ENDIF # ENABLE_LAYOUT != TRUE
diff --git a/toolkit/workben/layout/message-box.xml b/toolkit/workben/layout/message-box.xml
new file mode 100644
index 000000000000..61305e443fa3
--- /dev/null
+++ b/toolkit/workben/layout/message-box.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="message-box" _title="" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true" closeable="true">
+ <vbox border="5" spacing="5">
+ <hbox border="5" spacing="20">
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_ERROR" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-error.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_INFO" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-info.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_QUERY" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-query.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedimage id="FI_WARNING" cnt:expand="false" cnt:v-align="0.5" cnt:v-fill="0" graphic="res/commandimagelist/msgbox-warning.png" />
+ </align>
+ <align cnt:expand="false" cnt:fill="true">
+ <fixedtext id="FT_MESSAGE" _label="FT-LABEL" cnt:v-align="0.5" cnt:v-fill="0" />
+ </align>
+ <flow/>
+ </hbox>
+ <dialogbuttonhbox border="0" spacing="5">
+ <flow/>
+ <!-- deprecoted vcl/MsgBox compatibility !-->
+ <retrybutton id="BTN_RETRY" />
+ <ignorebutton id="BTN_IGNORE" />
+
+ <yesbutton id="BTN_YES"/>
+ <cancelbutton id="BTN_CANCEL"/>
+ <helpbutton id="BTN_HELP"/>
+ <nobutton id="BTN_NO" xlabel="~Alternate"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/more.xml b/toolkit/workben/layout/more.xml
new file mode 100644
index 000000000000..79e9c8214356
--- /dev/null
+++ b/toolkit/workben/layout/more.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_SVXDLG_MORE" _title="Test More" optimumsize="true"
+ help-id="SID_ATTR_RESTORE"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5" width="640">
+ <fixedtext id="FT_ONE" _label="One"/>
+ <fixedtext id="FT_TWO" _label="Two"/>
+ <hbox border="5">
+ <flow/>
+ <morebutton id="PB_MORE" cnt:expand="false" _label="More..."/>
+ </hbox>
+ <fixedtext id="FT_THREE" _label="Three"/>
+ <fixedtext id="FT_FOUR" _label="Four"/>
+ </vbox>
+</modaldialog>
+
diff --git a/toolkit/workben/layout/move-copy-sheet.xml b/toolkit/workben/layout/move-copy-sheet.xml
new file mode 100644
index 000000000000..3d26db1aa73d
--- /dev/null
+++ b/toolkit/workben/layout/move-copy-sheet.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="true" help-id="FID_TAB_MOVE" moveable="true" output-size="true" id="RID_SCDLG_MOVETAB" sv-look="true" _title="Move/Copy Sheet" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox spacing="5" border="5">
+ <string id="STR_NEWDOC" _text="- new document -"/>
+ <fixedtext id="FT_DEST" _label="To ~document"/>
+ <listbox has_border="true" dropdown="true" id="LB_DEST" tabstop="true"/>
+ <fixedtext id="FT_INSERT" _label="~Insert before"/>
+ <listbox has_border="true" id="LB_INSERT" tabstop="true" string-item-list=" : : : : " />
+ <checkbox id="BTN_COPY" tabstop="true" _label="~Copy"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <cancelbutton id="BTN_CANCEL" tabstop="true"/>
+ <helpbutton id="BTN_HELP" tabstop="true"/>
+ <okbutton defbutton="true" id="BTN_OK" tabstop="true"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/non-interactable-containers.xml b/toolkit/workben/layout/non-interactable-containers.xml
new file mode 100644
index 000000000000..29b37b6a7a49
--- /dev/null
+++ b/toolkit/workben/layout/non-interactable-containers.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="10">
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <hfixedline/>
+ <flow cnt:expand="false">
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <table columns="3" cnt:title="Page 1">
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ <pushbutton label="label" />
+ </flow>
+ <hfixedline/>
+ <hbox cnt:expand="false">
+<!-- <align>
+ <okbutton cnt:hfill="0.2" cnt:halign="0.2" />
+ </align>
+ <align>
+ <okbutton cnt:hfill="0.8" cnt:halign="0.2" />
+ </align>-->
+ </hbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/number-format.xml b/toolkit/workben/layout/number-format.xml
new file mode 100644
index 000000000000..6f4c61d01b3e
--- /dev/null
+++ b/toolkit/workben/layout/number-format.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<tabpage help-id="HID_NUMBERFORMAT" show="false" id="RID_SVXPAGE_NUMBERFORMAT" _title="Number Format" _text="Number Format" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" sizeable="true">
+ <!--
+ <imagelist prefix="nu" id="IL_ICON">
+ <maskcolor blue="0xFFFF" green="0x0000" red="0xFFFF" type="Color"/>
+ <idlist none="IID_INFO"/>
+ <idcount none="3"/>
+ </imagelist>
+ <imagelist prefix="nuh" id="IL_ICON_HC">
+ <maskcolor blue="0xFFFF" green="0x0000" red="0xFFFF" type="Color"/>
+ <idlist none="IID_INFO"/>
+ <idcount none="3"/>
+ </imagelist>
+ !-->
+ <vbox spacing="5" border="5">
+ <string id="STR_EUROPE" _text="Europe"/>
+ <string id="STR_AUTO_ENTRY" _text="Automatic"/>
+ <hbox spacing="5">
+ <vbox spacing="5" cnt:fill="true" cnt:expand="true">
+ <fixedtext id="FT_CATEGORY" _label="~Category"/>
+ <listbox line-count="8" auto-hscroll="true" has_border="true" id="LB_CATEGORY" _string-item-list="All:User-defined:Number:Percent:Currency:Date:Time:Scientific:Fraction:Boolean Value:Text"/>
+ <flow/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="true" cnt:expand="true">
+ <fixedtext id="FT_FORMAT" _label="F~ormat"/>
+ <listbox has_border="true" line-count="7" dropdown="true" id="LB_CURRENCY" tabstop="true" _string-item-list="Automatically" cnt:expand="false" cnt:fill="false"/>
+ <svxfontlistbox line-count="7" dropdown="false" has_border="true" help-id="HID_NUMBERFORMAT_LB_FORMAT" id="LB_FORMAT" tabstop="true" string-item-list=" : : : : : : : : : : : : : : : "/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="true" cnt:expand="true">
+ <fixedtext id="FT_LANGUAGE" _label="~Language" cnt:expand="false" cnt:fill="false"/>
+ <svxlanguagebox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" string-item-list="Dutch:" cnt:expand="false" cnt:fill="false"/>
+ <checkbox id="CB_SOURCEFORMAT" show="false" _label="So~urce format" cnt:expand="false" cnt:fill="false"/>
+ <flow cnt:expand="true" cnt:fill="true"/>
+ <window has_border="true" help-id="HID_NUMBERFORMAT_WND_NUMBER_PREVIEW" id="WND_NUMBER_PREVIEW" sv-look="true"/>
+ </vbox>
+ </hbox>
+ <fixedline id="FL_OPTIONS" _text="Options"/>
+ <hbox>
+ <vbox cnt:padding="13" spacing="5">
+ <hbox spacing="5">
+ <vbox spacing="5" cnt:fill="false" cnt:expand="false">
+ <fixedtext id="FT_DECIMALS" _label="~Decimal places"/>
+ <fixedtext id="FT_LEADZEROES" _label="Leading ~zeroes"/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="false" cnt:expand="false">
+ <numericfield has_border="true" first="0" last="15" minimum="0" value="2" maximum="20" repeat="true" id="ED_DECIMALS" spin="true" spin-size="1" strict-format="true" cnt:expand="false"/>
+ <numericfield has_border="true" first="0" last="15" minimum="0" value="1" maximum="20" repeat="true" id="ED_LEADZEROES" spin="true" spin-size="1" strict-format="true" cnt:fill="false"/>
+ </vbox>
+ <vbox spacing="5" cnt:fill="false" cnt:expand="false">
+ <checkbox id="BTN_NEGRED" _label="~Negative numbers red"/>
+ <checkbox id="BTN_THOUSAND" _label="~Thousands separator"/>
+ </vbox>
+ </hbox>
+ </vbox>
+ </hbox>
+ <fixedtext id="FT_EDFORMAT" _label="~Format code"/>
+ <hbox spacing="5" cnt:expand="false">
+ <edit has_border="true" id="ED_FORMAT"/>
+ <imagebutton cnt:expand="false" cnt:fill="false" help-id="HID_NUMBERFORMAT_TBI_ADD" quick-help-text="Add" id="IB_ADD" sv-look="true" graphic="svx/res/nu01.png"/>
+ <imagebutton cnt:expand="false" help-id="HID_NUMBERFORMAT_TBI_INFO" quick-help-text="Edit Comment" id="IB_INFO" sv-look="true" graphic="svx/res/nu03.png"/>
+ <imagebutton cnt:expand="false" help-id="HID_NUMBERFORMAT_TBI_REMOVE" quick-help-text="Remove" id="IB_REMOVE" sv-look="true" graphic="svx/res/nu02.png"/>
+ </hbox>
+ <fixedtext no-label="true" show="false" id="FT_COMMENT" word-break="true" cnt:expand="false"/>
+ <edit has_border="true" show="false" id="ED_COMMENT" cnt:expand="false"/>
+ </vbox>
+</tabpage>
diff --git a/toolkit/workben/layout/numeric.xml b/toolkit/workben/layout/numeric.xml
new file mode 100644
index 000000000000..becab18cdf9b
--- /dev/null
+++ b/toolkit/workben/layout/numeric.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<framewindow xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="window1" title="Test-Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <numericfield text="5" spin="true" enforce-format="false" value-min="5.3" value-max="17.8"/>
+ <pushbutton />
+ </vbox>
+</framewindow>
diff --git a/toolkit/workben/layout/ooo-patch b/toolkit/workben/layout/ooo-patch
new file mode 100644
index 000000000000..89fc58db8748
--- /dev/null
+++ b/toolkit/workben/layout/ooo-patch
@@ -0,0 +1,7 @@
+#! /bin/sh
+commit=${1-3249db59} # m5
+
+git diff $commit layout | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-layout.diff
+git diff $commit config_office scp2 | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-config_office-scp2.diff
+git diff $commit svx sw | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-svx-sw.diff
+git diff $commit transex3 | sed 's@^\([+-]\{3\}\) \(a\|b\)/@\1 @' > layout-dialogs-transex3.diff
diff --git a/toolkit/workben/layout/paragraph.xml b/toolkit/workben/layout/paragraph.xml
new file mode 100644
index 000000000000..847e04ec0568
--- /dev/null
+++ b/toolkit/workben/layout/paragraph.xml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Paragraph" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+<vbox>
+ <tabcontrol>
+ <vbox cnt:title="Indents and Spacing">
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_INDENT" label="Indent" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <table columns="2" cnt:expand="false">
+ <fixedtext id="FT_LEFTINDENT" label="Before text" />
+ <metricfield id="ED_LEFTINDENT" spin="true" has_border="true"/>
+ <fixedtext id="FT_RIGHTINDENT" label="After text" />
+ <metricfield id="ED_RIGHTINDENT" spin="true" has_border="true"/>
+ <fixedtext id="FT_FLINEINDENT" label="First line" />
+ <metricfield id="ED_FLINEINDENT" spin="true" has_border="true" />
+ <checkbox id="CB_AUTO" label="Automatic" cnt:col-span="2" />
+ </table>
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_DIST" label="Spacing" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <table columns="2" cnt:expand="false">
+ <fixedtext id="FT_TOPDIST" label="Above paragraph" />
+ <numericfield id="ED_TOPDIST" spin="true" has_border="true" />
+ <fixedtext id="FT_BOTTOMDIST" label="Below paragraph" />
+ <numericfield id="ED_BOTTOMDIST" spin="true" has_border="true" />
+ </table>
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_LINEDIST" label="Line spacing" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <hbox cnt:expand="false">
+ <listbox id="LB_LINEDIST" dropdown="true"
+ string-item-list="Single:1.5 lines:Double:Proportional"
+ cnt:expand="false"/>
+ <fixedtext id="FT_LINEDIST" label="of" cnt:expand="true" />
+ <numericfield id="ED_LINEDISTPERCENT" value="0" />
+ </hbox>
+ <hbox id="FL_REGISTER" cnt:expand="false">
+ <fixedtext label="Register-true" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <checkbox id="CB_REGISTER" cnt:expand="false" label="Activate" />
+ </vbox>
+
+ <vbox cnt:title="Alignment">
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_ALIGN" label="Options" cnt:expand="false" />
+ <fixedline />
+ </hbox>
+ <radiobutton id="BTN_LEFTALIGN" label="Left" cnt:expand="false" />
+ <radiobutton id="BTN_RIGHTALIGN" label="Right" cnt:expand="false" />
+ <radiobutton id="BTN_CENTERALIGN" label="Center" cnt:expand="false" />
+ <radiobutton id="BTN_JUSTIFYALIGN" label="Justify" cnt:expand="false" />
+ <hbox cnt:expand="false">
+ <fixedtext id="FL_ALIGN" label="Last line" cnt:expand="false" />
+ <listbox dropdown="true" string-item-list="Left:Centered:Justified"
+ id="LB_LASTLINE" />
+ </hbox>
+ </vbox>
+ </tabcontrol>
+
+ <align cnt:expand="false">
+ <hbox cnt:expand="false" cnt:hfill="0" cnt:halign="1">
+ <pushbutton label="OK" />
+ <pushbutton label="Cancel" />
+ <pushbutton label="Help" />
+ <pushbutton label="Reset" />
+ </hbox>
+ </align>
+</vbox>
+</dialog>
diff --git a/toolkit/workben/layout/plugin.cxx b/toolkit/workben/layout/plugin.cxx
new file mode 100644
index 000000000000..d20fad8c71b9
--- /dev/null
+++ b/toolkit/workben/layout/plugin.cxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define _LAYOUT_PLUGIN_CXX
+
+#include "plugin.hxx"
+
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <dialcontrol.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+#include <layout/layout-pre.hxx>
+
+using namespace com::sun::star;
+
+#define LAYOUT_RES(x) #x
+
+#undef ModalDialog
+#define ModalDialog( parent, id ) Dialog( parent, "plugin.xml", id )
+
+PluginDialog::PluginDialog( Window* pParent )
+ : ModalDialog( pParent, LAYOUT_RES( RID_DLG_PLUGIN ) )
+ , aHeaderImage( this, LAYOUT_RES( FI_HEADER ) )
+ , aHeaderText( this, LAYOUT_RES( FT_HEADER ) )
+ , aHeaderLine( this, LAYOUT_RES( FL_HEADER ) )
+ , aPlugin( this, LAYOUT_RES( PL_DIAL ),
+// FIXME: width=, height=, are not recognized as properties.
+// new svx::DialControl( LAYOUT_DIALOG_PARENT, Size( 0, 0 ), 0 ) )
+ new svx::DialControl( LAYOUT_DIALOG_PARENT, Size( 80, 80 ), 0 ) )
+ //, aDialControl( static_cast<svx::DialControl&> ( aPlugin.GetPlugin() ) )
+ , aDialControl( static_cast<svx::DialControl&> ( *aPlugin.mpPlugin ) )
+ , aOKBtn( this, LAYOUT_RES( BTN_OK ) )
+ , aCancelBtn( this, LAYOUT_RES( BTN_CANCEL ) )
+ , aHelpBtn( this, LAYOUT_RES( BTN_HELP ) )
+{
+ aDialControl.SetRotation( 425 );
+}
+
+PluginDialog::~PluginDialog()
+{
+}
diff --git a/toolkit/workben/layout/plugin.hxx b/toolkit/workben/layout/plugin.hxx
new file mode 100644
index 000000000000..6c8f238b0f57
--- /dev/null
+++ b/toolkit/workben/layout/plugin.hxx
@@ -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.
+ *
+ ************************************************************************/
+#ifndef _LAYOUT_PLUGIN_HXX
+#define _LAYOUT_PLUGIN_HXX
+
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+
+namespace svx {
+class DialControl;
+}
+
+class PluginDialog : public ModalDialog
+{
+private:
+ FixedImage aHeaderImage;
+ FixedText aHeaderText;
+ FixedLine aHeaderLine;
+ Plugin aPlugin;
+ svx::DialControl& aDialControl;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+public:
+ PluginDialog( Window* pParent );
+ ~PluginDialog();
+};
+
+#include <layout/layout-post.hxx>
+
+#endif /* _LAYOUT_PLUGIN_HXX */
+
diff --git a/toolkit/workben/layout/plugin.xml b/toolkit/workben/layout/plugin.xml
new file mode 100644
index 000000000000..c5f1b2abe040
--- /dev/null
+++ b/toolkit/workben/layout/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_DLG_PLUGIN" _title="Plugin Test" optimumsize="true"
+ help-id="SID_ATTR_PLUGIN"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <hbox spacing="5" cnt:expand="false">
+ <fixedimage id="FI_HEADER" cnt:expand="false" graphic="res/commandimagelist/sc_apply.png" />
+ <fixedtext id="FT_HEADER" _label="Plugin Test"/>
+ </hbox>
+ <fixedline id="FL_HEADER"/>
+ <hbox>
+ <flow cnt:padding="80"/>
+ <plugin id="PL_DIAL" width="80" height="80"/>
+ </hbox>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_OK"/>
+ <cancelbutton id="BTN_CANCEL" />
+ <helpbutton id="BTN_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
+
diff --git a/toolkit/workben/layout/radio-groups.xml b/toolkit/workben/layout/radio-groups.xml
new file mode 100644
index 000000000000..43a1372297ee
--- /dev/null
+++ b/toolkit/workben/layout/radio-groups.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Radio Groups Test"
+ optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <hbox>
+ <radiobutton group="1" label="Group 1"
+ cnt:expand="false" cnt:fill="false" />
+ <radiobutton group="2" label="Group 2"
+ cnt:expand="true" cnt:fill="true" />
+ <radiobutton group="2" label="Group 2"
+ cnt:expand="true" cnt:fill="false" />
+ <radiobutton group="1" label="Group 1 (default)" state="1"
+ cnt:expand="false" cnt:fill="false" />
+ </hbox>
+ <radiobutton group="1" label="Group 1" state="0"
+ cnt:expand="false" cnt:fill="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/recover.cxx b/toolkit/workben/layout/recover.cxx
new file mode 100644
index 000000000000..fc54fc0be28d
--- /dev/null
+++ b/toolkit/workben/layout/recover.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.
+ *
+ ************************************************************************/
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+#if TEST_LAYOUT
+#include <cstdio>
+#endif /* TEST_LAYOUT */
+#include <com/sun/star/awt/XDialog2.hpp>
+#include <tools/shl.hxx>
+#include <svtools/itemset.hxx>
+#include <svtools/itempool.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+#include <toolkit/awt/vclxwindow.hxx>
+
+
+#include <com/sun/star/awt/PosSize.hpp> //redrawAlready
+
+using namespace com::sun::star;
+
+#define _SVX_RECOVER_CXX
+
+#include "recover.hxx"
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "recover.xml", id )
+#endif /* ENABLE_LAYOUT */
+
+#if TEST_LAYOUT
+SvxRecoverDialog::SvxRecoverDialog( Window* pParent )
+#else /* !TEST_LAYOUT */
+SvxRecoverDialog::SvxRecoverDialog( Window* pParent, const SfxItemSet& rCoreSet )
+#endif /* !TEST_LAYOUT */
+: SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_RECOVER ) )
+
+ , aHeaderImage( this, SVX_RES( FI_HEADER ) )
+ , aHeaderText( this, SVX_RES( FT_HEADER ) )
+ , aHeaderLine( this, SVX_RES( FL_HEADER ) )
+ , aRecoverText( this, SVX_RES( FT_RECOVER ) )
+ , aTextAdvanced( this, SVX_RES( FT_ADVANCED ) )
+
+ , aCheckBoxDoc( this, SVX_RES( CB_DOC ) )
+ , aImageDoc( this, SVX_RES( FI_DOC ) )
+ , aTextDoc( this, SVX_RES( FT_DOC ) )
+
+ , aCheckBoxSheet( this, SVX_RES( CB_SHEET ) )
+ , aImageSheet( this, SVX_RES( FI_SHEET ) )
+ , aTextSheet( this, SVX_RES( FT_SHEET ) )
+
+ , aCheckBoxDraw( this, SVX_RES( CB_DRAW ) )
+ , aImageDraw( this, SVX_RES( FI_DRAW ) )
+ , aTextDraw( this, SVX_RES( FT_DRAW ) )
+
+ , aCheckBoxPresent( this, SVX_RES( CB_PRESENT ) )
+ , aImagePresent( this, SVX_RES( FI_PRESENT ) )
+ , aTextPresent( this, SVX_RES( FT_PRESENT ) )
+
+ , aButtonAdvanced( this, SVX_RES( PB_ADVANCED ) )
+
+ , aProgressText( this, SVX_RES( FT_PROGRESS ) )
+ , aProgressBar( this, SVX_RES( PB_RECOVER ) )
+ , aCheckBoxLogFile( this, SVX_RES( CH_LOGFILE ) )
+ , aOKBtn( this, SVX_RES( BTN_OK ) )
+ , aCancelBtn( this, SVX_RES( BTN_CANCEL ) )
+ , aHelpBtn( this, SVX_RES( BTN_HELP ) )
+{
+ aButtonAdvanced.AddAdvanced( &aTextAdvanced );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxDoc );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxSheet );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxDraw );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxPresent );
+ aButtonAdvanced.AddAdvanced( &aCheckBoxLogFile );
+}
+
+
+SvxRecoverDialog::~SvxRecoverDialog()
+{
+}
diff --git a/toolkit/workben/layout/recover.hxx b/toolkit/workben/layout/recover.hxx
new file mode 100644
index 000000000000..d01350121375
--- /dev/null
+++ b/toolkit/workben/layout/recover.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVX_RECOVER_HXX
+#define _SVX_RECOVER_HXX
+
+#include <layout/layout.hxx>
+#include <vcl/button.hxx>
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+#include <layout/core/box.hxx>
+#include <layout/layout-pre.hxx>
+
+class SvxRecoverDialog : public SfxModalDialog
+{
+private:
+ FixedImage aHeaderImage;
+ FixedText aHeaderText;
+ FixedLine aHeaderLine;
+ FixedText aRecoverText;
+ FixedText aTextAdvanced;
+
+ CheckBox aCheckBoxDoc;
+ FixedImage aImageDoc;
+ FixedText aTextDoc;
+ CheckBox aCheckBoxSheet;
+ FixedImage aImageSheet;
+ FixedText aTextSheet;
+ CheckBox aCheckBoxDraw;
+ FixedImage aImageDraw;
+ FixedText aTextDraw;
+ CheckBox aCheckBoxPresent;
+ FixedImage aImagePresent;
+ FixedText aTextPresent;
+ AdvancedButton aButtonAdvanced;
+
+ FixedText aProgressText;
+ ProgressBar aProgressBar;
+ CheckBox aCheckBoxLogFile;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+public:
+#if TEST_LAYOUT
+ SvxRecoverDialog( Window* pParent );
+#else /* !TEST_LAYOUT */
+ SvxRecoverDialog( Window* pParent, const SfxItemSet& rCoreSet );
+#endif /* !TEST_LAYOUT */
+ ~SvxRecoverDialog();
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
+
diff --git a/toolkit/workben/layout/recover.xml b/toolkit/workben/layout/recover.xml
new file mode 100644
index 000000000000..b7387b687de2
--- /dev/null
+++ b/toolkit/workben/layout/recover.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_SVXDLG_RECOVER" _title="OpenOffice.org Document Restore -- questions to sigi(at)novell.com--" optimumsize="true"
+ help-id="SID_ATTR_RESTORE"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5" width="640">
+ <hbox spacing="5" cnt:expand="false">
+ <fixedimage id="FI_HEADER" cnt:expand="false" graphic="res/commandimagelist/sc_apply.png" />
+ <fixedtext id="FT_HEADER" _label="OpenOffice.org Document Restore"/>
+ </hbox>
+ <fixedline id="FL_HEADER"/>
+ <!-- mockup: fixedtext multiline=true" does not work?
+ <multilineedit id="MLE_RECOVER" has_border="false" foobar="x" _text="At least one document was found that was not stored safely to the media. Uncheck any documents you do not want to restore (information may be lost)."/>
+ <fixedtext id="FT_RECOVER" has_border="false" multi-line="true" font-word-line-mode="true" word-break="true" _label="At least one document was found that was not stored safely to the media. Uncheck any documents you do not want to restore (information may be lost).
+LINE TEST"/>
+ !-->
+ <fixedtext id="FT_RECOVER" has_border="false" multi-line="true" font-word-line-mode="true" _label="At least one document was not stored safely and must be recovered."/>
+ <fixedtext id="FT_ADVANCED" has_border="false" multi-line="true" font-word-line-mode="true" word-break="true" _label="Uncheck any documents you do not want to restore (information may be lost)."/>
+ <vbox cnt:fill="true" cnt:expand="true" cnt:padding="20" border="20" spacing="20">
+ <hbox>
+ <checkbox id="CB_DOC" state="1" cnt:expand="false" scale="false"/>
+ <fixedimage id="FI_DOC" cnt:v-align="0.5" image-align="0.5" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertdoc.png"/>
+ <fixedtext id="FT_DOC" _label="My document"/>
+ </hbox>
+ <hbox>
+ <checkbox id="CB_SHEET" state="1" cnt:expand="false" scale="false" />
+ <fixedimage id="FI_SHEET" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_inserttable.png" />
+ <fixedtext id="FT_SHEET" _label="My spreadsheet"/>
+ </hbox>
+ <hbox>
+ <checkbox id="CB_DRAW" state="1" cnt:expand="false" scale="false"/>
+ <fixedimage id="FI_DRAW" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertdraw.png" />
+ <fixedtext id="FT_DRAW" _label="My drawing"/>
+ </hbox>
+ <hbox>
+ <checkbox id="CB_PRESENT" state="1" cnt:expand="false" scale="false" />
+ <fixedimage id="FI_PRESENT" cnt:expand="false" scale="false" graphic="res/commandimagelist/lc_insertvideo.png" />
+ <fixedtext id="FT_PRESENT" _label="My presentation"/>
+ </hbox>
+ <hbox border="5">
+ <flow/>
+ <advancedbutton id="PB_ADVANCED" cnt:expand="false" _label="Advanced..."/>
+ </hbox>
+ </vbox>
+ <vbox>
+ <fixedtext id="FT_PROGRESS" _label="Restore progress (idle)"/>
+ <hbox height="40" cnt:expand="true">
+ <progressbar cnt:expand="true" cnt:fill="true" id="PB_RECOVER" has_border="true" border="10" fill-color="#ccccff" background-color="#ffffff" progress-value-min="0" progress-value-max="100" progress-value="50" />
+ <!-- FIXME: cannot set progress bar's height, use space as strut... !-->
+ <fixedtext label="" height="10" cnt:expand="false" cnt:fill="false"/>
+ </hbox>
+ </vbox>
+ <checkbox id="CH_LOGFILE" _label="Open additional text document to display the restore logfile"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_OK" _label="Restore"/>
+ <cancelbutton id="BTN_CANCEL" />
+ <helpbutton id="BTN_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
+
diff --git a/toolkit/workben/layout/refresh b/toolkit/workben/layout/refresh
new file mode 100644
index 000000000000..796999549c36
--- /dev/null
+++ b/toolkit/workben/layout/refresh
@@ -0,0 +1,7 @@
+echo "source me ..."
+test -n "${INPATH}" && rm -Rf ../../${INPATH}
+build debug=true\
+ && cp ../../${INPATH}/lib/*.so ../../../solver/300/${INPATH}/lib \
+ && cp -f ../..$INPATH/lib/libtkx.so $OOO_INSTALL_PREFIX/openoffice.org/basis3.0/program \
+ && dmake debug=true \
+ && ../../${INPATH}/bin/test "$@"
diff --git a/toolkit/workben/layout/run-s2x b/toolkit/workben/layout/run-s2x
new file mode 100644
index 000000000000..926addf49047
--- /dev/null
+++ b/toolkit/workben/layout/run-s2x
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+SRC=${1-../../svx/source/dialog/zoom.src}
+SRC=${1-../../sw/source/ui/dialog/wordcountdialog.src}
+
+../src2xml/source/src2xml.py --ignore-includes --post-process --output-dir=. $SRC
diff --git a/toolkit/workben/layout/scroller.xml b/toolkit/workben/layout/scroller.xml
new file mode 100644
index 000000000000..44e63d15df5e
--- /dev/null
+++ b/toolkit/workben/layout/scroller.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Scroll Test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <scroller>
+ <vbox>
+ <pushbutton label="Button 1" />
+ <edit has_border="true" text="Edit 1" />
+ <pushbutton label="Button 2" />
+ <pushbutton label="Button 3" />
+ <pushbutton label="Button 4" />
+ <pushbutton label="Button 5" />
+ <pushbutton label="Button 6" />
+ <pushbutton label="Button 7" />
+ <pushbutton label="Button 8" />
+ <pushbutton label="Button 9" />
+ <pushbutton label="Button 10" />
+ <pushbutton label="Button 11" />
+ <pushbutton label="Button 12" />
+ <pushbutton label="Button 13" />
+ <pushbutton label="Button 14" />
+ <pushbutton label="Button 15" />
+ <pushbutton label="Button 16" />
+ <pushbutton label="Button 17" />
+ </vbox>
+ </scroller>
+ <okbutton cnt:expand="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/sequence.xml b/toolkit/workben/layout/sequence.xml
new file mode 100644
index 000000000000..e89db54db2dc
--- /dev/null
+++ b/toolkit/workben/layout/sequence.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<framewindow xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ xmlns:style="http://openoffice.org/2007/layout/style"
+ title="Sequence Test" style:optimumsize="true"
+ style:has_border="true" style:sizeable="true" style:moveable="true">
+ <vbox>
+ <multilistbox linecount="5" string-item-list=":a:b::c:::d::::e:as:"
+ selected-items="0:1" />
+ <okbutton cnt:expand="false" />
+ </vbox>
+</framewindow>
diff --git a/toolkit/workben/layout/shutdown.xml b/toolkit/workben/layout/shutdown.xml
new file mode 100644
index 000000000000..fbe49e046cb4
--- /dev/null
+++ b/toolkit/workben/layout/shutdown.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Shutdown Dialog" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox border="5" spacing="5">
+ <fixedline text="Platform default"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="GNOME"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="gnome">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="KDE"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="kde">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="MacOS"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="macos">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ <fixedline text="Windows"/>
+ <dialogbuttonhbox border="5" spacing="5" ordering="windowsg">
+ <flow/>
+ <okbutton label="~Shutdown"/>
+ <cancelbutton/>
+ <pushbutton label="Pause"/>
+ <pushbutton label="Sleep"/>
+ <pushbutton label="Restart"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/simple-paragraph.cxx b/toolkit/workben/layout/simple-paragraph.cxx
new file mode 100644
index 000000000000..721dd9030c67
--- /dev/null
+++ b/toolkit/workben/layout/simple-paragraph.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+#include <toolkit/awt/vclxwindow.hxx>
+
+// include ---------------------------------------------------------------
+
+#include <cstdio>
+#include <tools/shl.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+
+#include <cstdio>
+
+namespace SVX {
+#include <svx/paraprev.hxx> // Preview
+};
+
+#include "simple-paragraph.hxx"
+
+#include <assert.h>
+
+
+
+
+
+// StandardTabPage ----------------------------------------------------------
+
+#define FT_LEFTINDENT 10
+#define ED_LEFTINDENT 11
+#define FT_FLINEINDENT 12
+#define ED_FLINEINDENT 13
+#define FT_RIGHTINDENT 14
+#define ED_RIGHTINDENT 15
+#define FL_INDENT 16
+
+#define FT_TOPDIST 20
+#define ED_TOPDIST 21
+#define FT_BOTTOMDIST 22
+#define ED_BOTTOMDIST 23
+#define FL_DIST 24
+
+#define BTN_LEFTALIGN 30
+#define BTN_RIGHTALIGN 31
+#define BTN_CENTERALIGN 32
+#define BTN_JUSTIFYALIGN 33
+#define FL_ALIGN 34
+#define FL_VERTALIGN 35
+#define LB_VERTALIGN 36
+#define FL_VERTEX 37
+#define CB_SNAP 38
+#define FT_VERTALIGN 39
+
+
+#define LB_LINEDIST 40
+#define FT_LINEDIST 41
+#define ED_LINEDISTPERCENT 42
+#define ED_LINEDISTMETRIC 43
+#define FL_LINEDIST 44
+#define WN_EXAMPLE 46
+
+#define CB_AUTO 48
+#define FT_LASTLINE 49
+#define LB_LASTLINE 50
+#define CB_EXPAND 51
+#define ST_LINEDIST_ABS 52
+#define ST_LEFTALIGN_ASIAN 53
+#define ST_RIGHTALIGN_ASIAN 54
+
+// ExtendedTabPage ----------------------------------------------------------
+
+#define BTN_HYPHEN 50
+#define ED_HYPHENBEFORE 52
+#define FT_HYPHENBEFORE 53
+#define ED_HYPHENAFTER 55
+#define FT_HYPHENAFTER 56
+#define FL_HYPHEN 57
+
+#define BTN_PAGEBREAK 60
+#define FT_BREAKTYPE 61
+#define LB_BREAKTYPE 62
+#define FT_BREAKPOSITION 63
+#define LB_BREAKPOSITION 64
+#define BTN_PAGECOLL 65
+#define LB_PAGECOLL 66
+#define BTN_KEEPTOGETHER 67
+#define BTN_WIDOWS 68
+#define ED_WIDOWS 69
+#define FT_WIDOWS 70
+#define BTN_ORPHANS 71
+#define ED_ORPHANS 72
+#define FT_ORPHANS 73
+#define FL_OPTIONS 74
+#define FT_PAGENUM 75
+#define ED_PAGENUM 76
+#define FL_BREAKS 77
+
+#define CB_KEEPTOGETHER 80
+#define FT_MAXHYPH 81
+#define ED_MAXHYPH 83
+
+#define CB_REGISTER 84
+#define FL_REGISTER 85
+#define FL_PROPERTIES 90
+#define FT_TEXTDIRECTION 91
+#define LB_TEXTDIRECTION 92
+
+
+//asian typography
+#define FL_AS_OPTIONS 1
+#define CB_AS_HANG_PUNC 2
+#define CB_AS_ALLOW_WORD_BREAK 3
+#define CB_AS_FORBIDDEN 4
+#define FL_AS_CHAR_DIST 5
+#define CB_AS_PUNCTUATION 6
+#define CB_AS_SCRIPT_SPACE 7
+#define CB_AS_ADJUST_NUMBERS 8
+
+
+
+
+
+
+
+
+SvxSimpleParagraphDialog::SvxSimpleParagraphDialog( Window* pParent ) :
+ SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ),
+ Dialog( pParent, "simple-paragraph.xml", "dialog" ),
+ aLineSpacingList( this, "line-spacing-list" )
+{
+fprintf(stderr, "creating res mgr\n");
+ pMgr = ResMgr::CreateResMgr("SOME_NAME");
+fprintf(stderr, "getting parent\n");
+ VCLXWindow *pCompParent = VCLXWindow::GetImplementation( GetPeer() );
+ assert( pCompParent != NULL );
+ assert( pCompParent->GetWindow() != NULL );
+fprintf(stderr, "creating foreign vcl widget\n");
+/* pPrevWin = new SVX::SvxParaPrevWindow(
+ pCompParent->GetWindow(),
+ ResId(1234, *pMgr)
+ );*/
+
+fprintf(stderr, "done\n");
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxSimpleParagraphDialog::~SvxSimpleParagraphDialog()
+{
+}
diff --git a/toolkit/workben/layout/simple-paragraph.hxx b/toolkit/workben/layout/simple-paragraph.hxx
new file mode 100644
index 000000000000..07d85da29723
--- /dev/null
+++ b/toolkit/workben/layout/simple-paragraph.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_SIMPLE_PARAGRAPH_HXX
+#define _SVX_SIMPLE_PARAGRAPH_HXX
+
+#include <layout/layout.hxx>
+
+#include <svx/paraprev.hxx> // Preview
+
+namespace SVX {
+ class SvxParaPrevWindow;
+};
+class ResMgr;
+
+class SvxSimpleParagraphDialog : public SfxTabPage, public layout::Dialog
+{
+private:
+ ListBox aLineSpacingList;
+ SVX::SvxParaPrevWindow *pPrevWin;
+ ResMgr *pMgr;
+
+public:
+ SvxSimpleParagraphDialog( Window* pParent );
+ ~SvxSimpleParagraphDialog();
+};
+
+#endif
diff --git a/toolkit/workben/layout/simple-paragraph.xml b/toolkit/workben/layout/simple-paragraph.xml
new file mode 100644
index 000000000000..e07909dc8a39
--- /dev/null
+++ b/toolkit/workben/layout/simple-paragraph.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Paragraph test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <listbox id="line-spacing-list" dropdown="true" cnt:expand="false"
+ string-item-list="Single:1.5 lines:Double:Proportional" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/sort-options.xml b/toolkit/workben/layout/sort-options.xml
new file mode 100644
index 000000000000..a409ac2d530a
--- /dev/null
+++ b/toolkit/workben/layout/sort-options.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<tabpage help-id="HID_SCPAGE_SORT_OPTIONS"
+ id="RID_SCPAGE_SORT_OPTIONS"
+ sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container"
+ optimumsize="true"
+ sizeable="true" moveable="true">
+ <vbox spacing="4" border="5">
+ <string id="STR_COL_LABEL" _text="Range contains column la~bels"/>
+ <string id="STR_ROW_LABEL" _text="Range contains ~row labels"/>
+ <string id="SCSTR_UNDEFINED" _text="- undefined -"/>
+ <vbox spacing="4" border="5">
+ <checkbox id="BTN_CASESENSITIVE" tabstop="true" _label="Case ~sensitive"/>
+ <checkbox id="BTN_LABEL" tabstop="true"/>
+ <checkbox id="BTN_FORMATS" tabstop="true" _label="Include ~formats"/>
+ <checkbox id="BTN_NATURALSORT" tabstop="true" _label="Enable ~natural sort"/>
+ <checkbox id="BTN_COPYRESULT" tabstop="true" _label="~Copy sort results to:"/>
+ <hbox>
+ <listbox has_border="true" dropdown="true" id="LB_OUTAREA" tabstop="true"/>
+ <edit has_border="true" disable="true" id="ED_OUTAREA" tabstop="true"/>
+ </hbox>
+ <checkbox id="BTN_SORT_USER" tabstop="true" _label="Custom sort ~order"/>
+ <listbox has_border="true" disable="true" dropdown="true" id="LB_SORT_USER" tabstop="true"/>
+ <hbox>
+ <fixedtext id="FT_LANGUAGE" _label="~Language"/>
+ <fixedtext id="FT_ALGORITHM" _label="O~ptions"/>
+ </hbox>
+ <hbox>
+ <svxlanguagebox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" tabstop="true" _string-item-list="Default"/>
+ <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/>
+ </hbox>
+ <fixedline id="FL_DIRECTION" _text="Direction"/>
+ <radiobutton id="BTN_TOP_DOWN" radiogroup="sort-options" tabstop="true" _label="~Top to bottom (sort rows)"/>
+ <radiobutton id="BTN_LEFT_RIGHT" radiogroup="sort-options" tabstop="true" _label="L~eft to right (sort columns)"/>
+ </vbox>
+ </vbox>
+</tabpage>
diff --git a/toolkit/workben/layout/sortdlg.cxx b/toolkit/workben/layout/sortdlg.cxx
new file mode 100644
index 000000000000..cc3aa08c105d
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.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.
+ *
+ ************************************************************************/
+
+#if !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#endif /*! TEST_LAYOUT */
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+#include "tpsort.hxx"
+#include "sortdlg.hxx"
+#include "scresid.hxx"
+#include "sortdlg.hrc"
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-pre.hxx>
+#endif
+
+ScSortDlg::ScSortDlg( Window* pParent,
+ const SfxItemSet* pArgSet ) :
+ SfxTabDialog( pParent,
+ ScResId( RID_SCDLG_SORT ),
+ pArgSet ),
+ bIsHeaders ( FALSE ),
+ bIsByRows ( FALSE )
+
+{
+#if LAYOUT_SFX_TABDIALOG_BROKEN
+ AddTabPage( TP_FIELDS, ScTabPageSortFields::Create, 0 );
+ AddTabPage( TP_OPTIONS, ScTabPageSortOptions::Create, 0 );
+#else /* !LAYOUT_SFX_TABDIALOG_BROKEN */
+ String fields = rtl::OUString::createFromAscii ("fields");
+ AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND);
+ String options = rtl::OUString::createFromAscii ("options");
+ AddTabPage( TP_OPTIONS, options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND);
+#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */
+ FreeResource();
+}
+
+__EXPORT ScSortDlg::~ScSortDlg()
+{
+}
+
diff --git a/toolkit/workben/layout/sortdlg.hrc b/toolkit/workben/layout/sortdlg.hrc
new file mode 100644
index 000000000000..0cecd39e8541
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.hrc
@@ -0,0 +1,83 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#include "sc.hrc" // -> RID_SCDLG_SORT
+ // -> RID_SCPAGE_SORT_FIELDS
+ // -> RID_SCPAGE_SORT_OPTIONS
+ // -> SCSTR_NONAME
+ // -> SCSTR_UNDEFINED
+ // -> SCSTR_FIELD
+
+/*
+#define RID_SCDLG_SORT 256
+#define RID_SCPAGE_SORT_FIELDS 257
+#define RID_SCPAGE_SORT_OPTIONS 258
+*/
+
+#define TP_FIELDS 1
+#define TP_OPTIONS 2
+
+// TP_SORT_FIELDS:
+#define FL_SORT1 1
+#define FL_SORT2 2
+#define FL_SORT3 3
+#define LB_SORT1 4
+#define LB_SORT2 5
+#define LB_SORT3 6
+#define BTN_UP1 7
+#define BTN_UP2 8
+#define BTN_UP3 9
+#define BTN_DOWN1 10
+#define BTN_DOWN2 11
+#define BTN_DOWN3 12
+
+// TP_SORT_OPTIONS:
+#define FL_DIRECTION 1
+#define LB_SORT_USER 2
+#define LB_OUTAREA 3
+#define ED_OUTAREA 4
+//#define FT_AREA_LABEL 5
+//#define FT_AREA 6
+#define BTN_SORT_USER 7
+#define BTN_CASESENSITIVE 8
+#define BTN_LABEL 9
+#define BTN_FORMATS 10
+#define BTN_COPYRESULT 11
+#define BTN_TOP_DOWN 12
+#define BTN_LEFT_RIGHT 13
+#define STR_COL_LABEL 14
+#define STR_ROW_LABEL 15
+#define FT_LANGUAGE 16
+#define LB_LANGUAGE 17
+#define FT_ALGORITHM 18
+#define LB_ALGORITHM 19
+#define BTN_NATURALSORT 20
+
+
+
+
diff --git a/toolkit/workben/layout/sortdlg.hxx b/toolkit/workben/layout/sortdlg.hxx
new file mode 100644
index 000000000000..e5b3b289434d
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.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 SC_SORTDLG_HXX
+#define SC_SORTDLG_HXX
+
+#include <sfx2/tabdlg.hxx>
+
+#if TEST_LAYOUT
+#define LAYOUT_SFX_TABDIALOG_BROKEN 0
+#else /* !TEST_LAYOUT */
+#ifndef LAYOUT_SFX_TABDIALOG_BROKEN
+#define LAYOUT_SFX_TABDIALOG_BROKEN 1
+#endif /* !LAYOUT_SFX_TABDIALOG_BROKEN */
+#endif /* !TEST_LAYOUT */
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+#endif
+
+class ScSortDlg : public SfxTabDialog
+{
+public:
+ ScSortDlg( Window* pParent,
+ const SfxItemSet* pArgSet );
+ ~ScSortDlg();
+
+ void SetHeaders( BOOL bHeaders );
+ void SetByRows ( BOOL bByRows );
+ BOOL GetHeaders() const;
+ BOOL GetByRows () const;
+
+
+private:
+ BOOL bIsHeaders;
+ BOOL bIsByRows;
+};
+
+inline void ScSortDlg::SetHeaders( BOOL bHeaders ) { bIsHeaders = bHeaders; }
+inline void ScSortDlg::SetByRows ( BOOL bByRows ) { bIsByRows = bByRows; }
+inline BOOL ScSortDlg::GetHeaders() const { return bIsHeaders; }
+inline BOOL ScSortDlg::GetByRows () const { return bIsByRows; }
+
+#if !LAYOUT_SFX_TABDIALOG_BROKEN
+#include <layout/layout-post.hxx>
+#endif
+
+#endif // SC_SORTDLG_HXX
diff --git a/toolkit/workben/layout/sortdlg.src b/toolkit/workben/layout/sortdlg.src
new file mode 100644
index 000000000000..5e855962af96
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.src
@@ -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.
+ *
+ ************************************************************************/
+#include "sortdlg.hrc"
+TabPage RID_SCPAGE_SORT_FIELDS
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_SCPAGE_SORT_FIELDS ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ ListBox LB_SORT1
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 19 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP1
+ {
+ Pos = MAP_APPFONT ( 172 , 14 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Ascending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN1
+ {
+ Pos = MAP_APPFONT ( 172 , 28 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Descending" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT1
+ {
+ Pos = MAP_APPFONT ( 6 , 3 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Sort ~by" ;
+ };
+ ListBox LB_SORT2
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP2
+ {
+ Pos = MAP_APPFONT ( 172 , 55 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "A~scending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN2
+ {
+ Pos = MAP_APPFONT ( 172 , 69 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "D~escending" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT2
+ {
+ Pos = MAP_APPFONT ( 6 , 44 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Then b~y" ;
+ };
+ ListBox LB_SORT3
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP3
+ {
+ Pos = MAP_APPFONT ( 172 , 96 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "As~cending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN3
+ {
+ Pos = MAP_APPFONT ( 172 , 110 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "Desce~nding" ;
+ TabStop = TRUE ;
+ };
+ FixedLine FL_SORT3
+ {
+ Pos = MAP_APPFONT ( 6 , 85 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "T~hen by" ;
+ };
+};
+TabPage RID_SCPAGE_SORT_OPTIONS
+{
+ Hide = TRUE ;
+ SVLook = TRUE ;
+ HelpId = HID_SCPAGE_SORT_OPTIONS ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 260 , 185 ) ;
+ CheckBox BTN_CASESENSITIVE
+ {
+ Pos = MAP_APPFONT ( 12 , 6 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Case ~sensitive" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_LABEL
+ {
+ Pos = MAP_APPFONT ( 12 , 20 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ TabStop = TRUE ;
+ };
+ String STR_COL_LABEL
+ {
+ Text [ en-US ] = "Range contains column la~bels" ;
+ };
+ String STR_ROW_LABEL
+ {
+ Text [ en-US ] = "Range contains ~row labels" ;
+ };
+ CheckBox BTN_FORMATS
+ {
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Include ~formats" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_NATURALSORT
+ {
+ Pos = MAP_APPFONT ( 12 , 48 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ de ] = "Enable ~natural sort" ;
+ Text [ en-US ] = "Enable ~natural sort" ;
+ Text [ cs ] = "Aktivovat přirozené třídění" ;
+ Text [ sk ] = "Aktivovať prirodzené triedenie" ;
+ TabStop = TRUE ;
+ Text [ x-comment ] = " " ;
+ };
+ CheckBox BTN_COPYRESULT
+ {
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "~Copy sort results to:" ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_OUTAREA
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 20 , 73 ) ;
+ Size = MAP_APPFONT ( 93 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ Edit ED_OUTAREA
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 119 , 73 ) ;
+ Size = MAP_APPFONT ( 132 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_SORT_USER
+ {
+ Pos = MAP_APPFONT ( 12 , 89 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Custom sort ~order" ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_SORT_USER
+ {
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 20 , 100 ) ;
+ Size = MAP_APPFONT ( 231 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedText FT_LANGUAGE
+ {
+ Pos = MAP_APPFONT ( 12 , 118 ) ;
+ Size = MAP_APPFONT ( 101 , 8 ) ;
+ Text [ en-US ] = "~Language";
+ };
+ ListBox LB_LANGUAGE
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 129 ) ;
+ Size = MAP_APPFONT ( 101 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ Sort = TRUE ;
+ };
+ FixedText FT_ALGORITHM
+ {
+ Pos = MAP_APPFONT ( 119 , 118 ) ;
+ Size = MAP_APPFONT ( 132 , 8 ) ;
+ Text [ en-US ] = "O~ptions";
+ };
+ ListBox LB_ALGORITHM
+ {
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 119 , 129 ) ;
+ Size = MAP_APPFONT ( 132 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ FixedLine FL_DIRECTION
+ {
+ Pos = MAP_APPFONT ( 6 , 147 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Direction" ;
+ };
+ RadioButton BTN_TOP_DOWN
+ {
+ Pos = MAP_APPFONT ( 12 , 158 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "~Top to bottom (sort rows)" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_LEFT_RIGHT
+ {
+ Pos = MAP_APPFONT ( 12 , 172 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "L~eft to right (sort columns)" ;
+ TabStop = TRUE ;
+ };
+/*
+ FixedText FT_AREA_LABEL
+ {
+ Pos = MAP_APPFONT ( 6 , 171 ) ;
+ Size = MAP_APPFONT ( 248 , 8 ) ;
+ Text [ en-US ] = "Data area:" ;
+ };
+*/
+};
+TabDialog RID_SCDLG_SORT
+{
+ OutputSize = TRUE ;
+ SVLook = TRUE ;
+ Size = MAP_APPFONT ( 220 , 175 ) ;
+ Text [ en-US ] = "Sort" ;
+ Moveable = TRUE ;
+ Closeable = FALSE ;
+ TabControl 1
+ {
+ OutputSize = TRUE ;
+ Pos = MAP_APPFONT ( 0 , 0 ) ;
+ Size = MAP_APPFONT ( 210 , 170 ) ;
+ PageList =
+ {
+ PageItem
+ {
+ Identifier = TP_FIELDS ;
+ PageResID = TP_FIELDS ;
+ Text [ en-US ] = "Sort Criteria" ;
+ };
+ PageItem
+ {
+ Identifier = TP_OPTIONS ;
+ PageResID = TP_OPTIONS ;
+ Text [ en-US ] = "Options" ;
+ };
+ };
+ };
+ OKButton 1
+ {
+ Pos = MAP_APPFONT ( 3 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CancelButton 1
+ {
+ Pos = MAP_APPFONT ( 49 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ PushButton 1
+ {
+ Pos = MAP_APPFONT ( 137 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ HelpButton 1
+ {
+ Pos = MAP_APPFONT ( 94 , 157 ) ;
+ Size = MAP_APPFONT ( 40 , 12 ) ;
+ TabStop = TRUE ;
+ };
+};
+
+
diff --git a/toolkit/workben/layout/sortdlg.xml b/toolkit/workben/layout/sortdlg.xml
new file mode 100644
index 000000000000..ce45a60ff1ee
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<tabpage help-id="HID_SCPAGE_SORT_FIELDS" hide="true" id="RID_SCPAGE_SORT_FIELDS" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <fixedline id="FL_SORT1" text="Sort ~by"/>
+ <radiobutton id="BTN_UP1" tabstop="true" label="~Ascending"/>
+ <listbox has_border="true" dropdown="true" id="LB_SORT1" tabstop="true"/>
+ <radiobutton id="BTN_DOWN1" tabstop="true" label="~Descending"/>
+ <fixedline id="FL_SORT2" text="Then b~y"/>
+ <radiobutton id="BTN_UP2" tabstop="true" label="A~scending"/>
+ <listbox has_border="true" dropdown="true" id="LB_SORT2" tabstop="true"/>
+ <radiobutton id="BTN_DOWN2" tabstop="true" label="D~escending"/>
+ <fixedline id="FL_SORT3" text="T~hen by"/>
+ <radiobutton id="BTN_UP3" tabstop="true" label="As~cending"/>
+ <listbox has_border="true" dropdown="true" id="LB_SORT3" tabstop="true"/>
+ <radiobutton id="BTN_DOWN3" tabstop="true" label="Desce~nding"/>
+ </vbox>
+</tabpage>
+<tabpage help-id="HID_SCPAGE_SORT_OPTIONS" hide="true" id="RID_SCPAGE_SORT_OPTIONS" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <string id="STR_COL_LABEL" text="Range contains column la~bels"/>
+ <string id="STR_ROW_LABEL" text="Range contains ~row labels"/>
+ <vbox>
+ <checkbox id="BTN_CASESENSITIVE" tabstop="true" label="Case ~sensitive"/>
+ <checkbox id="BTN_LABEL" tabstop="true"/>
+ <checkbox id="BTN_FORMATS" tabstop="true" label="Include ~formats"/>
+ <checkbox id="BTN_NATURALSORT" tabstop="true" label=" "/>
+ <checkbox id="BTN_COPYRESULT" tabstop="true" label="~Copy sort results to:"/>
+ <hbox>
+ <listbox has_border="true" dropdown="true" id="LB_OUTAREA" tabstop="true"/>
+ <edit has_border="true" disable="true" id="ED_OUTAREA" tabstop="true"/>
+ </hbox>
+ <checkbox id="BTN_SORT_USER" tabstop="true" label="Custom sort ~order"/>
+ <listbox has_border="true" disable="true" dropdown="true" id="LB_SORT_USER" tabstop="true"/>
+ <hbox>
+ <fixedtext id="FT_LANGUAGE" label="~Language"/>
+ <fixedtext id="FT_ALGORITHM" label="O~ptions"/>
+ </hbox>
+ <hbox>
+ <listbox has_border="true" dropdown="true" id="LB_LANGUAGE" sort="true" tabstop="true"/>
+ <listbox has_border="true" dropdown="true" id="LB_ALGORITHM" tabstop="true"/>
+ </hbox>
+ <fixedline id="FL_DIRECTION" text="Direction"/>
+ <radiobutton id="BTN_TOP_DOWN" tabstop="true" label="~Top to bottom (sort rows)"/>
+ <radiobutton id="BTN_LEFT_RIGHT" tabstop="true" label="L~eft to right (sort columns)"/>
+ </vbox>
+</tabpage>
+<tabdialog closeable="false" moveable="true" output-size="true" id="RID_SCDLG_SORT" sv-look="true" text="Sort" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <tabcontrol output-size="true" id="1">
+ <pagelist>
+ <pageitem identifier="TP_FIELDS" page-res-id="TP_FIELDS" text="Sort Criteria"/>
+ <pageitem identifier="TP_OPTIONS" page-res-id="TP_OPTIONS" text="Options"/>
+ </pagelist>
+ </tabcontrol>
+ <hbox>
+ <okbutton defbutton="true" id="1" tabstop="true"/>
+ <cancelbutton id="1" tabstop="true"/>
+ <helpbutton id="1" tabstop="true"/>
+ <pushbutton id="1" tabstop="true"/>
+ </hbox>
+ </vbox>
+</tabdialog>
diff --git a/toolkit/workben/layout/splitter.xml b/toolkit/workben/layout/splitter.xml
new file mode 100644
index 000000000000..634ad829b001
--- /dev/null
+++ b/toolkit/workben/layout/splitter.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Splitter Test" optimumsize="true" has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <hsplitter>
+ <pushbutton label="Left" />
+ <pushbutton label="Right" />
+ </hsplitter>
+ <okbutton cnt:expand="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/string-input.xml b/toolkit/workben/layout/string-input.xml
new file mode 100644
index 000000000000..b1aed5197c17
--- /dev/null
+++ b/toolkit/workben/layout/string-input.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated XML files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog sizeable="true" closeable="false" moveable="true" output-size="true" id="RID_SCDLG_STRINPUT" sv-look="true" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container" title="Insert String">
+ <vbox spacing="5" border="5">
+ <fixedtext id="FT_LABEL" label="FT-LABEL"/>
+ <edit has_border="true" id="ED_INPUT" tabstop="true"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <okbutton defbutton="true" id="BTN_OK" tabstop="true"/>
+ <cancelbutton id="BTN_CANCEL" tabstop="true"/>
+ <helpbutton id="BTN_HELP" tabstop="true"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/tab-dialog.xml b/toolkit/workben/layout/tab-dialog.xml
new file mode 100644
index 000000000000..da75f03e9df5
--- /dev/null
+++ b/toolkit/workben/layout/tab-dialog.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ _title="layout::TabDialog" optimumsize="true"
+ id="tab-dialog"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox spacing="5" border="5">
+ <tabcontrol id="ID_TABCONTROL"/>
+ <dialogbuttonhbox border="5" spacing="5" cnt:expand="false">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_OK" show="false"/>
+ <pushbutton id="BTN_USER" _label="&lt;User&gt;" show="false"/>
+ <cancelbutton id="BTN_CANCEL" show="false"/>
+ <helpbutton id="BTN_HELP" show="false"/>
+ <resetbutton id="BTN_RESET" show="false"/>
+ <pushbutton id="BTN_BASEFMT" _label="&lt;Base Format&gt;" show="false"/>
+ </dialogbuttonhbox>
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/tabcontrol.xml b/toolkit/workben/layout/tabcontrol.xml
new file mode 100644
index 000000000000..2986f1f9e0d9
--- /dev/null
+++ b/toolkit/workben/layout/tabcontrol.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="TabControl Test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <vbox>
+ <tabcontrol>
+ <pushbutton label="Child 1" cnt:title="Page 1" />
+ <edit has_border="true" text="Child 2" cnt:title="Page 2" />
+ <vbox cnt:title="Page 3">
+ <pushbutton label="Child 3"/>
+ <edit has_border="true" text="Child 4" />
+ </vbox>
+ </tabcontrol>
+ <okbutton cnt:expand="false" />
+ </vbox>
+</dialog>
diff --git a/toolkit/workben/layout/table.xml b/toolkit/workben/layout/table.xml
new file mode 100644
index 000000000000..673bd85ddab3
--- /dev/null
+++ b/toolkit/workben/layout/table.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Table Test" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <table columns="3">
+ <!-- row 0 -->
+ <pushbutton cnt:x-expand="false" cnt:row-span="2" label="1,1" />
+ <pushbutton cnt:y-expand="false" label="1,2" />
+ <pushbutton cnt:y-expand="false" label="1,3" />
+ <!-- row 1 -->
+ <pushbutton cnt:col-span="2" label="2,1" />
+ </table>
+</dialog>
diff --git a/toolkit/workben/layout/test.cxx b/toolkit/workben/layout/test.cxx
new file mode 100644
index 000000000000..6a09518ebc4f
--- /dev/null
+++ b/toolkit/workben/layout/test.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.
+ *
+ ************************************************************************/
+
+#include <vcl/svapp.hxx>
+
+// This works and was used before for standalone test, not sure why
+// we'd want it.
+#define LAYOUT_WEAK 1
+#include "uno.hxx"
+
+#include <cstdio>
+#include <cstdlib>
+#include <sys/stat.h>
+
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <comphelper/processfactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <rtl/ustring.hxx>
+#include <ucbhelper/configurationkeys.hxx>
+#include <ucbhelper/contentbroker.hxx>
+
+#define SORT_DLG 1 /* requires sfx2, svx to be compiled */
+#if SORT_DLG
+#include "scitems.hxx"
+#include "uiitems.hxx"
+#endif /* SORT_DLG */
+
+#include "editor.hxx"
+
+#include "plugin.hxx"
+#undef _LAYOUT_POST_HXX
+
+#include "recover.hxx"
+#undef _LAYOUT_POST_HXX
+
+#if SORT_DLG
+#include "sortdlg.hxx"
+#undef _LAYOUT_POST_HXX
+#endif /* SORT_DLG */
+
+#include "wordcountdialog.hxx"
+#undef _LAYOUT_POST_HXX
+
+#include "zoom.hxx"
+#undef _LAYOUT_POST_HXX
+
+#include <layout/layout-pre.hxx>
+
+using namespace ::rtl;
+using namespace ::cppu;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+class LayoutTest : public Application
+{
+ Reference< XComponentContext > mxContext;
+ Reference< lang::XMultiServiceFactory > mxMSF;
+ OUString mInstallDir;
+ OUString mTestDialog;
+ bool mEditMode;
+ std::list< OUString > mFiles;
+
+public:
+ LayoutTest( char const* installDir );
+
+ void RunEditor();
+ void RunFiles();
+ void ExceptionalMain();
+ void Init();
+ void InitUCB();
+ void LoadFile( OUString const &aName );
+ void Main();
+ void ParseCommandLine();
+};
+
+static void usage()
+{
+ fprintf (stderr, "usage: test [--inst OOO_INSTALL_PREFIX] [DIALOG.XML]... | --test [DIALOG.XML]\n" );
+ exit( 2 );
+}
+
+static uno::Reference< lang::XSingleServiceFactory > get_factory( char const *service )
+{
+ uno::Reference< lang::XSingleServiceFactory > xFactory(
+ comphelper::createProcessComponent(
+ rtl::OUString::createFromAscii( service ) ), uno::UNO_QUERY );
+
+ if ( !xFactory.is() )
+ fprintf( stderr, "error loading: %s\n", service );
+ return xFactory;
+}
+
+#define GET_FACTORY(x) get_factory( #x )
+
+void LayoutTest::LoadFile( const OUString &aTestFile )
+{
+ fprintf( stderr, "TEST: layout instance\n" );
+
+ uno::Reference< lang::XSingleServiceFactory > xFactory
+ = GET_FACTORY( com.sun.star.awt.Layout );
+ if ( !xFactory.is() )
+ {
+ fprintf( stderr, "Layout engine not installed\n" );
+ throw uno::RuntimeException(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Layout engine not installed" ) ),
+ uno::Reference< uno::XInterface >() );
+ }
+ fprintf( stderr, "TEST: initing root\n" );
+
+ uno::Sequence< uno::Any > aParams( 1 );
+ aParams[0] <<= aTestFile;
+
+ uno::Reference< awt::XLayoutRoot > xRoot (
+ xFactory->createInstanceWithArguments( aParams ),
+ uno::UNO_QUERY );
+
+ fprintf( stderr, "TEST: file loaded\n" );
+}
+
+void LayoutTest::InitUCB()
+{
+ OUString aEmpty;
+ Sequence< Any > aArgs( 6 );
+ aArgs[0]
+ <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY1_LOCAL );
+ aArgs[1]
+ <<= OUString::createFromAscii( UCB_CONFIGURATION_KEY2_OFFICE );
+ aArgs[2] <<= OUString::createFromAscii( "PIPE" );
+ aArgs[3] <<= aEmpty;
+ aArgs[4] <<= OUString::createFromAscii( "PORTAL" );
+ aArgs[5] <<= aEmpty;
+
+ if ( !::ucbhelper::ContentBroker::initialize( mxMSF, aArgs ) )
+ {
+ fprintf( stderr, "Failed to init content broker\n" );
+ fprintf( stderr, "arg[0]: %s\n", UCB_CONFIGURATION_KEY1_LOCAL );
+ fprintf( stderr, "arg[1]: %s\n", UCB_CONFIGURATION_KEY2_OFFICE );
+ }
+}
+
+static void support_upstream_brand_prefix ()
+{
+ if ( char const* inst = getenv( "OOO_INSTALL_PREFIX" ) )
+ {
+ char const *brand_prefix = "/openoffice.org3";
+ OUString brand_dir = OUString::createFromAscii( inst )
+ + OUString::createFromAscii( brand_prefix );
+ struct stat stat_info;
+ if ( !stat ( OUSTRING_CSTR( brand_dir ), &stat_info ) )
+ {
+ OSL_TRACE( "Appending %s to OOO_INSTALL_PREFIX", brand_prefix );
+ setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( brand_dir ), 1 );
+ }
+ }
+}
+
+void LayoutTest::Init()
+{
+ ParseCommandLine();
+ setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( mInstallDir ), 0 );
+ support_upstream_brand_prefix ();
+ OSL_TRACE( "OOO_INSTALL_PREFIX=%s", getenv( "OOO_INSTALL_PREFIX" ) );
+
+ mxContext = defaultBootstrap_InitialComponentContext();
+ mxMSF = new UnoBootstrapLayout( Reference< lang::XMultiServiceFactory >( mxContext->getServiceManager(), UNO_QUERY ) );
+ ::comphelper::setProcessServiceFactory( mxMSF );
+ InitUCB();
+}
+
+void LayoutTest::ParseCommandLine()
+{
+ printf ("%s\n", __PRETTY_FUNCTION__);
+ for ( sal_uInt16 i = 0; i < GetCommandLineParamCount(); i++ )
+ {
+ OUString aParam = OUString( GetCommandLineParam( i ) );
+ if ( aParam.equalsAscii( "-h" ) || aParam.equalsAscii( "--help" ) )
+ usage();
+ if ( aParam.equalsAscii( "--inst" ) )
+ {
+ if ( i >= GetCommandLineParamCount() - 1)
+ usage();
+ mInstallDir = GetCommandLineParam( ++i );
+ setenv( "OOO_INSTALL_PREFIX", OUSTRING_CSTR( mInstallDir ), 1 );
+ }
+ else if ( aParam.equalsAscii( "--test" ) )
+ {
+ mTestDialog = OUString::createFromAscii( "zoom" );
+ if (i + 1 < GetCommandLineParamCount())
+ mTestDialog = GetCommandLineParam( ++i );
+ }
+ else if ( aParam.equalsAscii( "--editor" ) )
+ mEditMode = true;
+ else
+ mFiles.push_back( aParam );
+ }
+
+ if ( mFiles.size() <= 0 )
+ mFiles.push_back( OUString::createFromAscii( "layout.xml" ) );
+}
+
+void LayoutTest::RunEditor()
+{
+ OUString aFile;
+ if ( !mFiles.empty()
+ && mFiles.front().compareToAscii( "layout.xml" ) != 0 )
+ aFile = mFiles.front();
+ Editor editor( mxMSF, aFile );
+ editor.Show();
+ editor.Execute();
+}
+
+short RunDialog( Dialog& dialog )
+{
+ dialog.Show();
+ short result = dialog.Execute();
+ fprintf( stderr, "Done: dialog execute exited:%d\n", result);
+ return result;
+}
+
+#undef Dialog
+short RunDialog( ::Dialog& dialog )
+{
+ dialog.Show();
+ short result = dialog.Execute();
+ fprintf( stderr, "Done: dialog execute exited:%d\n", result);
+ return result;
+}
+
+#if SORT_DLG
+static void LoadSC()
+{
+ get_factory( "com.sun.star.comp.sfx2.DocumentTemplates" );
+ get_factory( "com.sun.star.comp.Calc.SpreadsheetDocument" );
+ GET_FACTORY( com.sun.star.i18n.Transliteration.l10n );
+}
+#endif /* SORT_DLG */
+
+void TestDialog( OUString const& name )
+{
+ if ( 0 )
+ ;
+ else if ( name.equalsAscii( "plugin" ) )
+ {
+ PluginDialog plugin ( 0 );
+ RunDialog( plugin );
+ }
+ else if ( name.equalsAscii( "query" ) )
+ {
+ QueryBox query ( 0, "Do you want to do?", "do");
+ RunDialog( query );
+ }
+ else if ( name.equalsAscii( "query-compat" ) )
+ {
+ QueryBox query ( 0,
+ WinBits( WB_YES_NO | WB_DEF_YES ),
+// WinBits( WB_ABORT_RETRY_IGNORE ),
+ OUString::createFromAscii ("Do you want to do?"));
+ RunDialog( query );
+ }
+ else if ( name.equalsAscii( "recover" ) )
+ {
+ SvxRecoverDialog recover ( 0 );
+ RunDialog( recover );
+ }
+#if SORT_DLG
+ else if ( name.equalsAscii( "sort" ) )
+ {
+ LoadSC();
+ ScSortDlg sort (0, 0);
+ RunDialog( sort );
+ }
+#endif /* SORT_DLG */
+ else if ( name.equalsAscii( "wordcount" ) )
+ {
+ SwWordCountDialog words ( 0 );
+ RunDialog( words );
+ }
+ else if ( name.equalsAscii( "zoom" ) )
+ {
+ SvxZoomDialog zoom( 0 );
+ RunDialog( zoom );
+ }
+}
+
+void LayoutTest::RunFiles()
+{
+ fprintf( stderr, "TEST: loading files\n" );
+ for ( std::list< OUString >::iterator i = mFiles.begin(); i != mFiles.end(); i++ )
+ LoadFile( *i );
+ fprintf( stderr, "TEST: executing\n" );
+ Execute();
+ fprintf( stderr, "TEST: done executing\n" );
+}
+
+void LayoutTest::ExceptionalMain()
+{
+ if ( mTestDialog.getLength() )
+ TestDialog( mTestDialog );
+ else if ( mEditMode )
+ RunEditor();
+ else
+ RunFiles();
+}
+
+void LayoutTest::Main()
+{
+ try
+ {
+ ExceptionalMain();
+ }
+ catch (xml::sax::SAXException & rExc)
+ {
+ OString aStr( OUStringToOString( rExc.Message,
+ RTL_TEXTENCODING_ASCII_US ) );
+ uno::Exception exc;
+ if (rExc.WrappedException >>= exc)
+ {
+ aStr += OString( " >>> " );
+ aStr += OUStringToOString( exc.Message, RTL_TEXTENCODING_ASCII_US );
+ }
+ fprintf (stderr, "Parsing error: '%s'\n", aStr.getStr());
+ OSL_ENSURE( 0, aStr.getStr() );
+ }
+ catch ( uno::Exception & rExc )
+ {
+ OString aStr( OUStringToOString( rExc.Message,
+ RTL_TEXTENCODING_ASCII_US ) );
+ fprintf (stderr, "UNO error: '%s'\n", aStr.getStr());
+ OSL_ENSURE( 0, aStr.getStr() );
+ }
+
+ Reference< lang::XComponent > xComp( mxContext, UNO_QUERY );
+ if ( xComp.is() )
+ xComp->dispose();
+}
+
+LayoutTest::LayoutTest( char const* installDir )
+ : mInstallDir( OUString::createFromAscii ( installDir ) )
+{
+}
+
+LayoutTest layout_test( "/usr/local/lib/ooo" );
diff --git a/toolkit/workben/layout/test.xml b/toolkit/workben/layout/test.xml
new file mode 100644
index 000000000000..d0b4f9062912
--- /dev/null
+++ b/toolkit/workben/layout/test.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<dialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ title="Interactable Containers" optimumsize="true"
+ has_border="true" sizeable="true" moveable="true">
+ <tabcontrol>
+ <tabpage cnt:title="Page">
+ <pushbutton label="Test" />
+ </tabpage>
+ </tabcontrol>
+</dialog>
diff --git a/toolkit/workben/layout/testrc.in b/toolkit/workben/layout/testrc.in
new file mode 100644
index 000000000000..00ae5eb3cd5e
--- /dev/null
+++ b/toolkit/workben/layout/testrc.in
@@ -0,0 +1,12 @@
+OOO_INSTALL_PREFIX_URL=file://${OOO_INSTALL_PREFIX}
+OOO_BASIS_URL=${OOO_INSTALL_PREFIX_URL}/basis-link
+OOO_BASIS_BIN_URL=${OOO_BASIS_URL}/program
+OOO_URE_URL=${OOO_BASIS_URL}/ure-link
+#
+#CFG_INIFILE=${OOO_BASIS_BIN_URL}/configmgrrc
+#BaseInstallation=${OOO_BASIS_URL}
+BRAND_BASE_DIR=${OOO_INSTALL_PREFIX_URL}
+OOO_BASE_DIR=${OOO_BASIS_URL}
+#
+UNO_TYPES=${OOO_URE_URL}/share/misc/types.rdb ${OOO_BASIS_BIN_URL}/offapi.rdb
+UNO_SERVICES=${OOO_URE_URL}/share/misc/services.rdb ${OOO_BASIS_BIN_URL}/services.rdb
diff --git a/toolkit/workben/layout/tpsort.cxx b/toolkit/workben/layout/tpsort.cxx
new file mode 100644
index 000000000000..949f3b777a71
--- /dev/null
+++ b/toolkit/workben/layout/tpsort.cxx
@@ -0,0 +1,1105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#endif /* !TEST_LAYOUT */
+
+#undef SC_DLLIMPLEMENTATION
+
+
+
+#include <vcl/msgbox.hxx>
+#include <i18npool/mslangid.hxx>
+#include <svtools/collatorres.hxx>
+#include <unotools/collatorwrapper.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include "scitems.hxx"
+#include "uiitems.hxx"
+#include "viewdata.hxx"
+#include "document.hxx"
+#include "global.hxx"
+#include "dbcolect.hxx"
+#include "userlist.hxx"
+#include "rangeutl.hxx"
+#include "scresid.hxx"
+#include "sc.hrc" // -> Slot IDs
+#include "globstr.hrc"
+
+#include "sortdlg.hxx"
+#include "sortdlg.hrc"
+
+#define _TPSORT_CXX
+#include "tpsort.hxx"
+#undef _TPSORT_CXX
+
+using namespace com::sun::star;
+
+// STATIC DATA -----------------------------------------------------------
+
+static USHORT pSortRanges[] =
+{
+ SID_SORT,
+ SID_SORT,
+ 0
+};
+
+// -----------------------------------------------------------------------
+
+/*
+ * Da sich Einstellungen auf der zweiten TabPage (Optionen) auf
+ * die erste TabPage auswirken, muss es die Moeglichkeit geben,
+ * dies der jeweils anderen Seite mitzuteilen.
+ *
+ * Im Moment wird dieses Problem ueber zwei Datenmember des TabDialoges
+ * geloest. Wird eine Seite Aktiviert/Deaktiviert, so gleicht sie diese
+ * Datenmember mit dem eigenen Zustand ab (->Activate()/Deactivate()).
+ *
+ * 31.01.95:
+ * Die Klasse SfxTabPage bietet mittlerweile ein Verfahren an:
+ *
+ * virtual BOOL HasExchangeSupport() const; -> return TRUE;
+ * virtual void ActivatePage(const SfxItemSet &);
+ * virtual int DeactivatePage(SfxItemSet * = 0);
+ *
+ * muss noch geaendert werden!
+ */
+
+//========================================================================
+//========================================================================
+// Sortierkriterien-Tabpage:
+
+ScTabPageSortFields::ScTabPageSortFields( Window* pParent,
+ const SfxItemSet& rArgSet )
+
+ : SfxTabPage ( pParent,
+ ScResId( RID_SCPAGE_SORT_FIELDS ),
+ rArgSet ),
+ //
+ aFlSort1 ( this, ScResId( FL_SORT1 ) ),
+ aLbSort1 ( this, ScResId( LB_SORT1 ) ),
+ aBtnUp1 ( this, ScResId( BTN_UP1 ) ),
+ aBtnDown1 ( this, ScResId( BTN_DOWN1 ) ),
+ //
+ aFlSort2 ( this, ScResId( FL_SORT2 ) ),
+ aLbSort2 ( this, ScResId( LB_SORT2 ) ),
+ aBtnUp2 ( this, ScResId( BTN_UP2 ) ),
+ aBtnDown2 ( this, ScResId( BTN_DOWN2 ) ),
+ //
+ aFlSort3 ( this, ScResId( FL_SORT3 ) ),
+ aLbSort3 ( this, ScResId( LB_SORT3 ) ),
+ aBtnUp3 ( this, ScResId( BTN_UP3 ) ),
+ aBtnDown3 ( this, ScResId( BTN_DOWN3 ) ),
+
+ aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ),
+ aStrColumn ( ScResId( SCSTR_COLUMN ) ),
+ aStrRow ( ScResId( SCSTR_ROW ) ),
+ //
+#if !TEST_LAYOUT
+ nWhichSort ( rArgSet.GetPool()->GetWhich( SID_SORT ) ),
+#else /* TEST_LAYOUT */
+ nWhichSort ( 0 ),
+#endif /* TEST_LAYOUT */
+ pDlg ( (ScSortDlg*)(GetParent()->GetParent()) ),
+ pViewData ( NULL ),
+#if !TEST_LAYOUT
+ rSortData ( ((const ScSortItem&)
+ rArgSet.Get( nWhichSort )).
+ GetSortData() ),
+#else /* TEST_LAYOUT */
+ rSortData ( *new ScSortParam() ),
+#endif /* TEST_LAYOUT */
+ nFieldCount ( 0 ),
+ bHasHeader ( FALSE ),
+ bSortByRows ( FALSE )
+{
+ Init();
+ FreeResource();
+ SetExchangeSupport();
+}
+
+// -----------------------------------------------------------------------
+
+__EXPORT ScTabPageSortFields::~ScTabPageSortFields()
+{
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::Init()
+{
+#if !TEST_LAYOUT
+ const ScSortItem& rSortItem = (const ScSortItem&)
+ GetItemSet().Get( nWhichSort );
+
+ pViewData = rSortItem.GetViewData();
+
+ DBG_ASSERT( pViewData, "ViewData not found!" );
+#endif /* !TEST_LAYOUT */
+
+ nFieldArr[0] = 0;
+ nFirstCol = 0;
+ nFirstRow = 0;
+
+ aLbSort1.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+ aLbSort2.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+ aLbSort3.SetSelectHdl( LINK( this, ScTabPageSortFields, SelectHdl ) );
+ aLbSort1.Clear();
+ aLbSort2.Clear();
+ aLbSort3.Clear();
+
+ aSortLbArr[0] = &aLbSort1;
+ aSortLbArr[1] = &aLbSort2;
+ aSortLbArr[2] = &aLbSort3;
+ aDirBtnArr[0][0] = &aBtnUp1;
+ aDirBtnArr[0][1] = &aBtnDown1;
+ aDirBtnArr[1][0] = &aBtnUp2;
+ aDirBtnArr[1][1] = &aBtnDown2;
+ aDirBtnArr[2][0] = &aBtnUp3;
+ aDirBtnArr[2][1] = &aBtnDown3;
+ aFlArr[0] = &aFlSort1;
+ aFlArr[1] = &aFlSort2;
+ aFlArr[2] = &aFlSort3;
+}
+
+//------------------------------------------------------------------------
+
+USHORT* __EXPORT ScTabPageSortFields::GetRanges()
+{
+ return pSortRanges;
+}
+
+// -----------------------------------------------------------------------
+
+SfxTabPage* __EXPORT ScTabPageSortFields::Create( Window* pParent,
+ const SfxItemSet& rArgSet )
+{
+ return ( new ScTabPageSortFields( pParent, rArgSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+void __EXPORT ScTabPageSortFields::Reset( const SfxItemSet& /* rArgSet */ )
+{
+ bSortByRows = rSortData.bByRow;
+ bHasHeader = rSortData.bHasHeader;
+
+ if ( aLbSort1.GetEntryCount() == 0 )
+ FillFieldLists();
+
+ // Selektieren der ListBoxen:
+
+ if ( rSortData.bDoSort[0] )
+ {
+ for ( USHORT i=0; i<3; i++ )
+ {
+ if ( rSortData.bDoSort[i] )
+ {
+ aSortLbArr[i]->SelectEntryPos(
+ GetFieldSelPos( rSortData.nField[i] ) );
+
+ (rSortData.bAscending[i])
+ ? aDirBtnArr[i][0]->Check() // Up
+ : aDirBtnArr[i][1]->Check(); // Down
+ }
+ else
+ {
+ aSortLbArr[i]->SelectEntryPos( 0 ); // "keiner" selektieren
+ aDirBtnArr[i][0]->Check(); // Up
+ }
+ }
+
+ EnableField( 1 );
+ EnableField( 2 );
+ EnableField( 3 );
+ if ( aLbSort1.GetSelectEntryPos() == 0 )
+ DisableField( 2 );
+ if ( aLbSort2.GetSelectEntryPos() == 0 )
+ DisableField( 3 );
+ }
+ else
+ {
+ aLbSort1.SelectEntryPos( 1 );
+ aLbSort2.SelectEntryPos( 0 );
+ aLbSort3.SelectEntryPos( 0 );
+ aBtnUp1.Check();
+ aBtnUp2.Check();
+ aBtnUp3.Check();
+ EnableField ( 1 );
+ EnableField ( 2 );
+ DisableField( 3 );
+ }
+
+ if ( pDlg )
+ {
+ pDlg->SetByRows ( bSortByRows );
+ pDlg->SetHeaders( bHasHeader );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL __EXPORT ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet )
+{
+ ScSortParam theSortData = rSortData;
+ if (pDlg)
+ {
+ const SfxItemSet* pExample = pDlg->GetExampleSet();
+ const SfxPoolItem* pItem;
+ if ( pExample && pExample->GetItemState( nWhichSort, TRUE, &pItem ) == SFX_ITEM_SET )
+ theSortData = ((const ScSortItem*)pItem)->GetSortData();
+ }
+
+ USHORT nSort1Pos = aLbSort1.GetSelectEntryPos();
+ USHORT nSort2Pos = aLbSort2.GetSelectEntryPos();
+ USHORT nSort3Pos = aLbSort3.GetSelectEntryPos();
+
+ DBG_ASSERT( (nSort1Pos <= SC_MAXFIELDS)
+ && (nSort2Pos <= SC_MAXFIELDS)
+ && (nSort3Pos <= SC_MAXFIELDS),
+ "Array-Range Fehler!" );
+
+ if ( nSort1Pos == LISTBOX_ENTRY_NOTFOUND ) nSort1Pos = 0;
+ if ( nSort2Pos == LISTBOX_ENTRY_NOTFOUND ) nSort2Pos = 0;
+ if ( nSort3Pos == LISTBOX_ENTRY_NOTFOUND ) nSort3Pos = 0;
+
+ if ( nSort1Pos > 0 )
+ {
+ theSortData.bDoSort[0] = (nSort1Pos > 0);
+ theSortData.bDoSort[1] = (nSort2Pos > 0);
+ theSortData.bDoSort[2] = (nSort3Pos > 0);
+
+ // wenn auf Optionen-Seite "OK" gewaehlt wurde und
+ // dabei die Sortierrichtung umgestellt wurde, so
+ // wird das erste Feld der jeweiligen Richtung als
+ // Sortierkriterium gewaehlt (steht in nFieldArr[0]):
+ if ( bSortByRows != pDlg->GetByRows() )
+ {
+ theSortData.nField[0] =
+ theSortData.nField[1] =
+ theSortData.nField[2] = ( bSortByRows ?
+ static_cast<SCCOLROW>(nFirstRow) :
+ static_cast<SCCOLROW>(nFirstCol) );
+ }
+ else
+ {
+ theSortData.nField[0] = nFieldArr[nSort1Pos];
+ theSortData.nField[1] = nFieldArr[nSort2Pos];
+ theSortData.nField[2] = nFieldArr[nSort3Pos];
+ }
+
+ theSortData.bAscending[0] = aBtnUp1.IsChecked();
+ theSortData.bAscending[1] = aBtnUp2.IsChecked();
+ theSortData.bAscending[2] = aBtnUp3.IsChecked();
+ // bHasHeader ist in ScTabPageSortOptions::FillItemSet, wo es hingehoert
+ }
+ else
+ {
+ theSortData.bDoSort[0] =
+ theSortData.bDoSort[1] =
+ theSortData.bDoSort[2] = FALSE;
+ }
+
+ rArgSet.Put( ScSortItem( SCITEM_SORTDATA, NULL, &theSortData ) );
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+// fuer Datenaustausch ohne Dialog-Umweg: (! noch zu tun !)
+// void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet )
+
+void __EXPORT ScTabPageSortFields::ActivatePage()
+{
+ if ( pDlg )
+ {
+ if ( bHasHeader != pDlg->GetHeaders()
+ || bSortByRows != pDlg->GetByRows() )
+ {
+ USHORT nCurSel1 = aLbSort1.GetSelectEntryPos();
+ USHORT nCurSel2 = aLbSort2.GetSelectEntryPos();
+ USHORT nCurSel3 = aLbSort3.GetSelectEntryPos();
+
+ bHasHeader = pDlg->GetHeaders();
+ bSortByRows = pDlg->GetByRows();
+ FillFieldLists();
+ aLbSort1.SelectEntryPos( nCurSel1 );
+ aLbSort2.SelectEntryPos( nCurSel2 );
+ aLbSort3.SelectEntryPos( nCurSel3 );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int __EXPORT ScTabPageSortFields::DeactivatePage( SfxItemSet* pSetP )
+{
+ if ( pDlg )
+ {
+ if ( bHasHeader != pDlg->GetHeaders() )
+ pDlg->SetHeaders( bHasHeader );
+
+ if ( bSortByRows != pDlg->GetByRows() )
+ pDlg->SetByRows( bSortByRows );
+ }
+
+ if ( pSetP )
+ FillItemSet( *pSetP );
+
+ return SfxTabPage::LEAVE_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::DisableField( USHORT nField )
+{
+ nField--;
+
+ if ( nField<=2 )
+ {
+ aSortLbArr[nField] ->Disable();
+ aDirBtnArr[nField][0]->Disable();
+ aDirBtnArr[nField][1]->Disable();
+ aFlArr[nField] ->Disable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::EnableField( USHORT nField )
+{
+ nField--;
+
+ if ( nField<=2 )
+ {
+ aSortLbArr[nField] ->Enable();
+ aDirBtnArr[nField][0]->Enable();
+ aDirBtnArr[nField][1]->Enable();
+ aFlArr[nField] ->Enable();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortFields::FillFieldLists()
+{
+ if ( pViewData )
+ {
+ ScDocument* pDoc = pViewData->GetDocument();
+
+ if ( pDoc )
+ {
+ aLbSort1.Clear();
+ aLbSort2.Clear();
+ aLbSort3.Clear();
+ aLbSort1.InsertEntry( aStrUndefined, 0 );
+ aLbSort2.InsertEntry( aStrUndefined, 0 );
+ aLbSort3.InsertEntry( aStrUndefined, 0 );
+
+ SCCOL nFirstSortCol = rSortData.nCol1;
+ SCROW nFirstSortRow = rSortData.nRow1;
+ SCTAB nTab = pViewData->GetTabNo();
+ USHORT i = 1;
+
+ if ( bSortByRows )
+ {
+ String aFieldName;
+ SCCOL nMaxCol = rSortData.nCol2;
+ SCCOL col;
+
+ for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
+ {
+ pDoc->GetString( col, nFirstSortRow, nTab, aFieldName );
+ if ( !bHasHeader || (aFieldName.Len() == 0) )
+ {
+ aFieldName = aStrColumn;
+ aFieldName += ' ';
+ aFieldName += ColToAlpha( col );
+ }
+ nFieldArr[i] = col;
+ aLbSort1.InsertEntry( aFieldName, i );
+ aLbSort2.InsertEntry( aFieldName, i );
+ aLbSort3.InsertEntry( aFieldName, i );
+ i++;
+ }
+ }
+ else
+ {
+ String aFieldName;
+ SCROW nMaxRow = rSortData.nRow2;
+ SCROW row;
+
+ for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS; row++ )
+ {
+ pDoc->GetString( nFirstSortCol, row, nTab, aFieldName );
+ if ( !bHasHeader || (aFieldName.Len() == 0) )
+ {
+ aFieldName = aStrRow;
+ aFieldName += ' ';
+ aFieldName += String::CreateFromInt32( row+1 );
+ }
+ nFieldArr[i] = row;
+ aLbSort1.InsertEntry( aFieldName, i );
+ aLbSort2.InsertEntry( aFieldName, i );
+ aLbSort3.InsertEntry( aFieldName, i );
+ i++;
+ }
+ }
+ nFieldCount = i;
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+
+USHORT ScTabPageSortFields::GetFieldSelPos( SCCOLROW nField )
+{
+ USHORT nFieldPos = 0;
+ BOOL bFound = FALSE;
+
+ for ( USHORT n=1; n<nFieldCount && !bFound; n++ )
+ {
+ if ( nFieldArr[n] == nField )
+ {
+ nFieldPos = n;
+ bFound = TRUE;
+ }
+ }
+
+ return nFieldPos;
+}
+
+// -----------------------------------------------------------------------
+// Handler:
+//---------
+
+IMPL_LINK( ScTabPageSortFields, SelectHdl, ListBox *, pLb )
+{
+ String aSelEntry = pLb->GetSelectEntry();
+
+ if ( pLb == &aLbSort1 )
+ {
+ if ( aSelEntry == aStrUndefined )
+ {
+ aLbSort2.SelectEntryPos( 0 );
+ aLbSort3.SelectEntryPos( 0 );
+
+ if ( aFlSort2.IsEnabled() )
+ DisableField( 2 );
+
+ if ( aFlSort3.IsEnabled() )
+ DisableField( 3 );
+ }
+ else
+ {
+ if ( !aFlSort2.IsEnabled() )
+ EnableField( 2 );
+ }
+ }
+ else if ( pLb == &aLbSort2 )
+ {
+ if ( aSelEntry == aStrUndefined )
+ {
+ aLbSort3.SelectEntryPos( 0 );
+ if ( aFlSort3.IsEnabled() )
+ DisableField( 3 );
+ }
+ else
+ {
+ if ( !aFlSort3.IsEnabled() )
+ EnableField( 3 );
+ }
+ }
+ return 0;
+}
+
+//========================================================================
+// Sortieroptionen-Tabpage:
+//========================================================================
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef ScResId
+#define ScResId(x) #x
+#undef SfxTabPage
+#define SfxTabPage( parent, id, args ) SfxTabPage( parent, "sort-options.xml", id, &args )
+#endif /* ENABLE_LAYOUT */
+
+ScTabPageSortOptions::ScTabPageSortOptions( Window* pParent,
+ const SfxItemSet& rArgSet )
+
+ : SfxTabPage ( pParent,
+ ScResId( RID_SCPAGE_SORT_OPTIONS ),
+ rArgSet ),
+ //
+ aBtnCase ( this, ScResId( BTN_CASESENSITIVE ) ),
+ aBtnHeader ( this, ScResId( BTN_LABEL ) ),
+ aBtnFormats ( this, ScResId( BTN_FORMATS ) ),
+ aBtnCopyResult ( this, ScResId( BTN_COPYRESULT ) ),
+ aBtnNaturalSort ( this, ScResId( BTN_NATURALSORT ) ),
+ aLbOutPos ( this, ScResId( LB_OUTAREA ) ),
+ aEdOutPos ( this, ScResId( ED_OUTAREA ) ),
+ aBtnSortUser ( this, ScResId( BTN_SORT_USER ) ),
+ aLbSortUser ( this, ScResId( LB_SORT_USER ) ),
+ aFtLanguage ( this, ScResId( FT_LANGUAGE ) ),
+ aLbLanguage ( this, ScResId( LB_LANGUAGE ) ),
+ aFtAlgorithm ( this, ScResId( FT_ALGORITHM ) ),
+ aLbAlgorithm ( this, ScResId( LB_ALGORITHM ) ),
+ aLineDirection ( this, ScResId( FL_DIRECTION ) ),
+ aBtnTopDown ( this, ScResId( BTN_TOP_DOWN ) ),
+ aBtnLeftRight ( this, ScResId( BTN_LEFT_RIGHT ) ),
+// aFtAreaLabel ( this, ScResId( FT_AREA_LABEL ) ),
+// aFtArea ( this, ScResId( FT_AREA ) ),
+ //
+#if ENABLE_LAYOUT
+#undef this
+#undef ScResId
+#define ScResId(x) this, #x
+#endif /* ENABLE_LAYOUT */
+ aStrRowLabel ( ScResId( STR_ROW_LABEL ) ),
+ aStrColLabel ( ScResId( STR_COL_LABEL ) ),
+ aStrUndefined ( ScResId( SCSTR_UNDEFINED ) ),
+ aStrNoName ( ScGlobal::GetRscString(STR_DB_NONAME) ),
+ //
+#if !TEST_LAYOUT
+ nWhichSort ( rArgSet.GetPool()->GetWhich( SID_SORT ) ),
+ rSortData ( ((const ScSortItem&)
+ rArgSet.Get( nWhichSort )).GetSortData() ),
+#else /* TEST_LAYOUT */
+ nWhichSort ( 0 ),
+ rSortData ( *new ScSortParam() ),
+#endif /* TEST_LAYOUT */
+ pViewData ( NULL ),
+ pDoc ( NULL ),
+ pDlg ( (ScSortDlg*)(GetParent() ? GetParent()->GetParent() : 0 ) ),
+ pColRes ( NULL ),
+ pColWrap ( NULL )
+{
+#if TEST_LAYOUT
+ (void) rArgSet;
+#endif /* TEST_LAYOUT */
+ Init();
+ FreeResource();
+ SetExchangeSupport();
+}
+
+// -----------------------------------------------------------------------
+
+__EXPORT ScTabPageSortOptions::~ScTabPageSortOptions()
+{
+#if !TEST_LAYOUT
+ USHORT nEntries = aLbOutPos.GetEntryCount();
+
+ for ( USHORT i=1; i<nEntries; i++ )
+ delete (String*)aLbOutPos.GetEntryData( i );
+#endif /* !TEST_LAYOUT */
+
+ delete pColRes;
+ delete pColWrap; //! not if from document
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortOptions::Init()
+{
+// aStrAreaLabel = aFtAreaLabel.GetText();
+// aStrAreaLabel.Append( (sal_Unicode) ' ' );
+
+ // CollatorRessource has user-visible names for sort algorithms
+ pColRes = new CollatorRessource();
+
+ //! use CollatorWrapper from document?
+ pColWrap = new CollatorWrapper( comphelper::getProcessServiceFactory() );
+
+#if !TEST_LAYOUT
+ const ScSortItem& rSortItem = (const ScSortItem&)
+ GetItemSet().Get( nWhichSort );
+#endif /* !TEST_LAYOUT */
+
+ aLbOutPos.SetSelectHdl ( LINK( this, ScTabPageSortOptions, SelOutPosHdl ) );
+ aBtnCopyResult.SetClickHdl( LINK( this, ScTabPageSortOptions, EnableHdl ) );
+ aBtnSortUser.SetClickHdl ( LINK( this, ScTabPageSortOptions, EnableHdl ) );
+ aBtnTopDown.SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) );
+ aBtnLeftRight.SetClickHdl ( LINK( this, ScTabPageSortOptions, SortDirHdl ) );
+ aLbLanguage.SetSelectHdl ( LINK( this, ScTabPageSortOptions, FillAlgorHdl ) );
+
+#if !TEST_LAYOUT
+ pViewData = rSortItem.GetViewData();
+#endif /* TEST_LAYOUT */
+ pDoc = pViewData ? pViewData->GetDocument() : NULL;
+
+ DBG_ASSERT( pViewData, "ViewData not found! :-/" );
+
+#if !TEST_LAYOUT
+ if ( pViewData && pDoc )
+ {
+ String theArea;
+ ScDBCollection* pDBColl = pDoc->GetDBCollection();
+ String theDbArea;
+ String theDbName = aStrNoName;
+ const SCTAB nCurTab = pViewData->GetTabNo();
+ const ScAddress::Convention eConv = pDoc->GetAddressConvention();
+#endif /* !TEST_LAYOUT */
+
+ aLbOutPos.Clear();
+ aLbOutPos.InsertEntry( aStrUndefined, 0 );
+ aLbOutPos.Disable();
+
+#if !TEST_LAYOUT
+ ScAreaNameIterator aIter( pDoc );
+ String aName;
+ ScRange aRange;
+ String aRefStr;
+ while ( aIter.Next( aName, aRange ) )
+ {
+ USHORT nInsert = aLbOutPos.InsertEntry( aName );
+
+ aRange.aStart.Format( aRefStr, SCA_ABS_3D, pDoc, eConv );
+ aLbOutPos.SetEntryData( nInsert, new String( aRefStr ) );
+ }
+#endif /* !TEST_LAYOUT */
+
+ aLbOutPos.SelectEntryPos( 0 );
+ aEdOutPos.SetText( EMPTY_STRING );
+
+#if !TEST_LAYOUT
+ /*
+ * Ueberpruefen, ob es sich bei dem uebergebenen
+ * Bereich um einen Datenbankbereich handelt:
+ */
+
+ ScAddress aScAddress( rSortData.nCol1, rSortData.nRow1, nCurTab );
+ ScRange( aScAddress,
+ ScAddress( rSortData.nCol2, rSortData.nRow2, nCurTab )
+ ).Format( theArea, SCR_ABS, pDoc, eConv );
+
+ if ( pDBColl )
+ {
+ ScDBData* pDBData
+ = pDBColl->GetDBAtArea( nCurTab,
+ rSortData.nCol1, rSortData.nRow1,
+ rSortData.nCol2, rSortData.nRow2 );
+ if ( pDBData )
+ {
+ pDBData->GetName( theDbName );
+ aBtnHeader.Check( pDBData->HasHeader() );
+ }
+ }
+
+ theArea.AppendAscii(RTL_CONSTASCII_STRINGPARAM(" ("));
+ theArea += theDbName;
+ theArea += ')';
+
+ //aFtArea.SetText( theArea );
+ //theArea.Insert( aStrAreaLabel, 0 );
+ //aFtAreaLabel.SetText( theArea );
+
+ aBtnHeader.SetText( aStrColLabel );
+ }
+#endif /* TEST_LAYOUT */
+
+ FillUserSortListBox();
+
+ // get available languages
+
+ aLbLanguage.SetLanguageList( LANG_LIST_ALL | LANG_LIST_ONLY_KNOWN, FALSE );
+ aLbLanguage.InsertLanguage( LANGUAGE_SYSTEM );
+}
+
+//------------------------------------------------------------------------
+
+USHORT* __EXPORT ScTabPageSortOptions::GetRanges()
+{
+ return pSortRanges;
+}
+
+// -----------------------------------------------------------------------
+
+#if ENABLE_LAYOUT
+#undef SfxTabPage
+#endif /* ENABLE_LAYOUT */
+SfxTabPage* __EXPORT ScTabPageSortOptions::Create(
+ Window* pParent,
+ const SfxItemSet& rArgSet )
+{
+ return ( new ScTabPageSortOptions( pParent, rArgSet ) );
+}
+
+// -----------------------------------------------------------------------
+
+void __EXPORT ScTabPageSortOptions::Reset( const SfxItemSet& /* rArgSet */ )
+{
+ if ( rSortData.bUserDef )
+ {
+ aBtnSortUser.Check( TRUE );
+ aLbSortUser.Enable();
+ aLbSortUser.SelectEntryPos( rSortData.nUserIndex );
+ }
+ else
+ {
+ aBtnSortUser.Check( FALSE );
+ aLbSortUser.Disable();
+ aLbSortUser.SelectEntryPos( 0 );
+ }
+
+ aBtnCase.Check ( rSortData.bCaseSens );
+ aBtnFormats.Check ( rSortData.bIncludePattern );
+ aBtnHeader.Check ( rSortData.bHasHeader );
+ aBtnNaturalSort.Check ( rSortData.bNaturalSort );
+
+ if ( rSortData.bByRow )
+ {
+ aBtnTopDown.Check();
+ aBtnHeader.SetText( aStrColLabel );
+ }
+ else
+ {
+ aBtnLeftRight.Check();
+ aBtnHeader.SetText( aStrRowLabel );
+ }
+
+ LanguageType eLang = MsLangId::convertLocaleToLanguage( rSortData.aCollatorLocale );
+ if ( eLang == LANGUAGE_DONTKNOW )
+ eLang = LANGUAGE_SYSTEM;
+ aLbLanguage.SelectLanguage( eLang );
+ FillAlgorHdl( &aLbLanguage ); // get algorithms, select default
+ if ( rSortData.aCollatorAlgorithm.Len() )
+ aLbAlgorithm.SelectEntry( pColRes->GetTranslation( rSortData.aCollatorAlgorithm ) );
+
+ if ( pDoc && !rSortData.bInplace )
+ {
+ String aStr;
+ USHORT nFormat = (rSortData.nDestTab != pViewData->GetTabNo())
+ ? SCR_ABS_3D
+ : SCR_ABS;
+
+ theOutPos.Set( rSortData.nDestCol,
+ rSortData.nDestRow,
+ rSortData.nDestTab );
+
+ theOutPos.Format( aStr, nFormat, pDoc, pDoc->GetAddressConvention() );
+ aBtnCopyResult.Check();
+ aLbOutPos.Enable();
+ aEdOutPos.Enable();
+ aEdOutPos.SetText( aStr );
+ EdOutPosModHdl( &aEdOutPos );
+ aEdOutPos.GrabFocus();
+ aEdOutPos.SetSelection( Selection( 0, SELECTION_MAX ) );
+ }
+ else
+ {
+ aBtnCopyResult.Check( FALSE );
+ aLbOutPos.Disable();
+ aEdOutPos.Disable();
+ aEdOutPos.SetText( EMPTY_STRING );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL __EXPORT ScTabPageSortOptions::FillItemSet( SfxItemSet& rArgSet )
+{
+ ScSortParam theSortData = rSortData;
+ if (pDlg)
+ {
+ const SfxItemSet* pExample = pDlg->GetExampleSet();
+ const SfxPoolItem* pItem;
+ if ( pExample && pExample->GetItemState( nWhichSort, TRUE, &pItem ) == SFX_ITEM_SET )
+ theSortData = ((const ScSortItem*)pItem)->GetSortData();
+ }
+
+ theSortData.bByRow = aBtnTopDown.IsChecked();
+ theSortData.bHasHeader = aBtnHeader.IsChecked();
+ theSortData.bCaseSens = aBtnCase.IsChecked();
+ theSortData.bNaturalSort = aBtnNaturalSort.IsChecked();
+ theSortData.bIncludePattern = aBtnFormats.IsChecked();
+ theSortData.bInplace = !aBtnCopyResult.IsChecked();
+ theSortData.nDestCol = theOutPos.Col();
+ theSortData.nDestRow = theOutPos.Row();
+ theSortData.nDestTab = theOutPos.Tab();
+ theSortData.bUserDef = aBtnSortUser.IsChecked();
+ theSortData.nUserIndex = (aBtnSortUser.IsChecked())
+ ? aLbSortUser.GetSelectEntryPos()
+ : 0;
+
+ // get locale
+ LanguageType eLang = aLbLanguage.GetSelectLanguage();
+ theSortData.aCollatorLocale = MsLangId::convertLanguageToLocale( eLang, false );
+
+ // get algorithm
+ String sAlg;
+ if ( eLang != LANGUAGE_SYSTEM )
+ {
+ uno::Sequence<rtl::OUString> aAlgos = pColWrap->listCollatorAlgorithms(
+ theSortData.aCollatorLocale );
+ USHORT nSel = aLbAlgorithm.GetSelectEntryPos();
+ if ( nSel < aAlgos.getLength() )
+ sAlg = aAlgos[nSel];
+ }
+ theSortData.aCollatorAlgorithm = sAlg;
+
+#if !TEST_LAYOUT
+ rArgSet.Put( ScSortItem( SCITEM_SORTDATA, &theSortData ) );
+#endif /* TEST_LAYOUT */
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+// fuer Datenaustausch ohne Dialog-Umweg: (! noch zu tun !)
+// void ScTabPageSortOptions::ActivatePage( const SfxItemSet& rSet )
+void __EXPORT ScTabPageSortOptions::ActivatePage()
+{
+ if ( pDlg )
+ {
+ if ( aBtnHeader.IsChecked() != pDlg->GetHeaders() )
+ {
+ aBtnHeader.Check( pDlg->GetHeaders() );
+ }
+
+ if ( aBtnTopDown.IsChecked() != pDlg->GetByRows() )
+ {
+ aBtnTopDown.Check( pDlg->GetByRows() );
+ aBtnLeftRight.Check( !pDlg->GetByRows() );
+ }
+
+ aBtnHeader.SetText( (pDlg->GetByRows())
+ ? aStrColLabel
+ : aStrRowLabel );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+int __EXPORT ScTabPageSortOptions::DeactivatePage( SfxItemSet* pSetP )
+{
+ BOOL bPosInputOk = TRUE;
+
+ if ( aBtnCopyResult.IsChecked() )
+ {
+ String thePosStr = aEdOutPos.GetText();
+ ScAddress thePos;
+ xub_StrLen nColonPos = thePosStr.Search( ':' );
+
+ if ( STRING_NOTFOUND != nColonPos )
+ thePosStr.Erase( nColonPos );
+
+ if ( pViewData )
+ {
+ // visible table is default for input without table
+ // must be changed to GetRefTabNo when sorting has RefInput!
+ thePos.SetTab( pViewData->GetTabNo() );
+ }
+
+ USHORT nResult = thePos.Parse( thePosStr, pDoc, pDoc->GetAddressConvention() );
+
+ bPosInputOk = ( SCA_VALID == (nResult & SCA_VALID) );
+
+ if ( !bPosInputOk )
+ {
+#if !ENABLE_LAYOUT
+ ErrorBox( this, WinBits( WB_OK | WB_DEF_OK ),
+ ScGlobal::GetRscString( STR_INVALID_TABREF )
+ ).Execute();
+#endif /* ENABLE_LAYOUT */
+ aEdOutPos.GrabFocus();
+ aEdOutPos.SetSelection( Selection( 0, SELECTION_MAX ) );
+ theOutPos.Set(0,0,0);
+ }
+ else
+ {
+ aEdOutPos.SetText( thePosStr );
+ theOutPos = thePos;
+ }
+ }
+
+ if ( pDlg && bPosInputOk )
+ {
+ pDlg->SetHeaders( aBtnHeader.IsChecked() );
+ pDlg->SetByRows ( aBtnTopDown.IsChecked() );
+ }
+
+ if ( pSetP && bPosInputOk )
+ FillItemSet( *pSetP );
+
+ return bPosInputOk ? SfxTabPage::LEAVE_PAGE : SfxTabPage::KEEP_PAGE;
+}
+
+// -----------------------------------------------------------------------
+
+void ScTabPageSortOptions::FillUserSortListBox()
+{
+ ScUserList* pUserLists = ScGlobal::GetUserList();
+
+ aLbSortUser.Clear();
+ if ( pUserLists )
+ {
+ USHORT nCount = pUserLists->GetCount();
+ if ( nCount > 0 )
+ for ( USHORT i=0; i<nCount; i++ )
+ aLbSortUser.InsertEntry( (*pUserLists)[i]->GetString() );
+ }
+}
+
+// -----------------------------------------------------------------------
+// Handler:
+
+IMPL_LINK( ScTabPageSortOptions, EnableHdl, CheckBox *, pBox )
+{
+ if ( pBox == &aBtnCopyResult )
+ {
+ if ( pBox->IsChecked() )
+ {
+ aLbOutPos.Enable();
+ aEdOutPos.Enable();
+ aEdOutPos.GrabFocus();
+ }
+ else
+ {
+ aLbOutPos.Disable();
+ aEdOutPos.Disable();
+ }
+ }
+ else if ( pBox == &aBtnSortUser )
+ {
+ if ( pBox->IsChecked() )
+ {
+ aLbSortUser.Enable();
+ aLbSortUser.GrabFocus();
+ }
+ else
+ aLbSortUser.Disable();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTabPageSortOptions, SelOutPosHdl, ListBox *, pLb )
+{
+ if ( pLb == &aLbOutPos )
+ {
+ String aString;
+ USHORT nSelPos = aLbOutPos.GetSelectEntryPos();
+
+ if ( nSelPos > 0 )
+ aString = *(String*)aLbOutPos.GetEntryData( nSelPos );
+
+ aEdOutPos.SetText( aString );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTabPageSortOptions, SortDirHdl, RadioButton *, pBtn )
+{
+ if ( pBtn == &aBtnTopDown )
+ {
+ aBtnHeader.SetText( aStrColLabel );
+ }
+ else if ( pBtn == &aBtnLeftRight )
+ {
+ aBtnHeader.SetText( aStrRowLabel );
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void __EXPORT ScTabPageSortOptions::EdOutPosModHdl( Edit* pEd )
+{
+ if ( pEd == &aEdOutPos )
+ {
+ String theCurPosStr = aEdOutPos.GetText();
+ USHORT nResult = ScAddress().Parse( theCurPosStr, pDoc, pDoc->GetAddressConvention() );
+
+ if ( SCA_VALID == (nResult & SCA_VALID) )
+ {
+ String* pStr = NULL;
+ BOOL bFound = FALSE;
+ USHORT i = 0;
+ USHORT nCount = aLbOutPos.GetEntryCount();
+
+ for ( i=2; i<nCount && !bFound; i++ )
+ {
+ pStr = (String*)aLbOutPos.GetEntryData( i );
+ bFound = (theCurPosStr == *pStr);
+ }
+
+ if ( bFound )
+ aLbOutPos.SelectEntryPos( --i );
+ else
+ aLbOutPos.SelectEntryPos( 0 );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( ScTabPageSortOptions, FillAlgorHdl, void *, EMPTYARG )
+{
+ aLbAlgorithm.SetUpdateMode( FALSE );
+ aLbAlgorithm.Clear();
+
+ LanguageType eLang = aLbLanguage.GetSelectLanguage();
+ if ( eLang == LANGUAGE_SYSTEM )
+ {
+ // for LANGUAGE_SYSTEM no algorithm can be selected because
+ // it wouldn't necessarily exist for other languages
+ // -> leave list box empty if LANGUAGE_SYSTEM is selected
+ aFtAlgorithm.Enable( FALSE ); // nothing to select
+ aLbAlgorithm.Enable( FALSE ); // nothing to select
+ }
+ else
+ {
+ lang::Locale aLocale( MsLangId::convertLanguageToLocale( eLang ));
+ uno::Sequence<rtl::OUString> aAlgos = pColWrap->listCollatorAlgorithms( aLocale );
+
+ long nCount = aAlgos.getLength();
+ const rtl::OUString* pArray = aAlgos.getConstArray();
+ for (long i=0; i<nCount; i++)
+ {
+ String sAlg = pArray[i];
+ String sUser = pColRes->GetTranslation( sAlg );
+ aLbAlgorithm.InsertEntry( sUser, LISTBOX_APPEND );
+ }
+ aLbAlgorithm.SelectEntryPos( 0 ); // first entry is default
+ aFtAlgorithm.Enable( nCount > 1 ); // enable only if there is a choice
+ aLbAlgorithm.Enable( nCount > 1 ); // enable only if there is a choice
+ }
+
+ aLbAlgorithm.SetUpdateMode( TRUE );
+ return 0;
+}
+
+
diff --git a/toolkit/workben/layout/tpsort.hxx b/toolkit/workben/layout/tpsort.hxx
new file mode 100644
index 000000000000..9cc851914fd5
--- /dev/null
+++ b/toolkit/workben/layout/tpsort.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef SC_TPSORT_HXX
+#define SC_TPSORT_HXX
+
+
+#include <sfx2/tabdlg.hxx>
+#include <vcl/edit.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/lstbox.hxx>
+#include <svtools/stdctrl.hxx>
+#include <svx/langbox.hxx>
+
+
+#include "global.hxx"
+#include "address.hxx"
+
+//------------------------------------------------------------------------
+
+// +1 because one field is reserved for the "- undefined -" entry
+#define SC_MAXFIELDS MAXCOLCOUNT+1
+
+class ScViewData;
+class ScSortDlg;
+struct ScSortParam;
+
+//========================================================================
+// Kriterien (Sort Criteria)
+
+class ScTabPageSortFields : public SfxTabPage
+{
+public:
+ ScTabPageSortFields( Window* pParent,
+ const SfxItemSet& rArgSet );
+ ~ScTabPageSortFields();
+
+ static SfxTabPage* Create ( Window* pParent,
+ const SfxItemSet& rArgSet );
+ static USHORT* GetRanges ();
+ virtual BOOL FillItemSet ( SfxItemSet& rArgSet );
+ virtual void Reset ( const SfxItemSet& rArgSet );
+
+protected:
+// fuer Datenaustausch (sollte noch umgestellt werden!)
+// virtual void ActivatePage ( const SfxItemSet& rSet );
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+ virtual void ActivatePage ();
+ virtual int DeactivatePage ( SfxItemSet* pSet = 0);
+
+private:
+ FixedLine aFlSort1;
+ ListBox aLbSort1;
+ RadioButton aBtnUp1;
+ RadioButton aBtnDown1;
+
+ FixedLine aFlSort2;
+ ListBox aLbSort2;
+ RadioButton aBtnUp2;
+ RadioButton aBtnDown2;
+
+ FixedLine aFlSort3;
+ ListBox aLbSort3;
+ RadioButton aBtnUp3;
+ RadioButton aBtnDown3;
+
+ String aStrUndefined;
+ String aStrColumn;
+ String aStrRow;
+
+ const USHORT nWhichSort;
+ ScSortDlg* pDlg;
+ ScViewData* pViewData;
+ const ScSortParam& rSortData;
+ SCCOLROW nFieldArr[SC_MAXFIELDS];
+ USHORT nFieldCount;
+ SCCOL nFirstCol;
+ SCROW nFirstRow;
+ BOOL bHasHeader;
+ BOOL bSortByRows;
+
+ ListBox* aSortLbArr[3];
+ RadioButton* aDirBtnArr[3][2];
+ FixedLine* aFlArr[3];
+
+#ifdef _TPSORT_CXX
+private:
+ void Init ();
+ void DisableField ( USHORT nField );
+ void EnableField ( USHORT nField );
+ void FillFieldLists ();
+ USHORT GetFieldSelPos ( SCCOLROW nField );
+
+ // Handler ------------------------
+ DECL_LINK( SelectHdl, ListBox * );
+#endif
+};
+
+//========================================================================
+// Sortieroptionen (Sort Options)
+
+class ScDocument;
+class ScRangeData;
+class CollatorRessource;
+class CollatorWrapper;
+
+#include <sfx2/layout.hxx>
+#include <layout/layout-pre.hxx>
+
+class ScTabPageSortOptions : public SfxTabPage
+{
+public:
+ ScTabPageSortOptions( Window* pParent,
+ const SfxItemSet& rArgSet );
+ ~ScTabPageSortOptions();
+
+#undef SfxTabPage
+#define SfxTabPage ::SfxTabPage
+ static SfxTabPage* Create ( Window* pParent,
+ const SfxItemSet& rArgSet );
+ static USHORT* GetRanges ();
+ virtual BOOL FillItemSet ( SfxItemSet& rArgSet );
+ virtual void Reset ( const SfxItemSet& rArgSet );
+
+protected:
+// fuer Datenaustausch (sollte noch umgestellt werden!)
+// virtual void ActivatePage ( const SfxItemSet& rSet );
+ using SfxTabPage::ActivatePage;
+ using SfxTabPage::DeactivatePage;
+ virtual void ActivatePage ();
+ virtual int DeactivatePage ( SfxItemSet* pSet = 0);
+
+private:
+
+ CheckBox aBtnCase;
+ CheckBox aBtnHeader;
+ CheckBox aBtnFormats;
+ CheckBox aBtnCopyResult;
+
+ CheckBox aBtnNaturalSort;
+ ListBox aLbOutPos;
+ Edit aEdOutPos;
+
+ CheckBox aBtnSortUser;
+ ListBox aLbSortUser;
+
+ FixedText aFtLanguage;
+ SvxLanguageBox aLbLanguage;
+ FixedText aFtAlgorithm;
+ ListBox aLbAlgorithm;
+
+ FixedLine aLineDirection;
+ RadioButton aBtnTopDown;
+ RadioButton aBtnLeftRight;
+
+// FixedText aFtAreaLabel;
+// FixedInfo aFtArea;
+ LocalizedString aStrRowLabel;
+ LocalizedString aStrColLabel;
+ LocalizedString aStrUndefined;
+ String aStrNoName;
+ String aStrAreaLabel;
+
+ const USHORT nWhichSort;
+ const ScSortParam& rSortData;
+ ScViewData* pViewData;
+ ScDocument* pDoc;
+ ScSortDlg* pDlg;
+ ScAddress theOutPos;
+
+ CollatorRessource* pColRes;
+ CollatorWrapper* pColWrap;
+
+#ifdef _TPSORT_CXX
+private:
+ void Init ();
+ void FillUserSortListBox ();
+ void FillOutPosList ();
+
+ // Handler ------------------------
+ DECL_LINK( EnableHdl, CheckBox * );
+ DECL_LINK( SelOutPosHdl, ListBox * );
+ void EdOutPosModHdl ( Edit* pEd );
+ DECL_LINK( SortDirHdl, RadioButton * );
+ DECL_LINK( FillAlgorHdl, void * );
+#endif
+};
+
+#include <layout/layout-post.hxx>
+
+#endif // SC_TPSORT_HXX
+
diff --git a/toolkit/workben/layout/un-test.sh b/toolkit/workben/layout/un-test.sh
new file mode 100644
index 000000000000..ef2518ffa1b8
--- /dev/null
+++ b/toolkit/workben/layout/un-test.sh
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+# un-test.sh: remove TEST_LAYOUT code from OO.o implementation
+
+sed -e 's!^#!@!' < $1\
+ -e 's!$! /*$*/!' \
+ -e 's!^@\(.*TEST_LAYOUT\)!#\1!'\
+ | tee i \
+ | cpp -traditional -C -CC -DNON_LAYOUT_COMPILE_FIXES=1 \
+ | grep -F '/*$*/' \
+ | sed -e 's! /\*\$\*/!!' \
+ -e 's!^@!#!' \
+ -e 's!#define 1 1!#define NON_LAYOUT_COMPILE_FIXES 1!'
+
diff --git a/toolkit/workben/layout/uno.hxx b/toolkit/workben/layout/uno.hxx
new file mode 100644
index 000000000000..89b1bedd4e11
--- /dev/null
+++ b/toolkit/workben/layout/uno.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 _LAYOUT_UNO_HXX
+#define _LAYOUT_UNO_HXX
+
+#include <cstdio>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <layout/core/root.hxx>
+#include <layout/core/factory.hxx>
+
+#if LAYOUT_WEAK
+#include <cppuhelper/implbase1.hxx>
+class UnoBootstrapLayout : public ::cppu::WeakImplHelper1< com::sun::star::lang::XMultiServiceFactory >
+#else /* !LAYOUT_WEAK */
+class UnoBootstrapLayout : public com::sun::star::lang::XMultiServiceFactory
+#endif /* LAYOUT_WEAK */
+{
+public:
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ UnoBootstrapLayout( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xMSF )
+ : mxMSF( xMSF )
+ {
+ fprintf( stderr, "UnoBootstrap Layout\n" );
+ }
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+ createInstance( const rtl::OUString& aServiceSpecifier ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+ {
+ if ( aServiceSpecifier.equalsAscii( "com.sun.star.awt.Layout" ) )
+ {
+ fprintf( stderr, "UnoBootstrapLayout: create service '%s'\n",
+ rtl::OUStringToOString (aServiceSpecifier, RTL_TEXTENCODING_UTF8 ).getStr() );
+ return com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory >( new ::LayoutFactory( this ) );
+ }
+ else
+ {
+ fprintf( stderr, "UnoBootstrapLayout: create service '%s'\n",
+ rtl::OUStringToOString (aServiceSpecifier, RTL_TEXTENCODING_UTF8 ).getStr() );
+ try
+ {
+ return mxMSF->createInstance( aServiceSpecifier );
+ }
+ catch ( const com::sun::star::uno::Exception &rExc )
+ {
+ rtl::OString aStr( rtl::OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
+ fprintf( stderr, "service construction exception '%s'\n", aStr.getStr());
+ throw rExc;
+ }
+ }
+ }
+ virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
+ createInstanceWithArguments( const rtl::OUString& ServiceSpecifier, const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& Arguments ) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+ {
+ return mxMSF->createInstanceWithArguments( ServiceSpecifier, Arguments );
+ }
+ virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
+ getAvailableServiceNames() throw (com::sun::star::uno::RuntimeException)
+ {
+ return mxMSF->getAvailableServiceNames();
+ }
+
+#if !LAYOUT_WEAK
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ return mxMSF->queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() throw()
+ {
+ mxMSF->acquire();
+ }
+ virtual void SAL_CALL release() throw()
+ {
+ mxMSF->release();
+ }
+#endif /* !LAYOUT_WEAK */
+};
+
+#endif /* _LAYOUT_UNO_HXX */
diff --git a/toolkit/workben/layout/wordcount-plain.xml b/toolkit/workben/layout/wordcount-plain.xml
new file mode 100644
index 000000000000..a7c34fe5a16f
--- /dev/null
+++ b/toolkit/workben/layout/wordcount-plain.xml
@@ -0,0 +1,29 @@
+
+
+<modaldialog sizeable="true" height="108" help-id="HID_DLG_WORDCOUNT" moveable="true" output-size="true" id="DLG_WORDCOUNT" sv-look="true" text="Word Count" width="170" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <fixedline height="8" id="FL_CURRENT" text="Current selection" width="158" x="6" y="3"/>
+ <hbox>
+ <fixedtext height="8" id="FT_CURRENTWORD" label="Words:" width="80" x="12" y="14"/>
+ <fixedtext height="8" id="FI_CURRENTWORD" right="true" width="50" x="111" y="14"/>
+ </hbox>
+ <hbox>
+ <fixedtext height="8" id="FT_CURRENTCHARACTER" label="Characters:" width="80" x="12" y="26"/>
+ <fixedtext height="8" id="FI_CURRENTCHARACTER" right="true" width="50" x="111" y="26"/>
+ </hbox>
+ <fixedline height="8" id="FL_DOC" text="Whole document" width="158" x="6" y="40"/>
+ <hbox>
+ <fixedtext height="8" id="FT_DOCWORD" label="Words:" width="80" x="12" y="51"/>
+ <fixedtext height="8" id="FI_DOCWORD" right="true" width="50" x="111" y="51"/>
+ </hbox>
+ <hbox>
+ <fixedtext height="8" id="FT_DOCCHARACTER" label="Characters:" width="80" x="12" y="63"/>
+ <fixedtext height="8" id="FI_DOCCHARACTER" right="true" width="50" x="111" y="63"/>
+ </hbox>
+ <fixedline height="8" id="FL_BOTTOM" width="158" x="6" y="77"/>
+ <hbox>
+ <okbutton defbutton="true" height="14" id="PB_OK" width="50" x="61" y="88"/>
+ <helpbutton height="14" id="PB_HELP" width="50" x="114" y="88"/>
+ </hbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/wordcount-tight.xml b/toolkit/workben/layout/wordcount-tight.xml
new file mode 100644
index 000000000000..a9f6a7a09393
--- /dev/null
+++ b/toolkit/workben/layout/wordcount-tight.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ help-id="HID_DLG_WORDCOUNT"
+ id="dialog"
+ sizeable="true" moveable="true" optimumsize="true"
+ has_border="true" sv-look="true" title="Word Count">
+ <vbox border="5" spacing="5">
+ <fixedline id="FL_CURRENT" text="Current selection"/>
+ <hbox>
+ <fixedtext id="FT_CURRENTWORD" label="Words:" cnt:padding="13"/>
+ <fixedinfo id="FI_CURRENTWORD" right="true" label="0" cnt:padding="13"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_CURRENTCHARACTER" label="Characters:" cnt:padding="13"/>
+ <fixedinfo id="FI_CURRENTCHARACTER" right="true" label="00" cnt:padding="13"/>
+ </hbox>
+ <fixedline id="FL_DOC" text="Whole document"/>
+ <hbox>
+ <fixedtext id="FT_DOCWORD" label="Words:" cnt:padding="13"/>
+ <fixedinfo id="FI_DOCWORD" right="true" label="000" cnt:padding="13"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_DOCCHARACTER" label="Characters:" cnt:padding="13"/>
+ <fixedinfo id="FI_DOCCHARACTER" right="true" label="0000" cnt:padding="13"/>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <hbox border="5">
+ <flow homogeneous="true"/>
+ <okbutton id="PB_OK" cnt:expand="false" defbutton="true"/>
+ <helpbutton id="PB_HELP" cnt:expand="false"/>
+ </hbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/wordcount.xml b/toolkit/workben/layout/wordcount.xml
new file mode 100644
index 000000000000..fa9d44f896ad
--- /dev/null
+++ b/toolkit/workben/layout/wordcount.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ help-id="HID_DLG_WORDCOUNT"
+ id="DLG_WORDCOUNT"
+ sizeable="true" moveable="true" optimumsize="true" closeable="true"
+ has_border="true" sv-look="true" _title="Word Count">
+ <vbox border="12" spacing="6">
+ <fixedline id="FL_CURRENT" _text="Current selection"/>
+ <hbox>
+ <vbox cnt:padding="12" spacing="6">
+ <hbox>
+ <fixedtext id="FT_CURRENTWORD" _label="Words:"/>
+ <flow cnt:padding="60"/>
+ <fixedtext id="FI_CURRENTWORD" right="true" _label="0"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_CURRENTCHARACTER" _label="Characters:"/>
+ <flow cnt:padding="60"/>
+ <fixedtext id="FI_CURRENTCHARACTER" right="true" _label="00"/>
+ </hbox>
+ </vbox>
+ </hbox>
+ <!-- if we could do cnt:cnt:padding="-12" here, we would not have to close
+ and reopen the hbox/vbox thing !-->
+ <fixedline id="FL_DOC" _text="Whole document"/>
+ <hbox>
+ <vbox cnt:padding="12" spacing="6">
+ <hbox>
+ <fixedtext id="FT_DOCWORD" _label="Words:"/>
+ <fixedtext id="FI_DOCWORD" right="true" _label="000"/>
+ </hbox>
+ <hbox>
+ <fixedtext id="FT_DOCCHARACTER" _label="Characters:"/>
+ <fixedtext id="FI_DOCCHARACTER" right="true" _label="0000"/>
+ </hbox>
+ </vbox>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <dialogbuttonhbox spacing="12">
+ <flow/>
+ <okbutton defbutton="true" id="PB_OK"/>
+ <helpbutton id="PB_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/wordcountdialog.cxx b/toolkit/workben/layout/wordcountdialog.cxx
new file mode 100644
index 000000000000..0f391f7f7d5e
--- /dev/null
+++ b/toolkit/workben/layout/wordcountdialog.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.
+ *
+ ************************************************************************/
+
+#if !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+#ifdef SW_DLLIMPLEMENTATION
+#undef SW_DLLIMPLEMENTATION
+#endif
+#include <swtypes.hxx>
+#endif /* !TEST_LAYOUT */
+#include <wordcountdialog.hxx>
+#if !TEST_LAYOUT
+#include <docstat.hxx>
+
+#include <dialog.hrc>
+#endif /* !TEST_LAYOUT */
+#include <layout/layout-pre.hxx>
+#if !TEST_LAYOUT
+#include <wordcountdialog.hrc>
+#endif /* !TEST_LAYOUT */
+
+#if ENABLE_LAYOUT
+#undef SW_RES
+#define SW_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "wordcount.xml", id )
+#define SW_WORDCOUNTDIALOG_HRC
+#include <helpid.h>
+#endif /* ENABLE_LAYOUT */
+
+/*-- 06.04.2004 16:05:55---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwWordCountDialog::SwWordCountDialog(Window* pParent) :
+ SfxModalDialog(pParent, SW_RES(DLG_WORDCOUNT)),
+#if defined _MSC_VER
+#pragma warning (disable : 4355)
+#endif
+ aCurrentFL( this, SW_RES( FL_CURRENT )),
+ aCurrentWordFT( this, SW_RES( FT_CURRENTWORD )),
+ aCurrentWordFI( this, SW_RES( FI_CURRENTWORD )),
+ aCurrentCharacterFT( this, SW_RES( FT_CURRENTCHARACTER )),
+ aCurrentCharacterFI( this, SW_RES( FI_CURRENTCHARACTER )),
+
+ aDocFL( this, SW_RES( FL_DOC )),
+ aDocWordFT( this, SW_RES( FT_DOCWORD )),
+ aDocWordFI( this, SW_RES( FI_DOCWORD )),
+ aDocCharacterFT( this, SW_RES( FT_DOCCHARACTER )),
+ aDocCharacterFI( this, SW_RES( FI_DOCCHARACTER )),
+ aBottomFL(this, SW_RES( FL_BOTTOM )),
+ aOK( this, SW_RES( PB_OK )),
+ aHelp( this, SW_RES( PB_HELP ))
+#if defined _MSC_VER
+#pragma warning (default : 4355)
+#endif
+{
+#if ENABLE_LAYOUT
+ SetHelpId (HID_DLG_WORDCOUNT);
+#endif /* ENABLE_LAYOUT */
+ FreeResource();
+}
+/*-- 06.04.2004 16:05:56---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+SwWordCountDialog::~SwWordCountDialog()
+{
+}
+/*-- 06.04.2004 16:05:57---------------------------------------------------
+
+ -----------------------------------------------------------------------*/
+void SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
+{
+#if TEST_LAYOUT
+ (void) rCurrent;
+ (void) rDoc;
+#else /* !TEST_LAYOUT */
+ aCurrentWordFI.SetText( String::CreateFromInt32(rCurrent.nWord ));
+ aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar ));
+ aDocWordFI.SetText( String::CreateFromInt32(rDoc.nWord ));
+ aDocCharacterFI.SetText( String::CreateFromInt32(rDoc.nChar ));
+#endif /* !TEST_LAYOUT */
+}
+
+
+
diff --git a/toolkit/workben/layout/wordcountdialog.hxx b/toolkit/workben/layout/wordcountdialog.hxx
new file mode 100644
index 000000000000..a228b8bdea77
--- /dev/null
+++ b/toolkit/workben/layout/wordcountdialog.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef SW_WORDCOUNTDIALOG_HXX
+#define SW_WORDCOUNTDIALOG_HXX
+#include <sfx2/basedlgs.hxx>
+#include <svtools/stdctrl.hxx>
+#ifndef _SV_BUTTON_HXX
+#include <vcl/button.hxx>
+#endif
+#include <layout/layout.hxx>
+#include <layout/layout-pre.hxx>
+struct SwDocStat;
+class SwWordCountDialog : public SfxModalDialog
+{
+ FixedLine aCurrentFL;
+ FixedText aCurrentWordFT;
+ FixedInfo aCurrentWordFI;
+ FixedText aCurrentCharacterFT;
+ FixedInfo aCurrentCharacterFI;
+
+ FixedLine aDocFL;
+ FixedText aDocWordFT;
+ FixedInfo aDocWordFI;
+ FixedText aDocCharacterFT;
+ FixedInfo aDocCharacterFI;
+
+ FixedLine aBottomFL;
+
+ OKButton aOK;
+ HelpButton aHelp;
+
+public:
+ SwWordCountDialog(Window* pParent);
+ ~SwWordCountDialog();
+
+ void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
diff --git a/toolkit/workben/layout/zoom-1.xml b/toolkit/workben/layout/zoom-1.xml
new file mode 100644
index 000000000000..5fe06a3f270e
--- /dev/null
+++ b/toolkit/workben/layout/zoom-1.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true">
+ <title id="tit" xml-lang="en-US">Set Zoom</title>
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_ZOOM" cnt:expand="true" xml-lang="en-US">Zoom factor</fixedline>
+ <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" xml-lang="en-US">Whole Page</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" xml-lang="en-US">Page Width</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" xml-lang="en-US">Optimal</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_200" xml-lang="en-US">200 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_150" xml-lang="en-US">15~0 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_100" xml-lang="en-US">100 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_75" xml-lang="en-US">75 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_50" xml-lang="en-US">50 %</radiobutton>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" xml-lang="en-US">Variable</radiobutton>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="ED_USER" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ text="100%" unit="13" custom-unit-text="%"
+ right="true"
+ cnt:expand="false"/>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton id="BTN_ZOOM_OK"/>
+ <cancelbutton id="BTN_ZOOM_CANCEL"/>
+ <helpbutton id="BTN_ZOOM_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom-2.xml b/toolkit/workben/layout/zoom-2.xml
new file mode 100644
index 000000000000..c74e0c9a9da7
--- /dev/null
+++ b/toolkit/workben/layout/zoom-2.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true"
+ xml-lang="en-US">
+ Set Zoom
+ <vbox spacing="5" border="5">
+ <fixedline id="FL_ZOOM" cnt:expand="true" xml-lang="en-US">Zoom factor</fixedline>
+ <radiobutton radiogroup="zoom" id="BTN_WHOLE_PAGE" xml-lang="en-US">Whole Page</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_PAGE_WIDTH" xml-lang="en-US">Page Width</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_OPTIMAL" xml-lang="en-US">Optimal</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_200" xml-lang="en-US">200 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_150" xml-lang="en-US">15~0 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_100" xml-lang="en-US">100 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_75" xml-lang="en-US">75 %</radiobutton>
+ <radiobutton radiogroup="zoom" id="BTN_50" xml-lang="en-US">50 %</radiobutton>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BTN_USER" xml-lang="en-US">Variable</radiobutton>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="ED_USER" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ text="100%" unit="13" custom-unit-text="%"
+ right="true"
+ cnt:expand="false"/>
+ </hbox>
+ <fixedline cnt:padding="1" id="FL_BOTTOM"/>
+ <dialogbuttonhbox border="5" spacing="5">
+ <flow/>
+ <okbutton id="BTN_ZOOM_OK"/>
+ <cancelbutton id="BTN_ZOOM_CANCEL"/>
+ <helpbutton id="BTN_ZOOM_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom-indent.xml b/toolkit/workben/layout/zoom-indent.xml
new file mode 100644
index 000000000000..bd5853acdce4
--- /dev/null
+++ b/toolkit/workben/layout/zoom-indent.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="dialog" title="Set Zoom" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true">
+ <hbox border="5" spacing="0">
+ <vbox spacing="0">
+ <fixedline id="FixedLine" text="Zoom factor" cnt:expand="true"/>
+ <hbox> <!-- for left margin !-->
+ <vbox cnt:padding="13" spacing="4" cnt:expand="true">
+ <radiobutton radiogroup="zoom" id="WholePage" label="Whole Page"/>
+ <radiobutton radiogroup="zoom" id="PageWidth" label="Page Width"/>
+ <radiobutton radiogroup="zoom" id="Optimal" label="Optimal"/>
+ <radiobutton radiogroup="zoom" id="Zoom200" label="~200 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom150" label="15~0 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom100" label="~100 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom75" label="~75 %"/>
+ <radiobutton radiogroup="zoom" id="Zoom50" label="~50 %"/>
+ <hbox cnt:expand="false">
+ <align cnt:expand="false">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom" id="BtnUser" label="~Variable"/>
+ </align>
+ <flow cnt:padding="10" cnt:expand="false"/>
+ <metricfield id="User" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ text="100%" unit="11" custom-unit-text="%"
+ right="true"/>
+ <flow cnt:padding="10" cnt:expand="true"/>
+ </hbox>
+ </vbox>
+ </hbox>
+ </vbox>
+ <vbox border="6" spacing="4">
+ <okbutton id="OkButton" cnt:expand="false" defbutton="true"/>
+ <cancelbutton id="CancelButton" cnt:expand="false"/>
+ <helpbutton id="HelpButton" cnt:expand="false"/>
+ </vbox>
+ </hbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom-plain.xml b/toolkit/workben/layout/zoom-plain.xml
new file mode 100644
index 000000000000..c8383b8767a7
--- /dev/null
+++ b/toolkit/workben/layout/zoom-plain.xml
@@ -0,0 +1,20 @@
+
+
+<modaldialog sizeable="true" height="142" help-id="SID_ATTR_ZOOM" moveable="true" output-size="true" id="RID_SVXDLG_ZOOM" sv-look="true" text="Zoom" width="160" xmlns="http://openoffice.org/2007/layout" xmlns:cnt="http://openoffice.org/2007/layout/container">
+ <vbox>
+ <fixedline height="8" id="FL_ZOOM" text="Zoom factor" width="92" x="6" y="3"/>
+ <okbutton defbutton="true" height="14" id="BTN_ZOOM_OK" width="50" x="104" y="6"/>
+ <radiobutton height="10" id="BTN_WHOLE_PAGE" width="80" x="12" y="14"/>
+ <cancelbutton height="14" id="BTN_ZOOM_CANCEL" width="50" x="104" y="23"/>
+ <radiobutton height="10" id="BTN_PAGE_WIDTH" width="80" x="12" y="27"/>
+ <radiobutton height="10" id="BTN_OPTIMAL" width="80" x="12" y="40"/>
+ <helpbutton height="14" id="BTN_ZOOM_HELP" width="50" x="104" y="43"/>
+ <radiobutton height="10" id="BTN_200" label="~200 %" width="80" x="12" y="53"/>
+ <radiobutton height="10" id="BTN_150" label="15~0 %" width="80" x="12" y="66"/>
+ <radiobutton height="10" id="BTN_100" label="~100 %" width="80" x="12" y="79"/>
+ <radiobutton height="10" id="BTN_75" label="~75 %" width="80" x="12" y="92"/>
+ <radiobutton height="10" id="BTN_50" label="~50 %" width="80" x="12" y="105"/>
+ <metricfield has_border="true" custom-unit-text="%" group="true" height="12" left="true" repeat="true" id="ED_USER" spin="true" step-size="1" unit="FUNIT_CUSTOM" width="36" x="56" y="120"/>
+ <radiobutton height="10" id="BTN_USER" label="~Variable" width="42" x="12" y="121"/>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom.cxx b/toolkit/workben/layout/zoom.cxx
new file mode 100644
index 000000000000..bf27ad3feaf6
--- /dev/null
+++ b/toolkit/workben/layout/zoom.cxx
@@ -0,0 +1,622 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 !TEST_LAYOUT
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+#endif /* !TEST_LAYOUT */
+
+#ifdef SVX_DLLIMPLEMENTATION
+#undef SVX_DLLIMPLEMENTATION
+#endif
+
+// include ---------------------------------------------------------------
+
+#if TEST_LAYOUT
+#include <cstdio>
+#endif /* TEST_LAYOUT */
+#include <tools/shl.hxx>
+#include <svtools/itemset.hxx>
+#include <svtools/itempool.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/msgbox.hxx>
+
+#define _SVX_ZOOM_CXX
+
+#include <svx/dialogs.hrc>
+#if !TEST_LAYOUT
+#include "zoom.hrc"
+#endif /* !TEST_LAYOUT */
+
+#include "zoom.hxx"
+#if TEST_LAYOUT
+#define SVX_ZOOM_OPTIMAL "Zoom optimal"
+#define SVX_ZOOM_PAGEWIDTH "Zoom page width"
+#define SVX_ZOOM_WHOLEPAGE "Zoom whole page"
+struct SvxZoomItem
+{
+ void SetType( char const* s )
+ {
+ fputs( s, stderr );
+ }
+
+ void SetValue( int n )
+ {
+ fprintf( stderr, "Zoom factor: %d\n", int( n ) );
+ }
+};
+#define SfxPoolItem LAYOUT_SfxPoolItem
+class LAYOUT_SfxPoolItem
+{
+};
+struct SvxViewLayoutItem : public LAYOUT_SfxPoolItem
+{
+ bool IsBookMode()
+ {
+ return false;
+ }
+ USHORT GetValue()
+ {
+ return 0;
+ }
+
+ void SetValue( int n )
+ {
+ fprintf( stderr, "Zoom factor: %d\n", int( n ) );
+ }
+ void SetBookMode( bool )
+ {
+ }
+#if 0 // needed for real SfxPoolItem
+ int operator==( const SfxPoolItem& ) const
+ {
+ return 0;
+ }
+ SfxPoolItem* Clone( SfxItemPool* ) const
+ {
+ return 0;
+ }
+#endif
+};
+#else /* !TEST_LAYOUT */
+#include <svx/zoomitem.hxx>
+#include <svx/viewlayoutitem.hxx>
+#include <svx/dialmgr.hxx>
+#endif /* !TEST_LAYOUT */
+#include "zoom_def.hxx"
+
+#include <layout/layout-pre.hxx>
+
+#if ENABLE_LAYOUT
+#undef SVX_RES
+#define SVX_RES(x) #x
+#undef SfxModalDialog
+#define SfxModalDialog( parent, id ) Dialog( parent, "zoom.xml", id )
+#endif /* ENABLE_LAYOUT */
+
+// static ----------------------------------------------------------------
+
+static USHORT pRanges[] =
+{
+ SID_ATTR_ZOOM,
+ SID_ATTR_ZOOM,
+ 0
+};
+
+#define SPECIAL_FACTOR ((USHORT)0xFFFF)
+
+// class SvxZoomDialog ---------------------------------------------------
+
+USHORT SvxZoomDialog::GetFactor() const
+{
+ if ( a100Btn.IsChecked() )
+ return 100;
+ if ( aUserBtn.IsChecked() )
+ return (USHORT)aUserEdit.GetValue();
+ else
+ return SPECIAL_FACTOR;
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetFactor( USHORT nNewFactor, USHORT nBtnId )
+{
+#if TEST_LAYOUT
+ printf ("\t\t set factor %d\n", (int)nNewFactor);
+#endif /* !TEST_LAYOUT */
+ aUserEdit.Disable();
+
+ if ( !nBtnId )
+ {
+ if ( nNewFactor == 100 )
+ {
+ a100Btn.Check();
+ a100Btn.GrabFocus();
+ }
+ else
+ {
+ aUserBtn.Check();
+ aUserEdit.Enable();
+ aUserEdit.SetValue( (long)nNewFactor );
+ aUserEdit.GrabFocus();
+ }
+ }
+ else
+ {
+ aUserEdit.SetValue( (long)nNewFactor );
+
+ if ( ZOOMBTN_OPTIMAL == nBtnId )
+ {
+ aOptimalBtn.Check();
+ aOptimalBtn.GrabFocus();
+ }
+ else if ( ZOOMBTN_PAGEWIDTH == nBtnId )
+ {
+ aPageWidthBtn.Check();
+ aPageWidthBtn.GrabFocus();
+ }
+ else if ( ZOOMBTN_WHOLEPAGE == nBtnId )
+ {
+ aWholePageBtn.Check();
+ aWholePageBtn.GrabFocus();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetButtonText( USHORT nBtnId, const String& rNewTxt )
+{
+ switch ( nBtnId )
+ {
+ case ZOOMBTN_OPTIMAL: // Optimal-Button
+ aOptimalBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button
+ aPageWidthBtn.SetText( rNewTxt );
+ break;
+
+ case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button
+ aWholePageBtn.SetText( rNewTxt );
+ break;
+
+ default:
+ DBG_ERROR( "wrong button number" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::HideButton( USHORT nBtnId )
+{
+ switch ( nBtnId )
+ {
+ case ZOOMBTN_OPTIMAL: // Optimal-Button
+ aOptimalBtn.Hide();
+ break;
+
+ case ZOOMBTN_PAGEWIDTH: // Seitenbreite-Button
+ aPageWidthBtn.Hide();
+ break;
+
+ case ZOOMBTN_WHOLEPAGE: // Ganze Seite-Button
+ aWholePageBtn.Hide();
+ break;
+
+ default:
+ DBG_ERROR( "Falsche Button-Nummer!!!" );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetLimits( USHORT nMin, USHORT nMax )
+{
+ DBG_ASSERT( nMin < nMax, "invalid limits" );
+ aUserEdit.SetMin( nMin );
+ aUserEdit.SetFirst( nMin );
+ aUserEdit.SetMax( nMax );
+ aUserEdit.SetLast( nMax );
+}
+
+// -----------------------------------------------------------------------
+
+void SvxZoomDialog::SetSpinSize( USHORT nNewSpin )
+{
+ aUserEdit.SetSpinSize( nNewSpin );
+}
+
+// -----------------------------------------------------------------------
+
+#if TEST_LAYOUT
+SvxZoomDialog::SvxZoomDialog( Window* pParent ) :
+#else /* !TEST_LAYOUT */
+SvxZoomDialog::SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet ) :
+#endif /* !TEST_LAYOUT */
+
+ SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_ZOOM ) ),
+
+ aZoomFl ( this, SVX_RES( FL_ZOOM ) ),
+ aOptimalBtn ( this, SVX_RES( BTN_OPTIMAL ) ),
+ aWholePageBtn ( this, SVX_RES( BTN_WHOLE_PAGE ) ),
+ aPageWidthBtn ( this, SVX_RES( BTN_PAGE_WIDTH ) ),
+ a100Btn ( this, SVX_RES( BTN_100 ) ),
+ aUserBtn ( this, SVX_RES( BTN_USER ) ),
+ aUserEdit ( this, SVX_RES( ED_USER ) ),
+
+ aViewLayoutFl ( this, SVX_RES( FL_VIEWLAYOUT ) ),
+ aAutomaticBtn ( this, SVX_RES( BTN_AUTOMATIC ) ),
+ aSingleBtn ( this, SVX_RES( BTN_SINGLE ) ),
+ aColumnsBtn ( this, SVX_RES( BTN_COLUMNS ) ),
+ aColumnsEdit ( this, SVX_RES( ED_COLUMNS ) ),
+ aBookModeChk ( this, SVX_RES( CHK_BOOK ) ),
+
+ aBottomFl ( this, SVX_RES( FL_BOTTOM ) ),
+ aOKBtn ( this, SVX_RES( BTN_ZOOM_OK ) ),
+ aCancelBtn ( this, SVX_RES( BTN_ZOOM_CANCEL ) ),
+ aHelpBtn ( this, SVX_RES( BTN_ZOOM_HELP ) ),
+
+#if !TEST_LAYOUT
+ rSet ( rCoreSet ),
+#endif /* !TEST_LAYOUT */
+ pOutSet ( NULL ),
+ bModified ( FALSE )
+
+{
+#if ENABLE_LAYOUT
+ SetHelpId (SID_ATTR_ZOOM);
+#endif /* ENABLE_LAYOUT */
+ Link aLink = LINK( this, SvxZoomDialog, UserHdl );
+ a100Btn.SetClickHdl( aLink );
+ aOptimalBtn.SetClickHdl( aLink );
+ aPageWidthBtn.SetClickHdl( aLink );
+ aWholePageBtn.SetClickHdl( aLink );
+ aUserBtn.SetClickHdl( aLink );
+
+ Link aViewLayoutLink = LINK( this, SvxZoomDialog, ViewLayoutUserHdl );
+ aAutomaticBtn.SetClickHdl( aViewLayoutLink );
+ aSingleBtn.SetClickHdl( aViewLayoutLink );
+ aColumnsBtn.SetClickHdl( aViewLayoutLink );
+
+ Link aViewLayoutSpinLink = LINK( this, SvxZoomDialog, ViewLayoutSpinHdl );
+ aColumnsEdit.SetModifyHdl( aViewLayoutSpinLink );
+
+ Link aViewLayoutCheckLink = LINK( this, SvxZoomDialog, ViewLayoutCheckHdl );
+ aBookModeChk.SetClickHdl( aViewLayoutCheckLink );
+
+ aOKBtn.SetClickHdl( LINK( this, SvxZoomDialog, OKHdl ) );
+ aUserEdit.SetModifyHdl( LINK( this, SvxZoomDialog, SpinHdl ) );
+
+ // Default-Werte
+ USHORT nValue = 100;
+ USHORT nMin = 10;
+ USHORT nMax = 1000;
+
+#if !TEST_LAYOUT
+ // ggf. erst den alten Wert besorgen
+ const SfxUInt16Item* pOldUserItem = 0;
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ pOldUserItem = (const SfxUInt16Item*)pSh->GetItem( SID_ATTR_ZOOM_USER );
+
+ if ( pOldUserItem )
+ nValue = pOldUserItem->GetValue();
+
+ // UserEdit initialisieren
+ if ( nMin > nValue )
+ nMin = nValue;
+ if ( nMax < nValue )
+ nMax = nValue;
+#endif /* !TEST_LAYOUT */
+ aUserEdit.SetMin( nMin );
+ aUserEdit.SetFirst( nMin );
+ aUserEdit.SetMax( nMax );
+ aUserEdit.SetLast( nMax );
+ aUserEdit.SetValue( nValue );
+
+#if TEST_LAYOUT
+ USHORT nZoom = 100;
+ SetFactor( nZoom );
+#else /* !TEST_LAYOUT */
+ const SfxPoolItem& rItem = rSet.Get( rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
+
+ if ( rItem.ISA(SvxZoomItem) )
+ {
+ const SvxZoomItem& rZoomItem = (const SvxZoomItem&)rItem;
+ const USHORT nZoom = rZoomItem.GetValue();
+ const SvxZoomType eType = rZoomItem.GetType();
+ const USHORT nValSet = rZoomItem.GetValueSet();
+ USHORT nBtnId = 0;
+
+ switch ( eType )
+ {
+ case SVX_ZOOM_OPTIMAL:
+ nBtnId = ZOOMBTN_OPTIMAL;
+ break;
+ case SVX_ZOOM_PAGEWIDTH:
+ nBtnId = ZOOMBTN_PAGEWIDTH;
+ break;
+ case SVX_ZOOM_WHOLEPAGE:
+ nBtnId = ZOOMBTN_WHOLEPAGE;
+ break;
+ case SVX_ZOOM_PERCENT:
+ break;
+ case SVX_ZOOM_PAGEWIDTH_NOBORDER:
+ break;
+ }
+
+ if ( !(SVX_ZOOM_ENABLE_100 & nValSet) )
+ a100Btn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_OPTIMAL & nValSet) )
+ aOptimalBtn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_PAGEWIDTH & nValSet) )
+ aPageWidthBtn.Disable();
+ if ( !(SVX_ZOOM_ENABLE_WHOLEPAGE & nValSet) )
+ aWholePageBtn.Disable();
+ SetFactor( nZoom, nBtnId );
+ }
+ else
+ {
+ const USHORT nZoom = ( (const SfxUInt16Item&)rItem ).GetValue();
+ SetFactor( nZoom );
+ }
+
+ const SfxPoolItem* pViewLayoutItem = 0;
+ if ( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_VIEWLAYOUT, FALSE, &pViewLayoutItem ) )
+ {
+ const USHORT nColumns = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->GetValue();
+ const bool bBookMode = static_cast<const SvxViewLayoutItem*>(pViewLayoutItem)->IsBookMode();
+
+ if ( 0 == nColumns )
+ {
+ aAutomaticBtn.Check();
+ aColumnsEdit.SetValue( 2 );
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( 1 == nColumns)
+ {
+ aSingleBtn.Check();
+ aColumnsEdit.SetValue( 2 );
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else
+ {
+ aColumnsBtn.Check();
+ if ( !bBookMode )
+ {
+ aColumnsEdit.SetValue( nColumns );
+ if ( 0 != nColumns % 2 )
+ aBookModeChk.Disable();
+ }
+ else
+ {
+ aColumnsEdit.SetValue( nColumns );
+ aBookModeChk.Check();
+ }
+ }
+ }
+ else
+ {
+ // hide view layout related controls:
+ aViewLayoutFl.Disable();
+ aAutomaticBtn.Disable();
+ aSingleBtn.Disable();
+ aColumnsBtn.Disable();
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+#endif /* !TEST_LAYOUT */
+
+ FreeResource();
+}
+
+// -----------------------------------------------------------------------
+
+SvxZoomDialog::~SvxZoomDialog()
+{
+ delete pOutSet;
+ pOutSet = 0;
+}
+
+// -----------------------------------------------------------------------
+
+USHORT* SvxZoomDialog::GetRanges()
+{
+ return pRanges;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, UserHdl, RadioButton *, pBtn )
+{
+#if TEST_LAYOUT
+ fprintf( stderr, "SvxZoomDialog::UserHdl\n" );
+#endif /* TEST_LAYOUT */
+ bModified |= TRUE;
+
+ if ( pBtn == &aUserBtn )
+ {
+ aUserEdit.Enable();
+ aUserEdit.GrabFocus();
+ }
+ else
+ aUserEdit.Disable();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, SpinHdl, MetricField *, EMPTYARG )
+{
+ if ( !aUserBtn.IsChecked() )
+ return 0;
+ bModified |= TRUE;
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutUserHdl, RadioButton *, pBtn )
+{
+ bModified |= TRUE;
+
+ if ( pBtn == &aAutomaticBtn )
+ {
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( pBtn == &aSingleBtn )
+ {
+ aColumnsEdit.Disable();
+ aBookModeChk.Disable();
+ }
+ else if ( pBtn == &aColumnsBtn )
+ {
+ aColumnsEdit.Enable();
+ aColumnsEdit.GrabFocus();
+ if ( 0 == aColumnsEdit.GetValue() % 2 )
+ aBookModeChk.Enable();
+ }
+ else
+ {
+ DBG_ERROR( "Wrong Button" );
+ return 0;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutSpinHdl, MetricField *, pEdt )
+{
+ if ( pEdt == &aColumnsEdit && !aColumnsBtn.IsChecked() )
+ return 0;
+
+ if ( 0 == aColumnsEdit.GetValue() % 2 )
+ aBookModeChk.Enable();
+ else
+ {
+ aBookModeChk.Check( sal_False );
+ aBookModeChk.Disable();
+ }
+
+ bModified |= TRUE;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, ViewLayoutCheckHdl, CheckBox *, pChk )
+{
+ if ( pChk == &aBookModeChk && !aColumnsBtn.IsChecked() )
+ return 0;
+
+ bModified |= TRUE;
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( SvxZoomDialog, OKHdl, Button *, pBtn )
+{
+ if ( bModified || &aOKBtn != pBtn )
+ {
+#if TEST_LAYOUT
+ SvxZoomItem aZoomItem;
+ SvxViewLayoutItem aViewLayoutItem;
+#else /* !TEST_LAYOUT */
+ SvxZoomItem aZoomItem( SVX_ZOOM_PERCENT, 0, rSet.GetPool()->GetWhich( SID_ATTR_ZOOM ) );
+ SvxViewLayoutItem aViewLayoutItem( 0, false, rSet.GetPool()->GetWhich( SID_ATTR_VIEWLAYOUT ) );
+#endif /* !TEST_LAYOUT */
+
+ if ( &aOKBtn == pBtn )
+ {
+ USHORT nFactor = GetFactor();
+
+ if ( SPECIAL_FACTOR == nFactor )
+ {
+ if ( aOptimalBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_OPTIMAL );
+ else if ( aPageWidthBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_PAGEWIDTH );
+ else if ( aWholePageBtn.IsChecked() )
+ aZoomItem.SetType( SVX_ZOOM_WHOLEPAGE );
+ }
+ else
+ aZoomItem.SetValue( nFactor );
+
+ if ( aAutomaticBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( 0 );
+ aViewLayoutItem.SetBookMode( false );
+ }
+ if ( aSingleBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( 1 );
+ aViewLayoutItem.SetBookMode( false );
+ }
+ else if ( aColumnsBtn.IsChecked() )
+ {
+ aViewLayoutItem.SetValue( static_cast<USHORT>(aColumnsEdit.GetValue()) );
+ aViewLayoutItem.SetBookMode( aBookModeChk.IsChecked() );
+ }
+ }
+ else
+ {
+ DBG_ERROR( "Wrong Button" );
+ return 0;
+ }
+#if !TEST_LAYOUT
+ pOutSet = new SfxItemSet( rSet );
+ pOutSet->Put( aZoomItem );
+
+ // don't set attribute in case the whole viewlayout stuff is disabled:
+ if ( aViewLayoutFl.IsEnabled() )
+ pOutSet->Put( aViewLayoutItem );
+
+ // Wert aus dem UserEdit "uber den Dialog hinaus merken
+ SfxObjectShell* pSh = SfxObjectShell::Current();
+
+ if ( pSh )
+ pSh->PutItem( SfxUInt16Item( SID_ATTR_ZOOM_USER,
+ (UINT16)aUserEdit.GetValue() ) );
+#endif /* !TEST_LAYOUT */
+ EndDialog( RET_OK );
+ }
+ else
+ EndDialog( RET_CANCEL );
+ return 0;
+}
+
+
diff --git a/toolkit/workben/layout/zoom.hrc b/toolkit/workben/layout/zoom.hrc
new file mode 100644
index 000000000000..49412ad085f0
--- /dev/null
+++ b/toolkit/workben/layout/zoom.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 _SVX_ZOOM_HRC
+#define _SVX_ZOOM_HRC
+
+// defines ------------------------------------------------------------------
+
+#define FL_ZOOM 14
+#define BTN_OPTIMAL 15
+#define BTN_WHOLE_PAGE 16
+#define BTN_PAGE_WIDTH 17
+#define BTN_100 18
+#define BTN_USER 19
+#define ED_USER 20
+
+#define FL_VIEWLAYOUT 21
+#define BTN_AUTOMATIC 22
+#define BTN_SINGLE 23
+#define BTN_COLUMNS 24
+#define ED_COLUMNS 25
+#define CHK_BOOK 26
+
+#define FL_BOTTOM 27
+#define BTN_ZOOM_OK 28
+#define BTN_ZOOM_CANCEL 29
+#define BTN_ZOOM_HELP 30
+
+#endif
+
diff --git a/toolkit/workben/layout/zoom.hxx b/toolkit/workben/layout/zoom.hxx
new file mode 100644
index 000000000000..f0c617a4b4d6
--- /dev/null
+++ b/toolkit/workben/layout/zoom.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 _SVX_ZOOM_HXX
+#define _SVX_ZOOM_HXX
+
+// include ---------------------------------------------------------------
+
+#include <layout/layout.hxx>
+#include <sfx2/basedlgs.hxx>
+#ifndef _SV_BUTTON_HXX //autogen wg. Radio-/OK-/Cancel-/HelpButton
+#include <vcl/button.hxx>
+#endif
+#include <vcl/field.hxx>
+#include <vcl/fixed.hxx>
+
+// define ----------------------------------------------------------------
+/* CHINA001
+#define ZOOMBTN_OPTIMAL ((USHORT)0x0001)
+#define ZOOMBTN_PAGEWIDTH ((USHORT)0x0002)
+#define ZOOMBTN_WHOLEPAGE ((USHORT)0x0004)
+*/
+#ifndef _SVX_ZOOM_HXX
+#include "zoom_def.hxx"
+#endif
+// class SvxZoomDialog ---------------------------------------------------
+/*
+ {k:\svx\prototyp\dialog\zoom.bmp}
+
+ [Beschreibung]
+ Mit diesem Dialog wird ein Zoom-Faktor eingestellt.
+
+ [Items]
+ SvxZoomItem <SID_ATTR_ZOOM>
+*/
+
+#include <layout/layout-pre.hxx>
+
+class SvxZoomDialog : public SfxModalDialog
+{
+private:
+ FixedLine aZoomFl;
+ RadioButton aOptimalBtn;
+ RadioButton aWholePageBtn;
+ RadioButton aPageWidthBtn;
+ RadioButton a100Btn;
+ RadioButton aUserBtn;
+ MetricField aUserEdit;
+
+ FixedLine aViewLayoutFl;
+ RadioButton aAutomaticBtn;
+ RadioButton aSingleBtn;
+ RadioButton aColumnsBtn;
+ MetricField aColumnsEdit;
+ CheckBox aBookModeChk;
+
+ FixedLine aBottomFl;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+ HelpButton aHelpBtn;
+
+#if !TEST_LAYOUT
+ const SfxItemSet& rSet;
+#endif /* !TEST_LAYOUT */
+ SfxItemSet* pOutSet;
+ BOOL bModified;
+
+#ifdef _SVX_ZOOM_CXX
+ DECL_LINK( UserHdl, RadioButton* );
+ DECL_LINK( SpinHdl, MetricField* );
+ DECL_LINK( ViewLayoutUserHdl, RadioButton* );
+ DECL_LINK( ViewLayoutSpinHdl, MetricField* );
+ DECL_LINK( ViewLayoutCheckHdl, CheckBox* );
+ DECL_LINK( OKHdl, Button* );
+#endif
+
+public:
+#if TEST_LAYOUT
+ SvxZoomDialog( Window* pParent );
+#else /* !TEST_LAYOUT */
+ SvxZoomDialog( Window* pParent, const SfxItemSet& rCoreSet );
+#endif /* !TEST_LAYOUT */
+ ~SvxZoomDialog();
+
+ static USHORT* GetRanges();
+ const SfxItemSet* GetOutputItemSet() const { return pOutSet; }
+
+ USHORT GetFactor() const;
+ void SetFactor( USHORT nNewFactor, USHORT nBtnId = 0 );
+
+ void SetButtonText( USHORT nBtnId, const String& aNewTxt );
+ void HideButton( USHORT nBtnId );
+ void SetLimits( USHORT nMin, USHORT nMax );
+ void SetSpinSize( USHORT nNewSpin );
+};
+
+#include <layout/layout-post.hxx>
+
+#endif
+
diff --git a/toolkit/workben/layout/zoom.xml b/toolkit/workben/layout/zoom.xml
new file mode 100644
index 000000000000..5cc376168a27
--- /dev/null
+++ b/toolkit/workben/layout/zoom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This is a template. i18n translation is not performed in-place;
+ i18n translated xml files are generated from this template by
+ transex3/layout/tralay. !-->
+
+<modaldialog xmlns="http://openoffice.org/2007/layout"
+ xmlns:cnt="http://openoffice.org/2007/layout/container"
+ id="RID_SVXDLG_ZOOM" _title="Zoom &amp; View Layout" optimumsize="true"
+ help-id="SID_ATTR_ZOOM"
+ has_border="true" sizeable="true" moveable="true" closeable="true">
+ <vbox spacing="0" border="12">
+ <hbox spacing="0" border="0">
+ <vbox spacing="6" border="0">
+ <fixedline id="FL_ZOOM" _text="Zoom factor" cnt:expand="false"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_OPTIMAL" _label="Optimal"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_WHOLE_PAGE" _label="Whole Page"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_PAGE_WIDTH" _label="Page Width"/>
+ <radiobutton radiogroup="zoom-factor" id="BTN_100" _label="100 %"/>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-factor" id="BTN_USER" _label="Variable"/>
+ </align>
+ <flow cnt:padding="12" cnt:expand="false"/>
+ <metricfield id="ED_USER" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ _text="100%" unit="11" custom-unit-text="%"
+ right="true"
+ cnt:expand="false"/>
+ </hbox>
+ </vbox>
+ <flow/>
+ <vbox spacing="6" border="0">
+ <fixedline id="FL_VIEWLAYOUT" _text="View layout" cnt:expand="false"/>
+ <radiobutton radiogroup="zoom-layout" id="BTN_AUTOMATIC" _label="~Automatic"/>
+ <radiobutton radiogroup="zoom-layout" id="BTN_SINGLE" _label="~Single page"/>
+ <hbox cnt:expand="false" cnt:fill="true">
+ <align cnt:expand="false" cnt:fill="true">
+ <radiobutton cnt:v-align="0.5" cnt:v-fill="0" radiogroup="zoom-layout" id="BTN_COLUMNS" _label="~Columns"/>
+ </align>
+ <flow cnt:padding="12" cnt:expand="false"/>
+ <metricfield id="ED_COLUMNS" value-step="1"
+ repeat="true" has_border="true" spin="true"
+ _text="100%"
+ right="true"
+ spin-value-min="1"
+ spin-value="1"
+ cnt:expand="false"/>
+ </hbox>
+ <hbox><flow cnt:expand="false" cnt:padding="12"/><checkbox id="CHK_BOOK" _label="~Book mode"/></hbox>
+ </vbox>
+ </hbox>
+ <fixedline cnt:padding="6" id="FL_BOTTOM"/>
+ <dialogbuttonhbox border="0" spacing="12">
+ <flow/>
+ <okbutton defbutton="true" id="BTN_ZOOM_OK"/>
+ <cancelbutton id="BTN_ZOOM_CANCEL"/>
+ <helpbutton id="BTN_ZOOM_HELP"/>
+ </dialogbuttonhbox>
+ </vbox>
+</modaldialog>
diff --git a/toolkit/workben/layout/zoom_def.hxx b/toolkit/workben/layout/zoom_def.hxx
new file mode 100644
index 000000000000..5af749f2abde
--- /dev/null
+++ b/toolkit/workben/layout/zoom_def.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef _SVX_ZOOM_DEF_HXX
+#define _SVX_ZOOM_DEF_HXX
+
+#define ZOOMBTN_OPTIMAL ((USHORT)0x0001)
+#define ZOOMBTN_PAGEWIDTH ((USHORT)0x0002)
+#define ZOOMBTN_WHOLEPAGE ((USHORT)0x0004)
+
+#endif
diff --git a/toolkit/workben/makefile.mk b/toolkit/workben/makefile.mk
new file mode 100644
index 000000000000..8e54c7737a20
--- /dev/null
+++ b/toolkit/workben/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=toolkit
+TARGET=unodialog
+LIBTARGET=NO
+ENABLE_EXCEPTIONS=TRUE
+
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : settings.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES= unodialog.cxx
+
+OBJFILES= $(OBJ)$/unodialog.obj
+
+
+APP2NOSAL= TRUE
+APP2TARGET= unodialog
+APP2OBJS= $(OBJ)$/unodialog.obj
+APP2STDLIBS=$(TOOLSLIB) \
+ $(SOTLIB) \
+ $(COMPHELPERLIB) \
+ $(CPPULIB) \
+ $(CPPUHELPERLIB) \
+ $(VCLLIB) \
+ $(SALLIB)
+
+# $(SVTOOLLIB) \
+
+APP2DEF= $(MISC)$/unodialog.def
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk
+
+
+# ------------------------------------------------------------------
+# Windows
+# ------------------------------------------------------------------
+
+.IF "$(GUI)" == "WIN"
+
+$(MISC)$/unodialog.def: makefile.mk
+ echo NAME unodialog >$@
+ echo DESCRIPTION 'StarView - Testprogramm' >>$@
+ echo EXETYPE WINDOWS >>$@
+ echo STUB 'winSTUB.EXE' >>$@
+ echo PROTMODE >>$@
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
+ echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
+
+.ENDIF
diff --git a/toolkit/workben/no_localization b/toolkit/workben/no_localization
new file mode 100644
index 000000000000..3ce3aa0ec048
--- /dev/null
+++ b/toolkit/workben/no_localization
@@ -0,0 +1 @@
+Touch me to prevent that the localisation process extracts strings #i85733#
diff --git a/toolkit/workben/unodialog.cxx b/toolkit/workben/unodialog.cxx
new file mode 100644
index 000000000000..052ece9ac7fd
--- /dev/null
+++ b/toolkit/workben/unodialog.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+#include <tools/svwin.h>
+#include <sal/main.h>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+
+
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+
+#include <svtools/unoiface.hxx> // InitExtToolkit
+#include <comphelper/processfactory.hxx>
+
+#include <cppuhelper/servicefactory.hxx>
+#include <cppuhelper/bootstrap.hxx>
+#include <comphelper/regpathhelper.hxx>
+
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/registry/XSimpleRegistry.hpp>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::connection;
+using namespace ::vos;
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::registry;
+using namespace ::com::sun::star::lang;
+
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > createApplicationServiceManager()
+{
+ try
+ {
+ ::rtl::OUString localRegistry = ::comphelper::getPathToUserRegistry();
+ ::rtl::OUString systemRegistry = ::comphelper::getPathToSystemRegistry();
+
+ Reference< XSimpleRegistry > xLocalRegistry( ::cppu::createSimpleRegistry() );
+ Reference< XSimpleRegistry > xSystemRegistry( ::cppu::createSimpleRegistry() );
+ if ( xLocalRegistry.is() && (localRegistry.getLength() > 0) )
+ {
+ try
+ {
+ xLocalRegistry->open( localRegistry, sal_False, sal_True);
+ }
+ catch ( InvalidRegistryException& )
+ {
+ }
+
+ if ( !xLocalRegistry->isValid() )
+ xLocalRegistry->open(localRegistry, sal_True, sal_True);
+ }
+
+ if ( xSystemRegistry.is() && (systemRegistry.getLength() > 0) )
+ xSystemRegistry->open( systemRegistry, sal_True, sal_False);
+
+ if ( (xLocalRegistry.is() && xLocalRegistry->isValid()) &&
+ (xSystemRegistry.is() && xSystemRegistry->isValid()) )
+ {
+ Reference < XSimpleRegistry > xReg( ::cppu::createNestedRegistry() );
+ Sequence< Any > seqAnys(2);
+ seqAnys[0] <<= xLocalRegistry ;
+ seqAnys[1] <<= xSystemRegistry ;
+ Reference< XInitialization > xInit( xReg, UNO_QUERY );
+ xInit->initialize( seqAnys );
+
+ Reference< XComponentContext > xContext( ::cppu::bootstrap_InitialComponentContext( xReg ) );
+ return Reference< XMultiServiceFactory >( xContext->getServiceManager(), UNO_QUERY );
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ }
+
+ return ::cppu::createServiceFactory();
+}
+
+
+// -----------------------------------------------------------------------
+void Main( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
+
+SAL_IMPLEMENT_MAIN()
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = createApplicationServiceManager();
+ //SVInit( xMSF );
+ ::Main( xMSF );
+ //SVDeinit();
+ return NULL;
+}
+
+/*
+class MyApp : public Application
+{
+public:
+ void Main()
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = createApplicationServiceManager();
+ ::Main( xMSF );
+ }
+};
+
+MyApp aMyApp;
+*/
+
+
+class MyWin : public WorkWindow
+{
+private:
+ uno::Reference< awt::XView > mxView;
+
+public:
+ MyWin() : WorkWindow( NULL, WB_APP|WB_STDWORK ) {;}
+ void Paint( const Rectangle& r );
+ void SetXView( uno::Reference< awt::XView > xV ) { mxView = xV; }
+};
+
+
+// -----------------------------------------------------------------------
+
+void Main( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMSF )
+{
+ ::comphelper::setProcessServiceFactory( xMSF );
+
+ //uno::Reference< awt::XToolkit> xToolkit( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.ExtToolkit" ) ) ), uno::UNO_QUERY );
+ uno::Reference< awt::XToolkit> xToolkit( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), uno::UNO_QUERY );
+
+ // Create a DialogModel
+ uno::Reference< container::XNameContainer > xC( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), uno::UNO_QUERY );
+ uno::Reference< lang::XMultiServiceFactory > xModFact( xC, uno::UNO_QUERY );
+
+ // Create a ButtonModel
+ uno::Reference< awt::XControlModel > xCtrl1( xModFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlButtonModel" ) ) ), uno::UNO_QUERY );
+ uno::Reference< beans::XPropertySet > xPSet( xCtrl1, uno::UNO_QUERY );
+ uno::Any aValue;
+ aValue <<= (sal_Int32) 10;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ), aValue );
+ aValue <<= (sal_Int32) 10;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ), aValue );
+ aValue <<= (sal_Int32) 40;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ), aValue );
+ aValue <<= (sal_Int32) 12;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ), aValue );
+ aValue <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Test!" ) );
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Label" ) ), aValue );
+ uno::Any aAny;
+ aAny <<= xCtrl1;
+ xC->insertByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Control1" ) ), aAny );
+
+ uno::Reference< beans::XPropertySet > xDlgPSet( xC, uno::UNO_QUERY );
+ aValue <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Test-Dialog" ) );
+ xDlgPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), aValue );
+ aValue <<= (sal_Int32) 200;
+ xDlgPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ), aValue );
+ aValue <<= (sal_Int32) 200;
+ xDlgPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ), aValue );
+
+ // Create a Dialog
+ uno::Reference< awt::XControl > xDlg( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialog" ) ) ), uno::UNO_QUERY );
+ uno::Reference< awt::XControlModel > xDlgMod( xC, uno::UNO_QUERY );
+ xDlg->setModel( xDlgMod );
+
+ // Create a EditModel
+ uno::Reference< awt::XControlModel > xCtrl2( xModFact->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlEditModel" ) ) ), uno::UNO_QUERY );
+ xPSet = uno::Reference< beans::XPropertySet >( xCtrl2, uno::UNO_QUERY );
+ aValue <<= (sal_Int32) 10;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ), aValue );
+ aValue <<= (sal_Int32) 40;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionY" ) ), aValue );
+ aValue <<= (sal_Int32) 80;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Width" ) ), aValue );
+ aValue <<= (sal_Int32) 12;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Height" ) ), aValue );
+ aValue <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Text..." ) );
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Text" ) ), aValue );
+ aAny <<= xCtrl2;
+ xC->insertByName( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Control2" ) ), aAny );
+
+ // test if listener works...
+ aValue <<= (sal_Int32) 20;
+ xPSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PositionX" ) ), aValue );
+
+ MyWin * pWindow;
+ ::osl::Guard< vos::IMutex > aVclGuard( Application::GetSolarMutex() );
+ pWindow = new MyWin();
+ pWindow->Show();
+
+ xDlg->setDesignMode( sal_True );
+
+ uno::Reference< awt::XWindow > xWindow( xDlg, uno::UNO_QUERY );
+ xWindow->setVisible( sal_False );
+
+ xDlg->createPeer( xToolkit, pWindow->GetComponentInterface() );
+
+ uno::Reference< awt::XView > xView( xDlg, uno::UNO_QUERY );
+ pWindow->SetXView( xView );
+
+ uno::Reference< awt::XDialog > xD( xDlg, uno::UNO_QUERY );
+
+ //static BOOL bExecute = FALSE;
+ //if ( bExecute )
+ xD->execute();
+ //Execute();
+ Reference< XComponent > xDT( xD, uno::UNO_QUERY );
+ xDT->dispose();
+ delete pWindow;
+
+ Reference< XComponent > xT( xToolkit, uno::UNO_QUERY );
+ xT->dispose();
+
+ Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
+ if (xProps.is())
+ {
+ try
+ {
+ Reference< lang::XComponent > xComp;
+ if (xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xComp)
+ {
+ xComp->dispose();
+ }
+ }
+ catch (beans::UnknownPropertyException &)
+ {
+ }
+ }
+}
+
+void MyWin::Paint( const Rectangle& r )
+{
+ static BOOL bDraw = TRUE;
+ if ( bDraw && mxView.is() )
+ mxView->draw( 50, 50 );
+}
+