summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/AllLangResTarget_tk.mk45
-rwxr-xr-xtoolkit/JunitTest_toolkit_unoapi.mk53
-rw-r--r--toolkit/Library_tk.mk173
-rw-r--r--toolkit/Makefile38
-rw-r--r--toolkit/Module_toolkit.mk42
-rw-r--r--toolkit/Package_inc.mk67
-rw-r--r--toolkit/Package_source.mk47
-rw-r--r--toolkit/Package_util.mk29
-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.hxx826
-rw-r--r--toolkit/inc/pch/precompiled_toolkit.cxx29
-rw-r--r--toolkit/inc/pch/precompiled_toolkit.hxx346
-rwxr-xr-xtoolkit/inc/toolkit/awt/animatedimagespeer.hxx106
-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/vclxtabpagecontainer.hxx90
-rw-r--r--toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx82
-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.hxx243
-rw-r--r--toolkit/inc/toolkit/awt/vclxwindows.hxx1162
-rw-r--r--toolkit/inc/toolkit/awt/xsimpleanimation.hxx77
-rw-r--r--toolkit/inc/toolkit/awt/xthrobber.hxx80
-rw-r--r--toolkit/inc/toolkit/controls/accessiblecontrolcontext.hxx136
-rwxr-xr-xtoolkit/inc/toolkit/controls/animatedimages.hxx144
-rw-r--r--toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx265
-rw-r--r--toolkit/inc/toolkit/controls/dialogcontrol.hxx131
-rw-r--r--toolkit/inc/toolkit/controls/eventcontainer.hxx142
-rw-r--r--toolkit/inc/toolkit/controls/formattedcontrol.hxx130
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel.hxx262
-rw-r--r--toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.hxx96
-rw-r--r--toolkit/inc/toolkit/controls/roadmapcontrol.hxx206
-rw-r--r--toolkit/inc/toolkit/controls/roadmapentry.hxx91
-rwxr-xr-xtoolkit/inc/toolkit/controls/spinningprogress.hxx70
-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/tabpagecontainer.hxx147
-rw-r--r--toolkit/inc/toolkit/controls/tabpagemodel.hxx146
-rw-r--r--toolkit/inc/toolkit/controls/tkscrollbar.hxx124
-rw-r--r--toolkit/inc/toolkit/controls/tksimpleanimation.hxx101
-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.hxx250
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolbase.hxx77
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainer.hxx167
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolcontainermodel.hxx66
-rw-r--r--toolkit/inc/toolkit/controls/unocontrolmodel.hxx183
-rw-r--r--toolkit/inc/toolkit/controls/unocontrols.hxx1519
-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.hxx263
-rw-r--r--toolkit/inc/toolkit/helper/macros.hxx270
-rw-r--r--toolkit/inc/toolkit/helper/mutexandbroadcasthelper.hxx51
-rw-r--r--toolkit/inc/toolkit/helper/mutexhelper.hxx51
-rw-r--r--toolkit/inc/toolkit/helper/property.hxx252
-rw-r--r--toolkit/inc/toolkit/helper/servicenames.hxx119
-rw-r--r--toolkit/inc/toolkit/helper/solarrelease.hxx82
-rw-r--r--toolkit/inc/toolkit/helper/tkresmgr.hxx78
-rw-r--r--toolkit/inc/toolkit/helper/unomemorystream.hxx73
-rw-r--r--toolkit/inc/toolkit/helper/unopropertyarrayhelper.hxx66
-rw-r--r--toolkit/inc/toolkit/helper/unowrapper.hxx93
-rw-r--r--toolkit/inc/toolkit/helper/vclunohelper.hxx163
-rw-r--r--toolkit/prj/build.lst3
-rw-r--r--toolkit/prj/d.lst0
-rw-r--r--toolkit/prj/makefile.mk40
-rwxr-xr-xtoolkit/qa/complex/toolkit/AccessibleStatusBar.java338
-rwxr-xr-xtoolkit/qa/complex/toolkit/AccessibleStatusBarItem.java381
-rwxr-xr-xtoolkit/qa/complex/toolkit/Assert.java234
-rwxr-xr-xtoolkit/qa/complex/toolkit/GridControl.java687
-rw-r--r--toolkit/qa/complex/toolkit/UnitConversion.java247
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java498
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java273
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java204
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java101
-rwxr-xr-xtoolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java1033
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/DummyColumn.java180
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/GridDataListener.java98
-rwxr-xr-xtoolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java314
-rwxr-xr-xtoolkit/qa/complex/toolkit/makefile.mk97
-rw-r--r--toolkit/qa/unoapi/Test.java52
-rw-r--r--toolkit/qa/unoapi/knownissues.xcl260
-rw-r--r--toolkit/qa/unoapi/makefile.mk48
-rw-r--r--toolkit/qa/unoapi/testdocuments/poliball.gifbin0 -> 945 bytes
-rw-r--r--toolkit/qa/unoapi/toolkit.sce77
-rwxr-xr-xtoolkit/source/awt/animatedimagespeer.cxx538
-rw-r--r--toolkit/source/awt/asynccallback.cxx193
-rw-r--r--toolkit/source/awt/forward.hxx73
-rw-r--r--toolkit/source/awt/non-interactable-containers.xml15
-rw-r--r--toolkit/source/awt/stylesettings.cxx987
-rw-r--r--toolkit/source/awt/stylesettings.hxx188
-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.cxx1103
-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/vclxtabpagecontainer.cxx233
-rw-r--r--toolkit/source/awt/vclxtabpagemodel.cxx150
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx1738
-rw-r--r--toolkit/source/awt/vclxtopwindow.cxx345
-rw-r--r--toolkit/source/awt/vclxwindow.cxx2631
-rw-r--r--toolkit/source/awt/vclxwindow1.cxx108
-rw-r--r--toolkit/source/awt/vclxwindows.cxx6248
-rw-r--r--toolkit/source/awt/xsimpleanimation.cxx149
-rw-r--r--toolkit/source/awt/xthrobber.cxx118
-rw-r--r--toolkit/source/awt/xthrobber.hrc39
-rw-r--r--toolkit/source/awt/xthrobber.src177
-rw-r--r--toolkit/source/controls/accessiblecontrolcontext.cxx380
-rwxr-xr-xtoolkit/source/controls/animatedimages.cxx493
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx1860
-rw-r--r--toolkit/source/controls/dialogcontrol.cxx503
-rw-r--r--toolkit/source/controls/eventcontainer.cxx214
-rw-r--r--toolkit/source/controls/formattedcontrol.cxx470
-rw-r--r--toolkit/source/controls/geometrycontrolmodel.cxx653
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx392
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.hxx97
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx439
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.hxx118
-rw-r--r--toolkit/source/controls/grid/gridcolumn.cxx329
-rw-r--r--toolkit/source/controls/grid/gridcolumn.hxx135
-rw-r--r--toolkit/source/controls/grid/gridcontrol.cxx453
-rw-r--r--toolkit/source/controls/grid/gridcontrol.hxx132
-rwxr-xr-xtoolkit/source/controls/grid/grideventforwarder.cxx149
-rwxr-xr-xtoolkit/source/controls/grid/grideventforwarder.hxx85
-rwxr-xr-xtoolkit/source/controls/grid/initguard.hxx64
-rwxr-xr-xtoolkit/source/controls/grid/sortablegriddatamodel.cxx877
-rwxr-xr-xtoolkit/source/controls/grid/sortablegriddatamodel.hxx198
-rw-r--r--toolkit/source/controls/roadmapcontrol.cxx503
-rw-r--r--toolkit/source/controls/roadmapentry.cxx126
-rwxr-xr-xtoolkit/source/controls/spinningprogress.cxx140
-rw-r--r--toolkit/source/controls/stdtabcontroller.cxx428
-rw-r--r--toolkit/source/controls/stdtabcontrollermodel.cxx408
-rw-r--r--toolkit/source/controls/tabpagecontainer.cxx295
-rw-r--r--toolkit/source/controls/tabpagemodel.cxx396
-rw-r--r--toolkit/source/controls/tkscrollbar.cxx296
-rw-r--r--toolkit/source/controls/tksimpleanimation.cxx191
-rw-r--r--toolkit/source/controls/tkspinbutton.cxx352
-rw-r--r--toolkit/source/controls/tkthrobber.cxx201
-rw-r--r--toolkit/source/controls/tree/treecontrol.cxx513
-rw-r--r--toolkit/source/controls/tree/treecontrol.hxx138
-rw-r--r--toolkit/source/controls/tree/treedatamodel.cxx673
-rw-r--r--toolkit/source/controls/unocontrol.cxx1621
-rw-r--r--toolkit/source/controls/unocontrolbase.cxx294
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx838
-rw-r--r--toolkit/source/controls/unocontrolcontainermodel.cxx90
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx1480
-rw-r--r--toolkit/source/controls/unocontrols.cxx4396
-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.cxx219
-rw-r--r--toolkit/source/helper/property.cxx409
-rw-r--r--toolkit/source/helper/registerservices.cxx334
-rw-r--r--toolkit/source/helper/servicenames.cxx113
-rw-r--r--toolkit/source/helper/tkresmgr.cxx131
-rw-r--r--toolkit/source/helper/unomemorystream.cxx108
-rw-r--r--toolkit/source/helper/unopropertyarrayhelper.cxx160
-rw-r--r--toolkit/source/helper/unowrapper.cxx339
-rw-r--r--toolkit/source/helper/vclunohelper.cxx800
-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.cxx173
-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.cxx123
-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.cxx325
-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/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/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.cxx1620
-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.lst300
-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.lst120
-rw-r--r--toolkit/src2xml/src.lst679
-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/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/tools/NameProvider.java259
-rw-r--r--toolkit/uiconfig/layout/delzip1
-rw-r--r--toolkit/uiconfig/layout/message-box.xml41
-rw-r--r--toolkit/uiconfig/layout/tab-dialog.xml20
-rw-r--r--toolkit/util/tk.component322
-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/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.src339
-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/no_localization1
-rw-r--r--toolkit/workben/unodialog.cxx269
424 files changed, 98222 insertions, 0 deletions
diff --git a/toolkit/AllLangResTarget_tk.mk b/toolkit/AllLangResTarget_tk.mk
new file mode 100644
index 000000000000..e127bef851c6
--- /dev/null
+++ b/toolkit/AllLangResTarget_tk.mk
@@ -0,0 +1,45 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_AllLangResTarget_AllLangResTarget,tk))
+
+$(eval $(call gb_AllLangResTarget_set_reslocation,tk,toolkit))
+
+$(eval $(call gb_AllLangResTarget_add_srs,tk,\
+ toolkit/awt \
+))
+
+$(eval $(call gb_SrsTarget_SrsTarget,toolkit/awt))
+
+$(eval $(call gb_SrsTarget_set_include,toolkit/awt,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/toolkit/source/awt \
+))
+
+$(eval $(call gb_SrsTarget_add_files,toolkit/awt,\
+ toolkit/source/awt/xthrobber.src \
+))
diff --git a/toolkit/JunitTest_toolkit_unoapi.mk b/toolkit/JunitTest_toolkit_unoapi.mk
new file mode 100755
index 000000000000..27dc89e13478
--- /dev/null
+++ b/toolkit/JunitTest_toolkit_unoapi.mk
@@ -0,0 +1,53 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_JunitTest_JunitTest,toolkit_unoapi))
+
+$(eval $(call gb_JunitTest_set_defs,toolkit_unoapi,\
+ $$(DEFS) \
+ -Dorg.openoffice.test.arg.sce=$(SRCDIR)/toolkit/qa/unoapi/toolkit.sce \
+ -Dorg.openoffice.test.arg.xcl=$(SRCDIR)/toolkit/qa/unoapi/knownissues.xcl \
+ -Dorg.openoffice.test.arg.tdoc=$(SRCDIR)/toolkit/qa/unoapi/testdocuments \
+))
+
+$(eval $(call gb_JunitTest_add_jars,toolkit_unoapi,\
+ $(OUTDIR)/bin/OOoRunner.jar \
+ $(OUTDIR)/bin/ridl.jar \
+ $(OUTDIR)/bin/test.jar \
+ $(OUTDIR)/bin/unoil.jar \
+ $(OUTDIR)/bin/jurt.jar \
+))
+
+$(eval $(call gb_JunitTest_add_sourcefiles,toolkit_unoapi,\
+ toolkit/qa/unoapi/Test \
+))
+
+$(eval $(call gb_JunitTest_add_classes,toolkit_unoapi,\
+ org.openoffice.toolkit.qa.unoapi.Test \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/toolkit/Library_tk.mk b/toolkit/Library_tk.mk
new file mode 100644
index 000000000000..caf1c045be03
--- /dev/null
+++ b/toolkit/Library_tk.mk
@@ -0,0 +1,173 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Library_Library,tk))
+
+$(eval $(call gb_Library_set_componentfile,tk,toolkit/util/tk))
+
+$(eval $(call gb_Library_add_package_headers,tk,toolkit_inc))
+
+#$(eval $(call gb_Library_add_precompiled_header,tk,$(SRCDIR)/toolkit/inc/pch/precompiled_toolkit))
+
+$(eval $(call gb_Library_set_include,tk,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/toolkit/inc \
+ -I$(SRCDIR)/toolkit/inc/pch \
+ -I$(SRCDIR)/toolkit/source \
+ -I$(OUTDIR)/inc/offuh \
+))
+
+$(eval $(call gb_Library_set_defs,tk,\
+ $$(DEFS) \
+ -DTOOLKIT_DLLIMPLEMENTATION \
+))
+
+$(eval $(call gb_Library_add_linked_libs,tk,\
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ stl \
+ tl \
+ utl \
+ vcl \
+ $(gb_STDLIBS) \
+))
+
+$(eval $(call gb_Library_add_exception_objects,tk,\
+ toolkit/source/awt/asynccallback \
+ toolkit/source/awt/stylesettings \
+ toolkit/source/awt/vclxaccessiblecomponent \
+ toolkit/source/awt/vclxbitmap \
+ toolkit/source/awt/vclxbutton \
+ toolkit/source/awt/vclxcontainer \
+ toolkit/source/awt/vclxdevice \
+ toolkit/source/awt/vclxdialog \
+ toolkit/source/awt/vclxfixedline \
+ toolkit/source/awt/vclxfont \
+ toolkit/source/awt/vclxgraphics \
+ toolkit/source/awt/vclxmenu \
+ toolkit/source/awt/vclxplugin \
+ toolkit/source/awt/vclxpointer \
+ toolkit/source/awt/vclxprinter \
+ toolkit/source/awt/vclxregion \
+ toolkit/source/awt/vclxscroller \
+ toolkit/source/awt/vclxspinbutton \
+ toolkit/source/awt/vclxsplitter \
+ toolkit/source/awt/vclxsystemdependentwindow \
+ toolkit/source/awt/vclxtabcontrol \
+ toolkit/source/awt/vclxtabpage \
+ toolkit/source/awt/vclxtabpagecontainer \
+ toolkit/source/awt/animatedimagespeer \
+ toolkit/source/awt/vclxtoolkit \
+ toolkit/source/awt/vclxtopwindow \
+ toolkit/source/awt/vclxwindow \
+ toolkit/source/awt/vclxwindow1 \
+ toolkit/source/awt/vclxwindows \
+ toolkit/source/awt/xsimpleanimation \
+ toolkit/source/awt/xthrobber \
+ toolkit/source/controls/accessiblecontrolcontext \
+ toolkit/source/controls/controlmodelcontainerbase \
+ toolkit/source/controls/dialogcontrol \
+ toolkit/source/controls/eventcontainer \
+ toolkit/source/controls/formattedcontrol \
+ toolkit/source/controls/geometrycontrolmodel \
+ toolkit/source/controls/grid/defaultgridcolumnmodel \
+ toolkit/source/controls/grid/defaultgriddatamodel \
+ toolkit/source/controls/grid/gridcolumn \
+ toolkit/source/controls/grid/grideventforwarder \
+ toolkit/source/controls/grid/sortablegriddatamodel \
+ toolkit/source/controls/grid/gridcontrol \
+ toolkit/source/controls/roadmapcontrol \
+ toolkit/source/controls/roadmapentry \
+ toolkit/source/controls/tabpagecontainer \
+ toolkit/source/controls/tabpagemodel \
+ toolkit/source/controls/stdtabcontroller \
+ toolkit/source/controls/stdtabcontrollermodel \
+ toolkit/source/controls/tkscrollbar \
+ toolkit/source/controls/tksimpleanimation \
+ toolkit/source/controls/tkspinbutton \
+ toolkit/source/controls/tkthrobber \
+ toolkit/source/controls/animatedimages \
+ toolkit/source/controls/spinningprogress \
+ toolkit/source/controls/tree/treecontrol \
+ toolkit/source/controls/tree/treedatamodel \
+ toolkit/source/controls/unocontrol \
+ toolkit/source/controls/unocontrolbase \
+ toolkit/source/controls/unocontrolcontainer \
+ toolkit/source/controls/unocontrolcontainermodel \
+ toolkit/source/controls/unocontrolmodel \
+ toolkit/source/controls/unocontrols \
+ toolkit/source/helper/accessibilityclient \
+ toolkit/source/helper/externallock \
+ toolkit/source/helper/fixedhyperbase \
+ toolkit/source/helper/formpdfexport \
+ toolkit/source/helper/imagealign \
+ toolkit/source/helper/listenermultiplexer \
+ toolkit/source/helper/property \
+ toolkit/source/helper/registerservices \
+ toolkit/source/helper/servicenames \
+ toolkit/source/helper/tkresmgr \
+ toolkit/source/helper/unomemorystream \
+ toolkit/source/helper/unopropertyarrayhelper \
+ toolkit/source/helper/unowrapper \
+ toolkit/source/helper/vclunohelper \
+ toolkit/source/layout/core/bin \
+ toolkit/source/layout/core/box \
+ toolkit/source/layout/core/box-base \
+ toolkit/source/layout/core/byteseq \
+ toolkit/source/layout/core/container \
+ toolkit/source/layout/core/dialogbuttonhbox \
+ toolkit/source/layout/core/factory \
+ toolkit/source/layout/core/flow \
+ toolkit/source/layout/core/helper \
+ toolkit/source/layout/core/import \
+ toolkit/source/layout/core/localized-string \
+ toolkit/source/layout/core/proplist \
+ toolkit/source/layout/core/root \
+ toolkit/source/layout/core/table \
+ toolkit/source/layout/core/timer \
+ toolkit/source/layout/core/translate \
+ toolkit/source/layout/core/vcl \
+ toolkit/source/layout/vcl/wbutton \
+ toolkit/source/layout/vcl/wcontainer \
+ toolkit/source/layout/vcl/wfield \
+ toolkit/source/layout/vcl/wrapper \
+))
+
+ifeq ($(GUIBASE),aqua)
+$(eval $(call gb_Library_set_cxxflags,tk,\
+ $$(CXXFLAGS) $(gb_OBJCXXFLAGS)))
+endif
+
+ifeq ($(OS),LINUX)
+$(eval $(call gb_Library_add_linked_libs,tk,\
+ X11 \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/toolkit/Makefile b/toolkit/Makefile
new file mode 100644
index 000000000000..a79aff831024
--- /dev/null
+++ b/toolkit/Makefile
@@ -0,0 +1,38 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+ifeq ($(strip $(SOLARENV)),)
+$(error No environment set!)
+endif
+
+gb_PARTIALBUILD := T
+GBUILDDIR := $(SOLARENV)/gbuild
+include $(GBUILDDIR)/gbuild.mk
+
+$(eval $(call gb_Module_make_global_targets,$(shell ls $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/Module*.mk)))
+
+# vim: set noet sw=4 ts=4:
diff --git a/toolkit/Module_toolkit.mk b/toolkit/Module_toolkit.mk
new file mode 100644
index 000000000000..858aecd1c13d
--- /dev/null
+++ b/toolkit/Module_toolkit.mk
@@ -0,0 +1,42 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Module_Module,toolkit))
+
+$(eval $(call gb_Module_add_targets,toolkit,\
+ AllLangResTarget_tk \
+ Library_tk \
+ Package_inc \
+ Package_source \
+ Package_util \
+))
+
+$(eval $(call gb_Module_add_subsequentcheck_targets,toolkit,\
+ JunitTest_toolkit_unoapi \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/toolkit/Package_inc.mk b/toolkit/Package_inc.mk
new file mode 100644
index 000000000000..88832533490c
--- /dev/null
+++ b/toolkit/Package_inc.mk
@@ -0,0 +1,67 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,toolkit_inc,$(SRCDIR)/toolkit/inc))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/layout/layout-post.hxx,layout/layout-post.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/layout/layout-pre.hxx,layout/layout-pre.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/layout/layout.hxx,layout/layout.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxaccessiblecomponent.hxx,toolkit/awt/vclxaccessiblecomponent.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxcontainer.hxx,toolkit/awt/vclxcontainer.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxdevice.hxx,toolkit/awt/vclxdevice.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxfont.hxx,toolkit/awt/vclxfont.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxmenu.hxx,toolkit/awt/vclxmenu.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxsystemdependentwindow.hxx,toolkit/awt/vclxsystemdependentwindow.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxtoolkit.hxx,toolkit/awt/vclxtoolkit.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxtopwindow.hxx,toolkit/awt/vclxtopwindow.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxwindow.hxx,toolkit/awt/vclxwindow.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/awt/vclxwindows.hxx,toolkit/awt/vclxwindows.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/controls/unocontrol.hxx,toolkit/controls/unocontrol.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/controls/unocontrolbase.hxx,toolkit/controls/unocontrolbase.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/controls/unocontrolmodel.hxx,toolkit/controls/unocontrolmodel.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/controls/unocontrols.hxx,toolkit/controls/unocontrols.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/dllapi.h,toolkit/dllapi.h))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/accessibilityclient.hxx,toolkit/helper/accessibilityclient.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/accessiblefactory.hxx,toolkit/helper/accessiblefactory.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/convert.hxx,toolkit/helper/convert.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/emptyfontdescriptor.hxx,toolkit/helper/emptyfontdescriptor.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/externallock.hxx,toolkit/helper/externallock.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/fixedhyperbase.hxx,toolkit/helper/fixedhyperbase.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/formpdfexport.hxx,toolkit/helper/formpdfexport.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/imagealign.hxx,toolkit/helper/imagealign.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/listenermultiplexer.hxx,toolkit/helper/listenermultiplexer.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/macros.hxx,toolkit/helper/macros.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/mutexandbroadcasthelper.hxx,toolkit/helper/mutexandbroadcasthelper.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/mutexhelper.hxx,toolkit/helper/mutexhelper.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/property.hxx,toolkit/helper/property.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/servicenames.hxx,toolkit/helper/servicenames.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/solarrelease.hxx,toolkit/helper/solarrelease.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/tkresmgr.hxx,toolkit/helper/tkresmgr.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/unomemorystream.hxx,toolkit/helper/unomemorystream.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/unopropertyarrayhelper.hxx,toolkit/helper/unopropertyarrayhelper.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/unowrapper.hxx,toolkit/helper/unowrapper.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/helper/vclunohelper.hxx,toolkit/helper/vclunohelper.hxx))
+$(eval $(call gb_Package_add_file,toolkit_inc,inc/toolkit/unohlp.hxx,toolkit/helper/vclunohelper.hxx))
diff --git a/toolkit/Package_source.mk b/toolkit/Package_source.mk
new file mode 100644
index 000000000000..6dd69fda6098
--- /dev/null
+++ b/toolkit/Package_source.mk
@@ -0,0 +1,47 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,toolkit_source,$(SRCDIR)/toolkit/source))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/bin.hxx,layout/core/bin.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/box-base.hxx,layout/core/box-base.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/box.hxx,layout/core/box.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/container.hxx,layout/core/container.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/dialogbuttonhbox.hxx,layout/core/dialogbuttonhbox.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/factory.hxx,layout/core/factory.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/flow.hxx,layout/core/flow.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/helper.hxx,layout/core/helper.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/import.hxx,layout/core/import.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/localized-string.hxx,layout/core/localized-string.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/precompiled_xmlscript.hxx,layout/core/precompiled_xmlscript.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/proplist.hxx,layout/core/proplist.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/root.hxx,layout/core/root.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/table.hxx,layout/core/table.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/timer.hxx,layout/core/timer.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/translate.hxx,layout/core/translate.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/core/vcl.hxx,layout/core/vcl.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/layout/vcl/wrapper.hxx,layout/vcl/wrapper.hxx))
+$(eval $(call gb_Package_add_file,toolkit_source,inc/toolkit/awt/vclxdialog.hxx,awt/vclxdialog.hxx))
diff --git a/toolkit/Package_util.mk b/toolkit/Package_util.mk
new file mode 100644
index 000000000000..b8580d0205c8
--- /dev/null
+++ b/toolkit/Package_util.mk
@@ -0,0 +1,29 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+$(eval $(call gb_Package_Package,toolkit_util,$(SRCDIR)/toolkit/util))
+$(eval $(call gb_Package_add_file,toolkit_util,xml/toolkit.xml,toolkit.xml))
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..c434347b38e2
--- /dev/null
+++ b/toolkit/inc/layout/layout.hxx
@@ -0,0 +1,826 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <tools/fldunit.hxx>
+#include <vcl/lstbox.h>
+#include <tools/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( const rtl::OString& id );
+ const rtl::OString& GetHelpId() 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, const rtl::OString& help_id=rtl::OString(),\
+ 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 (),\
+ const rtl::OString& help_id=rtl::OString(),\
+ 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, const rtl::OString& help_id=rtl::OString(),\
+ 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 (),\
+ const rtl::OString& help_id=rtl::OString(),\
+ 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, const rtl::OString& help_id);
+ void init (rtl::OUString const& message,
+ rtl::OUString const& yes, rtl::OUString const& no, const rtl::OString& help_id);
+ void init (char const* message, char const* yes, char const* no, const rtl::OString& 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 (sal_uInt16 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/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..77be02429484
--- /dev/null
+++ b/toolkit/inc/pch/precompiled_toolkit.hxx
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/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/jobset.hxx"
+#include "tools/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/animatedimagespeer.hxx b/toolkit/inc/toolkit/awt/animatedimagespeer.hxx
new file mode 100755
index 000000000000..b9bdecdf0e47
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/animatedimagespeer.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 TOOLKIT_ANIMATEDIMAGEPEER_HXX
+#define TOOLKIT_ANIMATEDIMAGEPEER_HXX
+
+#include "toolkit/awt/vclxwindow.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XAnimation.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase3.hxx>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= AnimatedImagesPeer
+ //==================================================================================================================
+ struct AnimatedImagesPeer_Data;
+ typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow
+ , ::com::sun::star::awt::XAnimation
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XModifyListener
+ > AnimatedImagesPeer_Base;
+
+ class AnimatedImagesPeer :public AnimatedImagesPeer_Base
+ ,public ::boost::noncopyable
+ {
+ public:
+ AnimatedImagesPeer();
+
+ protected:
+ ~AnimatedImagesPeer();
+
+ public:
+ // XAnimation
+ virtual void SAL_CALL startAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stopAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAnimationRunning( ) 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);
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XModifyListener
+ virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ protected:
+ void ProcessWindowEvent( const VclWindowEvent& i_windowEvent );
+
+ private:
+ /** updates our images with the ones from the givem XAnimatedImages component
+ */
+ void impl_updateImages_nolck( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_animatedImages );
+
+ private:
+ ::boost::scoped_ptr< AnimatedImagesPeer_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_ANIMATEDIMAGEPEER_HXX
diff --git a/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx b/toolkit/inc/toolkit/awt/vclxaccessiblecomponent.hxx
new file mode 100644
index 000000000000..2c3744a2eefe
--- /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;
+
+ sal_uLong nDummy1;
+ sal_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..dbf8c62f4580
--- /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 TOOLKIT_DLLPUBLIC 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..ca0b20a3f4bc
--- /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 sal_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:
+ vos::IMutex& mrMutex; // Reference to SolarMutex
+ OutputDevice* mpOutputDevice;
+
+public:
+ void* pDummy;
+ sal_uInt32 nFlags;
+
+protected:
+ 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..352dae82c853
--- /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:
+ sal_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..6a076a5339b8
--- /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:
+ 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:
+ 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..7eee1bfea7c4
--- /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( sal_Bool bPopup );
+
+public:
+ VCLXMenu();
+ VCLXMenu( Menu* pMenu );
+ ~VCLXMenu();
+
+
+ Menu* GetMenu() const { return mpMenu; }
+ sal_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..73bd100c2bb7
--- /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 TOOLKIT_DLLPUBLIC 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/vclxtabpagecontainer.hxx b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx
new file mode 100644
index 000000000000..d4fe2a727b43
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtabpagecontainer.hxx
@@ -0,0 +1,90 @@
+// ----------------------------------------------------
+// class VCLXDialog
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_VCLXTABPAGECONTAINER_HXX_
+#define _TOOLKIT_AWT_VCLXTABPAGECONTAINER_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/container/XContainerListener.hpp>
+#include "toolkit/awt/vclxwindow.hxx"
+//#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainer.hpp>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <toolkit/awt/vclxcontainer.hxx>
+
+// ----------------------------------------------------
+typedef ::cppu::ImplInheritanceHelper2 < VCLXContainer
+ , ::com::sun::star::awt::tab::XTabPageContainer
+ , ::com::sun::star::container::XContainerListener
+ > VCLXTabPageContainer_Base;
+class VCLXTabPageContainer : public VCLXTabPageContainer_Base
+{
+public:
+ VCLXTabPageContainer();
+ ~VCLXTabPageContainer();
+
+ // ::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::grid::XTabPageContainer
+ virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) 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 ); }
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) 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);
+protected:
+ virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+private:
+ sal_Int16 m_nActiveTabPageId;
+ TabPageListenerMultiplexer m_aTabPageListeners;
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > > m_aTabPages;
+};
+#endif // _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
diff --git a/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx
new file mode 100644
index 000000000000..670ed25c0f2d
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxtabpagemodel.hxx
@@ -0,0 +1,82 @@
+// ----------------------------------------------------
+// class VCLXDialog
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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_VCLXTABPAGEMODEL_HXX_
+#define _TOOLKIT_AWT_VCLXTABPAGEMODEL_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 "toolkit/awt/vclxwindow.hxx"
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include "forward.hxx"
+#include <cppuhelper/implbase1.hxx>
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel,
+ ::com::sun::star::awt::tab::XTabPageModel
+ > VCLXTabPageModel_Base;
+class VCLXTabPageModel : public VCLXTabPageModel_Base
+{
+public:
+ VCLXTabPageModel();
+ VCLXTabPageModel( const VCLXTabPageModel& rModel ) : VCLXTabPageModel_Base( rModel ) {;}
+ ~VCLXTabPageModel();
+
+ // ::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);
+
+ // virtual void GetPropertyIds( std::list< sal_uInt16 > &aIds ) { return ImplGetPropertyIds( aIds ); }
+ UnoControlModel* Clone() const { return new VCLXTabPageModel( *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::awt::XVclWindowPeer
+ void SAL_CALL setProperty( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Any& Value ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageModel
+ virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) 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& _title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+protected:
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+};
+#endif // _TOOLKIT_AWT_VCLXTABPAGEMODEL_HXX_
diff --git a/toolkit/inc/toolkit/awt/vclxtoolkit.hxx b/toolkit/inc/toolkit/awt/vclxtoolkit.hxx
new file mode 100644
index 000000000000..31de39bf1fc3
--- /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 <tools/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..d3b130cc8202
--- /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 TOOLKIT_DLLPUBLIC 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..81419fcafa0f
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxwindow.hxx
@@ -0,0 +1,243 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <com/sun/star/awt/XStyleSettingsSupplier.hpp>
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase9.hxx>
+#include <osl/mutex.hxx>
+
+#include <tools/gen.hxx> // Size
+#include <tools/link.hxx>
+
+#include <stdarg.h>
+#include <list>
+#include <boost/function.hpp>
+
+class Window;
+class VclSimpleEvent;
+class VclWindowEvent;
+struct AccessibilityInfos;
+struct SystemParentData;
+
+namespace toolkit
+{
+ class IAccessibleFactory;
+}
+
+
+// ----------------------------------------------------
+// class VCLXWINDOW
+// ----------------------------------------------------
+
+class UnoPropertyArrayHelper;
+class VCLXWindowImpl;
+typedef ::cppu::ImplInheritanceHelper9 < 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
+ , ::com::sun::star::awt::XStyleSettingsSupplier
+ > 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 );
+ sal_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:
+ typedef ::boost::function0< void > Callback;
+
+protected:
+ /** executes the given callback asynchronously
+
+ At the moment the callback is called, the Solar Mutex is not locked. In particular, this implies that
+ you cannot rely on |this| not being disposed. However, you *can* rely on |this| being still alive (i.e.
+ having a ref count > 0).
+
+ As a consequence, this can be used for doing listener notifications, using event multiplexers. Those multiplexers
+ care for the disposed state themself, and are alive as long as |this| is alive.
+ */
+ void ImplExecuteAsyncWithoutSolarLock(
+ const Callback& i_callback
+ );
+
+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);
+
+ // XStyleSettingsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings > SAL_CALL getStyleSettings() 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..8dcf05c9f8db
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -0,0 +1,1162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/XDialog2.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/XItemListListener.hpp>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/implbase3.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/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 VCLXGraphicControl
+// deriving from VCLXWindow, drawing the graphic which exists as "Graphic" at the model
+// ----------------------------------------------------
+
+
+class TOOLKIT_DLLPUBLIC VCLXGraphicControl : public VCLXWindow
+{
+private:
+ /// the image we currently display
+ Image maImage;
+
+protected:
+ const Image& GetImage() const { return maImage; }
+
+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::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:
+ /** 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 < VCLXGraphicControl
+ , ::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 VCLXGraphicControl
+{
+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 VCLXGraphicControl
+{
+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 VCLXGraphicControl
+{
+private:
+ ItemListenerMultiplexer maItemListeners;
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+protected:
+ void ImplClickedOrToggled( sal_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 TOOLKIT_DLLPUBLIC VCLXDialog : public ::com::sun::star::awt::XDialog2,
+ 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::XDialog2
+ virtual void SAL_CALL endDialog( ::sal_Int32 Result ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpId( const rtl::OUString& Id ) 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
+// ----------------------------------------------------
+typedef ::cppu::ImplInheritanceHelper3 < VCLXWindow
+ , ::com::sun::star::awt::XListBox
+ , ::com::sun::star::awt::XTextLayoutConstrains
+ , ::com::sun::star::awt::XItemListListener
+ > VCLXListBox_Base;
+class VCLXListBox : public VCLXListBox_Base
+{
+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::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);
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_rEvent ) 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
+// ----------------------------------------------------
+typedef ::cppu::ImplInheritanceHelper2 < VCLXEdit
+ , ::com::sun::star::awt::XComboBox
+ , ::com::sun::star::awt::XItemListListener > VCLXComboBox_Base;
+class VCLXComboBox : public VCLXComboBox_Base
+{
+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::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);
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_rEvent ) 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..9e6043b7d9ef
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/xsimpleanimation.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_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>
+
+#include <boost/scoped_ptr.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= XSimpleAnimation
+ //====================================================================
+ typedef ::cppu::ImplInheritanceHelper1 < VCLXWindow
+ , ::com::sun::star::awt::XSimpleAnimation
+ > XSimpleAnimation_Base;
+
+ class XSimpleAnimation : public XSimpleAnimation_Base
+ {
+ public:
+ XSimpleAnimation();
+
+ protected:
+ ~XSimpleAnimation();
+
+ // 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);
+
+ 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..67015e049a48
--- /dev/null
+++ b/toolkit/inc/toolkit/awt/xthrobber.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_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>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ //====================================================================
+ //= XThrobber
+ //====================================================================
+ typedef ::cppu::ImplInheritanceHelper1 < VCLXWindow
+ , ::com::sun::star::awt::XThrobber
+ > XThrobber_Base;
+
+ class XThrobber :public XThrobber_Base
+ ,public ::boost::noncopyable
+ {
+ private:
+ void SAL_CALL InitImageList() throw(::com::sun::star::uno::RuntimeException);
+
+ public:
+ XThrobber();
+
+ protected:
+ ~XThrobber();
+
+ // XThrobber
+ virtual void SAL_CALL start() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stop() throw (::com::sun::star::uno::RuntimeException);
+
+ // VCLXWindow
+ virtual void SetWindow( Window* pWindow );
+
+ 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/animatedimages.hxx b/toolkit/inc/toolkit/controls/animatedimages.hxx
new file mode 100755
index 000000000000..c19ed5e5451c
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/animatedimages.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 TOOLKIT_ANIMATEDIMAGES_HXX
+#define TOOLKIT_ANIMATEDIMAGES_HXX
+
+#include "toolkit/controls/unocontrolbase.hxx"
+#include "toolkit/controls/unocontrolmodel.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XAnimation.hpp>
+#include <com/sun/star/awt/XAnimatedImages.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //=
+ //==================================================================================================================
+ typedef ::cppu::AggImplInheritanceHelper2 < UnoControlBase
+ , ::com::sun::star::awt::XAnimation
+ , ::com::sun::star::container::XContainerListener
+ > AnimatedImagesControl_Base;
+
+ class AnimatedImagesControl : public AnimatedImagesControl_Base
+ {
+ public:
+ AnimatedImagesControl( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
+ ::rtl::OUString GetComponentServiceName();
+
+ // XAnimation
+ virtual void SAL_CALL startAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL stopAnimation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isAnimationRunning( ) 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);
+
+ // XControl
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& i_rModel ) throw ( ::com::sun::star::uno::RuntimeException );
+ void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& i_toolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& i_parentPeer ) throw(::com::sun::star::uno::RuntimeException);
+
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //==================================================================================================================
+ //= AnimatedImagesControlModel
+ //==================================================================================================================
+ struct AnimatedImagesControlModel_Data;
+ typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::XAnimatedImages
+ > AnimatedImagesControlModel_Base;
+ class AnimatedImagesControlModel : public AnimatedImagesControlModel_Base
+ {
+ public:
+ AnimatedImagesControlModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
+ AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource );
+
+ virtual UnoControlModel* Clone() const;
+
+ // XPropertySet
+ ::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);
+
+ // XAnimatedImages
+ virtual ::sal_Int32 SAL_CALL getStepTime() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setStepTime( ::sal_Int32 _steptime ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getAutoRepeat() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAutoRepeat( ::sal_Bool _autorepeat ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getScaleMode() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getImageSetCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getImageSet( ::sal_Int32 i_index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertImageSet( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& i_imageURLs ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL replaceImageSet( ::sal_Int32 i_index, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& i_imageURLs ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeImageSet( ::sal_Int32 i_index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAnimatedImages::XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ ~AnimatedImagesControlModel();
+
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
+ private:
+ ::boost::scoped_ptr< AnimatedImagesControlModel_Data >
+ m_pData;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_ANIMATEDIMAGES_HXX
diff --git a/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
new file mode 100644
index 000000000000..3090eba68749
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/controlmodelcontainerbase.hxx
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_CONTROL_MODEL_CONTAINERBASE_HXX
+#define TOOLKIT_CONTROL_MODEL_CONTAINERBASE_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/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/resource/XStringResourceResolver.hpp>
+#include <cppuhelper/implbase8.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+// ----------------------------------------------------
+// class ControlModelContainerBase
+// ----------------------------------------------------
+typedef UnoControlModel ControlModel_Base;
+typedef ::cppu::AggImplInheritanceHelper8 < ControlModel_Base
+ , ::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
+ , ::com::sun::star::awt::tab::XTabPageModel
+ , ::com::sun::star::lang::XInitialization
+ > ControlModelContainer_IBase;
+
+class ControlModelContainerBase : public ControlModelContainer_IBase
+{
+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;
+
+protected:
+ ContainerListenerMultiplexer maContainerListeners;
+ ::cppu::OInterfaceContainerHelper maChangeListeners;
+ UnoControlModelHolderList maModels;
+
+ AllGroups maGroups;
+ sal_Bool mbGroupsUpToDate;
+
+ bool m_bEnabled;
+ ::rtl::OUString m_sTitle;
+ ::rtl::OUString m_sImageURL;
+ ::rtl::OUString m_sTooltip;
+ sal_Int16 m_nTabPageId;
+
+ void Clone_Impl(ControlModelContainerBase& _rClone) const;
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ UnoControlModelHolderList::iterator ImplFindElement( const ::rtl::OUString& rName );
+
+public:
+ ControlModelContainerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ControlModelContainerBase( const ControlModelContainerBase& rModel );
+ ~ControlModelContainerBase();
+
+ UnoControlModel* Clone() const;
+
+ // ::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::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);
+
+ // 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(ControlModelContainerBase, ControlModel_Base, "toolkit.ControlModelContainerBase" )
+
+ // XInitialization
+ virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::tab::XTabPageModel
+ virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) 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& _title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+
+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 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;
+};
+
+typedef ::cppu::AggImplInheritanceHelper2 < UnoControlContainer
+ , ::com::sun::star::container::XContainerListener
+ , ::com::sun::star::util::XChangesListener
+ > ContainerControl_IBase;
+
+class ControlContainerBase : public ContainerControl_IBase
+{
+protected:
+ bool mbSizeModified;
+ bool mbPosModified;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabController > mxTabController;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > mxListener;
+
+ 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 );
+ virtual void ImplSetPosSize( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxCtrl );
+ void ImplUpdateResourceResolver();
+ void ImplStartListingForResourceEvents();
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL );
+
+ ControlContainerBase();
+
+public:
+ ControlContainerBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ~ControlContainerBase();
+
+ DECLIMPL_SERVICEINFO_DERIVED( ControlContainerBase, UnoControlBase, "toolkit.ControlContainerBase" )
+
+ 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);
+
+ 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::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);
+
+ // XChangesListener
+ virtual void SAL_CALL changesOccurred( const ::com::sun::star::util::ChangesEvent& Event ) 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);
+protected:
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
+ 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
diff --git a/toolkit/inc/toolkit/controls/dialogcontrol.hxx b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
new file mode 100644
index 000000000000..17b958aeace9
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/dialogcontrol.hxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/macros.hxx"
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <list>
+
+// ----------------------------------------------------
+// class UnoControlDialogModel
+// ----------------------------------------------------
+
+class UnoControlDialogModel : public ControlModelContainerBase
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+public:
+ UnoControlDialogModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlDialogModel( const UnoControlDialogModel& rModel );
+ ~UnoControlDialogModel();
+
+ 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( UnoControlDialogModel, ControlModelContainerBase, szServiceName2_UnoControlDialogModel )
+
+};
+
+class UnoDialogControl :public ControlContainerBase,
+ public ::com::sun::star::awt::XTopWindow,
+ public ::com::sun::star::awt::XDialog,
+ public ::com::sun::star::awt::XWindowListener
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMenuBar > mxMenuBar;
+ TopWindowListenerMultiplexer maTopWindowListeners;
+ bool mbWindowListener;
+
+public:
+
+ UnoDialogControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ~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::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);
+
+ // 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 );
+ virtual void ImplModelPropertiesChanged( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& rEvents ) throw(::com::sun::star::uno::RuntimeException);
+protected:
+};
+
+#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..93f675dae03f
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/formattedcontrol.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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..ef86ec8eb5b8
--- /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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+
+ 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..0b2362656433
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/geometrycontrolmodel_impl.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.
+ *
+ ************************************************************************/
+
+// no include protection. This is included from within geometrycontrolmodel.hxx only
+
+//====================================================================
+//= OGeometryControlModel
+//====================================================================
+//--------------------------------------------------------------------
+template <class CONTROLMODEL>
+OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :OGeometryControlModel_Base(new CONTROLMODEL( i_factory ) )
+{
+}
+
+//template <class CONTROLMODEL>
+//OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & i_xCompContext)
+// :OGeometryControlModel_Base(new CONTROLMODEL(i_xCompContext))
+//{
+//}
+//
+//--------------------------------------------------------------------
+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..0848fb21b8b5
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/roadmapcontrol.hxx
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase4.hxx>
+
+
+#include <comphelper/uno3.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ typedef GraphicControlModel UnoControlRoadmapModel_Base;
+
+
+ typedef ::cppu::ImplHelper3 < ::com::sun::star::lang::XSingleServiceFactory
+ , ::com::sun::star::container::XContainer
+ , ::com::sun::star::container::XIndexContainer
+ > 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;
+
+
+ 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;
+
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlRoadmapModel, UnoControlRoadmapModel_Base, szServiceName2_UnoControlRoadmapModel )
+
+ 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 UnoControlRoadmapModel_Base::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() { UnoControlRoadmapModel_Base::acquire(); }
+ void SAL_CALL release() throw() { UnoControlRoadmapModel_Base::release(); }
+
+
+ // ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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 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);
+
+ // 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/spinningprogress.hxx b/toolkit/inc/toolkit/controls/spinningprogress.hxx
new file mode 100755
index 000000000000..e0a676b2aa86
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/spinningprogress.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_SPINNINGPROGRESS_HXX
+#define TOOLKIT_SPINNINGPROGRESS_HXX
+
+#include "toolkit/controls/animatedimages.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= SpinningProgressControlModel
+ //==================================================================================================================
+ typedef AnimatedImagesControlModel SpinningProgressControlModel_Base;
+ class SpinningProgressControlModel : public SpinningProgressControlModel_Base
+ {
+ public:
+ SpinningProgressControlModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
+ SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource );
+
+ virtual UnoControlModel* Clone() const;
+
+ // XPropertySet
+ ::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);
+
+ protected:
+ ~SpinningProgressControlModel();
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_SPINNINGPROGRESS_HXX
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/tabpagecontainer.hxx b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
new file mode 100644
index 000000000000..c7a2e3b8ef90
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tabpagecontainer.hxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_TABPAGE_CONTAINER_HXX
+#define TOOLKIT_TABPAGE_CONTAINER_HXX
+
+#include <com/sun/star/awt/tab/XTabPageContainer.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerModel.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+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;
+
+// ------------------------------------------------------------------
+// class ::com::sun::star::awt::tab::UnoControlTabPageContainerModel
+// ------------------------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::tab::XTabPageContainerModel
+ > UnoControlTabPageContainerModel_Base;
+class UnoControlTabPageContainerModel : public UnoControlTabPageContainerModel_Base
+{
+private:
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageModel > > m_aTabPageVector;
+ ContainerListenerMultiplexer maContainerListeners;
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ // ::com::sun::star::beans::XMultiPropertySet
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+
+public:
+ UnoControlTabPageContainerModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel& rModel ) : UnoControlTabPageContainerModel_Base( rModel ),maContainerListeners( *this ) {;}
+
+ UnoControlModel* Clone() const { return new UnoControlTabPageContainerModel( *this ); }
+
+ // ::com::sun::star::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel, UnoControlModel, szServiceName_UnoControlTabPageContainerModel )
+ // XIndexContainer
+ virtual 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);
+ virtual void SAL_CALL removeByIndex( sal_Int32 Index )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XIndexReplace
+ virtual 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);
+
+ // XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::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);
+
+ // XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw (::com::sun::star::uno::RuntimeException);
+ //{
+ //return ::getCppuType((com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >*)0);
+ //}
+
+ virtual sal_Bool SAL_CALL hasElements() 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);
+};
+// ===================================================================
+// = UnoControlTabPageContainer
+// ===================================================================
+typedef ::cppu::AggImplInheritanceHelper1 < ControlContainerBase
+ , ::com::sun::star::awt::tab::XTabPageContainer
+ > UnoControlTabPageContainer_Base;
+class UnoControlTabPageContainer : public UnoControlTabPageContainer_Base
+{
+public:
+ UnoControlTabPageContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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::tab::XTabPageContainer
+ virtual ::sal_Int16 SAL_CALL getActiveTabPageID() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getTabPageCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTabPageListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual 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);
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainer, UnoControlBase, szServiceName_UnoControlTabPageContainer )
+
+// using UnoControl::getPeer;
+protected:
+ virtual void updateFromModel();
+private:
+ TabPageListenerMultiplexer m_aTabPageListeners;
+ sal_Int16 m_nActiveTabPageId;
+};
+
+#endif // _TOOLKIT_TABPAGE_CONTAINER_HXX
diff --git a/toolkit/inc/toolkit/controls/tabpagemodel.hxx b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
new file mode 100644
index 000000000000..08938669fa58
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tabpagemodel.hxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_TABPAGE_MODEL_HXX
+#define TOOLKIT_TABPAGE_MODEL_HXX
+
+#include <toolkit/controls/controlmodelcontainerbase.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/tab/XTabPage.hpp>
+#include <com/sun/star/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/macros.hxx"
+#include <toolkit/controls/unocontrolcontainer.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <list>
+#include <cppuhelper/implbase2.hxx>
+
+// ----------------------------------------------------
+// class TabPageModel
+// ----------------------------------------------------
+//typedef ::cppu::ImplHelper2< ::com::sun::star::awt::tab::XTabPageModel,
+// ::com::sun::star::lang::XInitialization
+// > TabPageAccess_BASE;
+//
+//class TabPageModel : public TabPageAccess_BASE
+//{
+//
+//private:
+// bool m_bEnabled;
+// ::rtl::OUString m_sTitle;
+// ::rtl::OUString m_sImageURL;
+// ::rtl::OUString m_sTooltip;
+// sal_Int16 m_nTabPageId;
+//
+//public:
+// TabPageModel();
+// explicit TabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xCompContext);
+// ~TabPageModel();
+//
+// // XInitialization
+// virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+// throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+//
+// ::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() { 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::tab::XTabPageModel
+// virtual ::sal_Int16 SAL_CALL getTabPageID() throw (::com::sun::star::uno::RuntimeException);
+// virtual ::sal_Bool SAL_CALL getEnabled() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setEnabled( ::sal_Bool _enabled ) 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& _title ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getImageURL() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException);
+// virtual ::rtl::OUString SAL_CALL getTooltip() throw (::com::sun::star::uno::RuntimeException);
+// virtual void SAL_CALL setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException);
+//};
+// ----------------------------------------------------
+// class UnoControlTabPageModel
+// ----------------------------------------------------
+
+class UnoControlTabPageModel : public ControlModelContainerBase
+ //public TabPageModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+public:
+ UnoControlTabPageModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory);
+
+ // ::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);
+ // XInitialization
+ virtual void SAL_CALL initialize (const com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageModel, ControlModelContainerBase, szServiceName_UnoControlTabPageModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoTabPageControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase
+ , ::com::sun::star::awt::tab::XTabPage
+ , ::com::sun::star::awt::XWindowListener
+ > UnoControlTabPage_Base;
+class UnoControlTabPage : public UnoControlTabPage_Base
+{
+private:
+ bool m_bWindowListener;
+public:
+
+ UnoControlTabPage( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ~UnoControlTabPage();
+ ::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 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::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::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO( UnoControlTabPage, szServiceName_UnoControlTabPage)
+};
+
+#endif // TOOLKIT_TABPAGE_MODEL_HXX
diff --git a/toolkit/inc/toolkit/controls/tkscrollbar.hxx b/toolkit/inc/toolkit/controls/tkscrollbar.hxx
new file mode 100644
index 000000000000..da3d97ab1bc2
--- /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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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..a0ddfc0dbf8d
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/tksimpleanimation.hxx
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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::AggImplInheritanceHelper1 < UnoControlBase
+ , ::com::sun::star::awt::XSimpleAnimation
+ > UnoSimpleAnimationControl_Base;
+
+ class UnoSimpleAnimationControl : public UnoSimpleAnimationControl_Base
+ {
+ private:
+
+ public:
+ UnoSimpleAnimationControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::rtl::OUString GetComponentServiceName();
+
+ // 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..7600c3e6f9e7
--- /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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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..1c149639fc47
--- /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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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..44836ec28dd6
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrol.hxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/awt/XUnitConversion.hpp>
+#include <com/sun/star/awt/XStyleSettingsSupplier.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/implbase9.hxx>
+#include <comphelper/componentcontext.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::WeakAggImplHelper9 < ::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
+ , ::com::sun::star::awt::XUnitConversion
+ , ::com::sun::star::awt::XStyleSettingsSupplier
+ > 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:
+ const ::comphelper::ComponentContext maContext;
+ 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;
+ virtual 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;
+
+protected:
+ UnoControl();
+
+public:
+ UnoControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ~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);
+
+ // XUnitConversion
+ virtual ::com::sun::star::awt::Point SAL_CALL convertPointToLogic( const ::com::sun::star::awt::Point& Point, ::sal_Int16 TargetUnit ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::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);
+ virtual ::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);
+ virtual ::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);
+
+ // XStyleSettingsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings > SAL_CALL getStyleSettings() throw (::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..1ce56c11cec1
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolbase.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_AWT_UNOCONTROLBASE_HXX_
+#define _TOOLKIT_AWT_UNOCONTROLBASE_HXX_
+
+#include <com/sun/star/awt/Size.hpp>
+
+#include <toolkit/controls/unocontrol.hxx>
+
+// ----------------------------------------------------
+// class UnoControlBase
+// ----------------------------------------------------
+
+class TOOLKIT_DLLPUBLIC UnoControlBase : public UnoControl
+{
+protected:
+ UnoControlBase();
+
+protected:
+ UnoControlBase( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControl( i_factory )
+ {
+ }
+
+ 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..dcba4fdcbf9a
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolcontainer.hxx
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory,
+ const ::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..cdc908718988
--- /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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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..bdb6e5d4bc68
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrolmodel.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#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 <cppuhelper/implbase7.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/uno3.hxx>
+
+#include <list>
+
+class ImplPropertyTable;
+
+// ----------------------------------------------------
+// class UnoControlModel
+// ----------------------------------------------------
+
+typedef ::cppu::WeakAggImplHelper7 < ::com::sun::star::awt::XControlModel
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::io::XPersistObject
+ , ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XUnoTunnel
+ , ::com::sun::star::util::XCloneable
+ > UnoControlModel_Base;
+
+class TOOLKIT_DLLPUBLIC UnoControlModel :public UnoControlModel_Base
+ ,public MutexAndBroadcastHelper
+ ,public ::cppu::OPropertySetHelper
+{
+private:
+ ImplPropertyTable* mpData;
+ EventListenerMultiplexer maDisposeListeners;
+
+protected:
+ const ::comphelper::ComponentContext maContext;
+
+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 ::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;
+
+protected:
+ UnoControlModel();
+public:
+ UnoControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlModel( const UnoControlModel& rModel );
+ ~UnoControlModel();
+
+ virtual UnoControlModel* Clone() const = 0;
+
+ // ::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();
+ void SAL_CALL release() throw();
+
+ // ::com::sun::star::uno::XAggregation
+ ::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
+ DECLARE_XTYPEPROVIDER()
+
+ // ::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..09622d2c8ef8
--- /dev/null
+++ b/toolkit/inc/toolkit/controls/unocontrols.hxx
@@ -0,0 +1,1519 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/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/awt/XItemList.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/bitmapex.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+
+#include <list>
+#include <vector>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/optional.hpp>
+
+#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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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;
+ sal_uInt16 mnMaxTextLen;
+
+ sal_Bool mbSetTextInPeer;
+ sal_Bool mbSetMaxTextLenInPeer;
+ sal_Bool mbHasTextProperty;
+
+public:
+
+ UnoEditControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::rtl::OUString GetComponentServiceName();
+
+ // ::com::sun::star::lang::XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoFileControl, UnoEditControl, szServiceName2_UnoControlFileControl )
+};
+
+// ----------------------------------------------------
+// class GraphicControlModel
+// ----------------------------------------------------
+class GraphicControlModel : public UnoControlModel
+{
+private:
+ 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:
+ GraphicControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ ,mbAdjustingImagePosition( false )
+ ,mbAdjustingGraphic( false )
+ {
+ }
+ GraphicControlModel( const GraphicControlModel& _rSource ) : UnoControlModel( _rSource ), mbAdjustingImagePosition( false ), mbAdjustingGraphic( false ) { }
+
+ // ::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:
+ GraphicControlModel& operator=( const GraphicControlModel& ); // never implemented
+};
+
+// ----------------------------------------------------
+// class UnoControlButtonModel
+// ----------------------------------------------------
+class UnoControlButtonModel : public GraphicControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlButtonModel( const UnoControlButtonModel& rModel ) : GraphicControlModel( 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, GraphicControlModel, szServiceName2_UnoControlButtonModel )
+};
+
+// ----------------------------------------------------
+// class UnoButtonControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
+ , ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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, UnoControlBase, szServiceName2_UnoControlButton )
+};
+
+// ----------------------------------------------------
+// class UnoControlImageControlModel
+// ----------------------------------------------------
+class UnoControlImageControlModel : public GraphicControlModel
+{
+private:
+ bool mbAdjustingImageScaleMode;
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlImageControlModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlImageControlModel( const UnoControlImageControlModel& rModel ) : GraphicControlModel( 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, GraphicControlModel, 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 < UnoControlBase
+ , ::com::sun::star::awt::XLayoutConstrains
+ > UnoImageControlControl_Base;
+class UnoImageControlControl : public UnoImageControlControl_Base
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ::rtl::OUString maActionCommand;
+
+public:
+
+ UnoImageControlControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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, UnoControlBase, szServiceName2_UnoControlImageControl )
+};
+
+// ----------------------------------------------------
+// class UnoControlRadioButtonModel
+// ----------------------------------------------------
+class UnoControlRadioButtonModel : public GraphicControlModel
+
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlRadioButtonModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlRadioButtonModel( const UnoControlRadioButtonModel& rModel ) : GraphicControlModel( 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, GraphicControlModel, szServiceName2_UnoControlRadioButtonModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoRadioButtonControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
+ , ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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) { UnoControlBase::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, UnoControlBase, szServiceName2_UnoControlRadioButton )
+
+};
+
+// ----------------------------------------------------
+// class UnoControlCheckBoxModel
+// ----------------------------------------------------
+class UnoControlCheckBoxModel : public GraphicControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlCheckBoxModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlCheckBoxModel( const UnoControlCheckBoxModel& rModel ) : GraphicControlModel( 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, GraphicControlModel, szServiceName2_UnoControlCheckBoxModel )
+};
+
+// ----------------------------------------------------
+// class UnoCheckBoxControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase
+ , ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ~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) { UnoControlBase::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, UnoControlBase, 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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
+// ----------------------------------------------------
+struct UnoControlListBoxModel_Data;
+typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel
+ , ::com::sun::star::awt::XItemList
+ > UnoControlListBoxModel_Base;
+class TOOLKIT_DLLPUBLIC UnoControlListBoxModel : public UnoControlListBoxModel_Base
+{
+protected:
+ enum ConstructorMode
+ {
+ ConstructDefault,
+ ConstructWithoutProperties
+ };
+
+public:
+ UnoControlListBoxModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory,
+ ConstructorMode const i_mode = ConstructDefault
+ );
+ UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource );
+ ~UnoControlListBoxModel();
+
+ UnoControlModel* Clone() const { return new UnoControlListBoxModel( *this ); }
+
+ 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 )
+ ::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);
+
+ // ::com::sun::star::awt::XItemList
+ virtual ::sal_Int32 SAL_CALL getItemCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItem( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItem( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAllItems( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemText( ::sal_Int32 Position, const ::rtl::OUString& ItemText ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemImage( ::sal_Int32 Position, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemTextAndImage( ::sal_Int32 Position, const ::rtl::OUString& ItemText, const ::rtl::OUString& ItemImageURL ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setItemData( ::sal_Int32 Position, const ::com::sun::star::uno::Any& DataValue ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItemText( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getItemImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL getItemTextAndImage( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getItemData( ::sal_Int32 Position ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL getAllItems( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeItemListListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+private:
+ void impl_notifyItemListEvent_nolck(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ void ( SAL_CALL ::com::sun::star::awt::XItemListListener::*NotificationMethod )( const ::com::sun::star::awt::ItemListEvent& )
+ );
+
+ void impl_handleInsert(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleRemove(
+ const sal_Int32 i_nItemPosition,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_handleModify(
+ const sal_Int32 i_nItemPosition,
+ const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ ::osl::ClearableMutexGuard& i_rClearBeforeNotify
+ );
+
+ void impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const;
+ void impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems );
+
+protected:
+ ::boost::scoped_ptr< UnoControlListBoxModel_Data > m_pData;
+ ::cppu::OInterfaceContainerHelper m_aItemListListeners;
+};
+
+// ----------------------------------------------------
+// class UnoListBoxControl
+// ----------------------------------------------------
+typedef ::cppu::AggImplInheritanceHelper5 < UnoControlBase
+ , ::com::sun::star::awt::XListBox
+ , ::com::sun::star::awt::XItemListener
+ , ::com::sun::star::awt::XLayoutConstrains
+ , ::com::sun::star::awt::XTextLayoutConstrains
+ , ::com::sun::star::awt::XItemListListener
+ > UnoListBoxControl_Base;
+class TOOLKIT_DLLPUBLIC UnoListBoxControl : public UnoListBoxControl_Base
+{
+public:
+ UnoListBoxControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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) { UnoControlBase::disposing( Source ); }
+
+ // ::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);
+
+ // XUnoControl
+ sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ // DECLIMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
+ ::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);
+
+protected:
+ void ImplUpdateSelectedItemsProperty();
+ virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+ virtual void updateFromModel();
+
+ ActionListenerMultiplexer& getActionListeners();
+ ItemListenerMultiplexer& getItemListeners();
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+};
+
+// ----------------------------------------------------
+// class UnoControlComboBoxModel
+// ----------------------------------------------------
+class UnoControlComboBoxModel : public UnoControlListBoxModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoControlComboBoxModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoControlComboBoxModel( const UnoControlComboBoxModel& rModel ) : UnoControlListBoxModel( 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);
+ // OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
+ // ::com::sun::star::lang::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);
+ // DECLIMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel )
+
+};
+
+// ----------------------------------------------------
+// class UnoComboBoxControl
+// ----------------------------------------------------
+class UnoComboBoxControl : public UnoEditControl
+ , public ::com::sun::star::awt::XComboBox
+ , public ::com::sun::star::awt::XItemListener
+ , public ::com::sun::star::awt::XItemListListener
+{
+private:
+ ActionListenerMultiplexer maActionListeners;
+ ItemListenerMultiplexer maItemListeners;
+
+public:
+
+ UnoComboBoxControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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 disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException) { UnoEditControl::disposing( Source ); }
+ void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException);
+
+ ::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);
+
+ // ::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);
+
+ // XUnoControl
+ virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& Model) throw ( ::com::sun::star::uno::RuntimeException );
+
+ // XItemListListener
+ virtual void SAL_CALL listItemInserted( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemRemoved( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL listItemModified( const ::com::sun::star::awt::ItemListEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL allItemsRemoved( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL itemListChanged( const ::com::sun::star::lang::EventObject& Event ) 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::lang::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);
+ //DECLIMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox )
+protected:
+ virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal );
+ virtual void updateFromModel();
+ ActionListenerMultiplexer& getActionListeners();
+ ItemListenerMultiplexer& getItemListeners();
+
+};
+
+// ----------------------------------------------------
+// class UnoSpinFieldControl
+// ----------------------------------------------------
+class UnoSpinFieldControl : public UnoEditControl,
+ public ::com::sun::star::awt::XSpinField
+{
+private:
+ SpinListenerMultiplexer maSpinListeners;
+ sal_Bool mbRepeat;
+
+public:
+ UnoSpinFieldControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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..408dd4cbe385
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/listenermultiplexer.hxx
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+#include <com/sun/star/awt/grid/XGridSelectionListener.hpp>
+#include <com/sun/star/awt/tab/XTabPageContainerListener.hpp>
+// ----------------------------------------------------
+// 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_DLLPUB( 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
+
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+ void SAL_CALL selectionChanged( const ::com::sun::star::awt::grid::GridSelectionEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+DECL_LISTENERMULTIPLEXER_END
+
+// ----------------------------------------------------
+// class TabPageListenerMultiplexer
+// ----------------------------------------------------
+DECL_LISTENERMULTIPLEXER_START_DLLPUB( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener )
+ void SAL_CALL tabPageActivated( const ::com::sun::star::awt::tab::TabPageActivatedEvent& aEvent ) 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..4ae1dd17c62f
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/mutexandbroadcasthelper.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_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; }
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return BrdcstHelper; }
+};
+
+#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..c2d6380dcb65
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/property.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#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_ROW_HEIGHT 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
+#define BASEPROPERTY_GRID_HEADER_BACKGROUND 148
+#define BASEPROPERTY_GRID_HEADER_TEXT_COLOR 149
+#define BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS 150
+#define BASEPROPERTY_GRID_LINE_COLOR 151
+#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152
+#define BASEPROPERTY_ITEM_SEPARATOR_POS 153
+#define BASEPROPERTY_AUTO_REPEAT 154
+#define BASEPROPERTY_ROW_HEADER_WIDTH 155
+#define BASEPROPERTY_COLUMN_HEADER_HEIGHT 156
+#define BASEPROPERTY_USE_GRID_LINES 157
+
+
+// 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 );
+TOOLKIT_DLLPUBLIC 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..27949e9de791
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/servicenames.hxx
@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _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_SortableGridDataModel[];
+
+extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[], szServiceName2_UnoSimpleAnimationControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControlModel[], szServiceName2_UnoSimpleAnimationControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[], szServiceName2_UnoThrobberControl[];
+extern const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[], szServiceName2_UnoThrobberControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_AnimatedImagesControl[];
+extern const sal_Char __FAR_DATA szServiceName_AnimatedImagesControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_SpinningProgressControlModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlFixedHyperlink[], szServiceName_UnoControlFixedHyperlinkModel[];
+
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageModel[], szServiceName2_UnoControlTabPageModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPage[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainerModel[];
+extern const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainer[];
+
+// 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..e45a1b6ee2c3
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/solarrelease.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.
+ *
+ ************************************************************************/
+
+#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;
+ const bool mbRescheduleDuringAcquire;
+
+ public:
+ enum
+ {
+ RescheduleDuringAcquire = true
+ };
+
+ public:
+ ReleaseSolarMutex( const bool i_rescheduleDuringAcquire = false )
+ :mnLockCount( Application::ReleaseSolarMutex() )
+ ,mbRescheduleDuringAcquire( i_rescheduleDuringAcquire )
+ {
+
+ }
+
+ ~ReleaseSolarMutex()
+ {
+ if ( mnLockCount > 0 )
+ {
+ if ( mbRescheduleDuringAcquire )
+ {
+ while ( !Application::GetSolarMutex().tryToAcquire() )
+ {
+ Application::Reschedule();
+ }
+ --mnLockCount;
+ }
+ Application::AcquireSolarMutex( mnLockCount );
+ }
+ }
+ };
+
+//........................................................................
+} // namespace toolkit
+//........................................................................
+
+#endif // TOOLKIT_INC_TOOLKIT_HELPER_SOLARRELEASE_HXX
+
diff --git a/toolkit/inc/toolkit/helper/tkresmgr.hxx b/toolkit/inc/toolkit/helper/tkresmgr.hxx
new file mode 100644
index 000000000000..ea62cd3db361
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/tkresmgr.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _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 );
+ static Image getImageFromURL( const ::rtl::OUString& i_rImageURL );
+};
+
+
+#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..99d1763db1e6
--- /dev/null
+++ b/toolkit/inc/toolkit/helper/unopropertyarrayhelper.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_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+#define _TOOLKIT_HELPER_UNOPROPERTYARRAYHELPER_HXX_
+
+#include <toolkit/dllapi.h>
+#include <cppuhelper/propshlp.hxx>
+
+#include <tools/table.hxx>
+
+#include <list>
+#include "toolkit/dllapi.h"
+
+// ----------------------------------------------------
+// class UnoPropertyArrayHelper
+// ----------------------------------------------------
+class TOOLKIT_DLLPUBLIC 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..562d78f34c83
--- /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, sal_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, sal_Bool bShow );
+ void WindowEvent_Close( Window* pWindow );
+ void WindowEvent_Minimize( Window* pWindow );
+ void WindowEvent_Normalize( Window* pWindow );
+ void WindowEvent_Activate( Window* pWindow, sal_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..fc35c480d854
--- /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 <tools/mapunit.hxx>
+#include <tools/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..e11d32c435bf
--- /dev/null
+++ b/toolkit/prj/build.lst
@@ -0,0 +1,3 @@
+ti toolkit : LIBXSLT:libxslt vcl qadevOOo test NULL
+ti toolkit\prj nmake - all ti_prj NULL
+ti toolkit\qa\complex\toolkit nmake - all ti_complex_toolkit NULL
diff --git a/toolkit/prj/d.lst b/toolkit/prj/d.lst
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/toolkit/prj/d.lst
diff --git a/toolkit/prj/makefile.mk b/toolkit/prj/makefile.mk
new file mode 100644
index 000000000000..e312a7ccab65
--- /dev/null
+++ b/toolkit/prj/makefile.mk
@@ -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.
+#
+#*************************************************************************
+
+PRJ=..
+TARGET=prj
+
+.INCLUDE : settings.mk
+
+.IF "$(VERBOSE)"!=""
+VERBOSEFLAG :=
+.ELSE
+VERBOSEFLAG := -s
+.ENDIF
+
+all:
+ cd $(PRJ) && $(GNUMAKE) $(VERBOSEFLAG) -r -j$(MAXPROCESS) $(gb_MAKETARGET) && $(GNUMAKE) $(VERBOSEFLAG) -r deliverlog
diff --git a/toolkit/qa/complex/toolkit/AccessibleStatusBar.java b/toolkit/qa/complex/toolkit/AccessibleStatusBar.java
new file mode 100755
index 000000000000..d4f2329d8f31
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/AccessibleStatusBar.java
@@ -0,0 +1,338 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 complex.toolkit.accessibility._XAccessibleEventBroadcaster;
+import complex.toolkit.accessibility._XAccessibleExtendedComponent;
+import complex.toolkit.accessibility._XAccessibleComponent;
+import complex.toolkit.accessibility._XAccessibleContext;
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import util.SOfficeFactory;
+import util.AccessibilityTools;
+import com.sun.star.awt.XWindow;
+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 org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class AccessibleStatusBar {
+
+ XInterface testObject = null;
+ XMultiServiceFactory xMSF = null;
+ XWindow xWindow = null;
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+
+
+ /**
+ * 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) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check document types
+ */
+ @Test
+ public void checkDocs() {
+ checkWriterDoc();
+ checkMathDoc();
+ checkDrawDoc();
+ checkImpressDoc();
+ checkCalcDoc();
+ }
+
+ /**
+ * Test the interfaces on a writer document
+ */
+ public void checkWriterDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XTextDocument xTextDoc = null;
+ try {
+ System.out.println("****** Open a new writer document");
+ xTextDoc = xSOF.createTextDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xTextDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xTextDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a math document
+ */
+ public void checkMathDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xMathDoc = null;
+ try {
+ System.out.println("****** Open a new math document");
+ xMathDoc = xSOF.createMathDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xMathDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xMathDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a draw document
+ */
+ public void checkDrawDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xDrawDoc = null;
+ try {
+ System.out.println("****** Open a new draw document");
+ xDrawDoc = xSOF.createDrawDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xDrawDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xDrawDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on an impress document
+ */
+ public void checkImpressDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xImpressDoc = null;
+ try {
+ System.out.println("****** Open a new impress document");
+ xImpressDoc = xSOF.createImpressDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xImpressDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xImpressDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+ /**
+ * Test the interfaces on an calc document
+ */
+ public void checkCalcDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XSpreadsheetDocument xSpreadsheetDoc = null;
+ try {
+ System.out.println("****** Open a new calc document");
+ xSpreadsheetDoc = xSOF.createCalcDoc("_blank");
+ shortWait();
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xSpreadsheetDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ public void getTestObject() {
+ try {
+ XInterface xIfc = (XInterface) xMSF.createInstance(
+ "com.sun.star.awt.Toolkit") ;
+ XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xIfc);
+
+ shortWait();
+ xWindow = UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow());
+
+ shortWait();
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+ XAccessibleContext parentContext = null;
+
+ System.out.println("Get the accessible status bar.");
+ parentContext = AccessibilityTools.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+ shortWait();
+ System.out.println("...OK.");
+
+ XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, parentContext);
+ String[] services = xSI.getSupportedServiceNames();
+ System.out.println("*****");
+ System.out.println("* Implementation Name: " + xSI.getImplementationName());
+ for (int i=0; i<services.length; i++)
+ {
+ System.out.println("* ServiceName " + i + ": " + services[i]);
+ }
+ System.out.println("*****");
+ testObject=parentContext;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ catch(Throwable t) {
+ System.out.println("Got throwable:");
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", t );
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ System.out.println("*** Now testing XAccessibleComponent ***");
+ _XAccessibleComponent _xAccCompTest =
+ new _XAccessibleComponent(testObject);
+ assertTrue("failed: XAccessibleComponent::getBounds", _xAccCompTest._getBounds());
+ assertTrue("failed: XAccessibleComponent::contains", _xAccCompTest._containsPoint());
+ assertTrue("failed: XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint());
+ assertTrue("failed: XAccessibleComponent::getBackground", _xAccCompTest._getBackground());
+ assertTrue("failed: XAccessibleComponent::getForeground", _xAccCompTest._getForeground());
+ assertTrue("failed: XAccessibleComponent::getLocation", _xAccCompTest._getLocation());
+ assertTrue("failed: XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen());
+ assertTrue("failed: XAccessibleComponent::getSize", _xAccCompTest._getSize());
+ assertTrue("failed: XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus());
+
+ System.out.println("*** Now testing XAccessibleContext ***");
+ _XAccessibleContext _xAccContext =
+ new _XAccessibleContext(testObject);
+ assertTrue("failed: XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount());
+ assertTrue("failed: XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild());
+ assertTrue("failed: XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription());
+ assertTrue("failed: XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName());
+ assertTrue("failed: XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent());
+ assertTrue("failed: XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent());
+ assertTrue("failed: XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet());
+ assertTrue("failed: XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole());
+ assertTrue("failed: XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet());
+ assertTrue("failed: XAccessibleContext::getLocale", _xAccContext._getLocale());
+
+ System.out.println("*** Now testing XAccessibleExtendedComponent ***");
+ _XAccessibleExtendedComponent _xAccExtComp =
+ new _XAccessibleExtendedComponent(testObject);
+ assertTrue("failed: XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont());
+ assertTrue("failed: XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText());
+ assertTrue("failed: XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText());
+
+ System.out.println("*** Now testing XAccessibleEventBroadcaster ***");
+ _XAccessibleEventBroadcaster _xAccEvBcast =
+ new _XAccessibleEventBroadcaster(testObject, xWindow);
+ assertTrue("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener());
+ assertTrue("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener());
+ }
+
+
+
+
+ @BeforeClass
+ public static void setUpConnection() throws Exception {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass
+ public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+
+}
diff --git a/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java
new file mode 100755
index 000000000000..edd84651d45e
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java
@@ -0,0 +1,381 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 java.util.logging.Logger;
+import java.util.logging.Level;
+import complex.toolkit.accessibility._XAccessibleEventBroadcaster;
+import complex.toolkit.accessibility._XAccessibleExtendedComponent;
+import complex.toolkit.accessibility._XAccessibleText;
+import complex.toolkit.accessibility._XAccessibleComponent;
+import complex.toolkit.accessibility._XAccessibleContext;
+import util.SOfficeFactory;
+import util.AccessibilityTools;
+import com.sun.star.awt.XWindow;
+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 org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class AccessibleStatusBarItem {
+
+ XMultiServiceFactory xMSF = null;
+ XAccessibleContext testObject = null;
+ XWindow xWindow = null;
+
+ /**
+ * Sleeps for a certain time.
+ * @param Thread is sleeping for this time in milliseconds.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e) ;
+ }
+ }
+
+ /**
+ * Check document types
+ */
+ @Test
+ public void checkDocs()
+ {
+ checkWriterDoc();
+ checkMathDoc();
+ checkDrawDoc();
+ checkImpressDoc();
+ checkCalcDoc();
+ }
+
+ private XMultiServiceFactory getMSF()
+ {
+ final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+ return xMSF1;
+ }
+
+ /**
+ * Test the interfaces on a writer document
+ */
+ private void checkWriterDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XTextDocument xTextDoc = null;
+ try {
+ System.out.println("****** Open a new writer document");
+ xTextDoc = xSOF.createTextDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xTextDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xTextDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a math document
+ */
+ public void checkMathDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xMathDoc = null;
+ try {
+ System.out.println("****** Open a new math document");
+ xMathDoc = xSOF.createMathDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xMathDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xMathDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on a draw document
+ */
+ public void checkDrawDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xDrawDoc = null;
+ try {
+ System.out.println("****** Open a new draw document");
+ xDrawDoc = xSOF.createDrawDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xDrawDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xDrawDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ /**
+ * Test the interfaces on an impress document
+ */
+ public void checkImpressDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XComponent xImpressDoc = null;
+ try {
+ System.out.println("****** Open a new impress document");
+ xImpressDoc = xSOF.createImpressDoc("_blank");
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xImpressDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xImpressDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+ /**
+ * Test the interfaces on an calc document
+ */
+ public void checkCalcDoc() {
+ xMSF = getMSF();
+ SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF);
+ XSpreadsheetDocument xSpreadsheetDoc = null;
+ try {
+ System.out.println("****** Open a new calc document");
+ xSpreadsheetDoc = xSOF.createCalcDoc("_blank");
+ shortWait();
+ getTestObject();
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ runAllInterfaceTests();
+
+ if (xSpreadsheetDoc != null) {
+ XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc);
+ try {
+ xClose.close(false);
+ }
+ catch(com.sun.star.util.CloseVetoException e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ }
+ }
+
+ public void getTestObject() {
+ try {
+ XInterface xIfc = (XInterface) xMSF.createInstance(
+ "com.sun.star.awt.Toolkit") ;
+ XExtendedToolkit tk =
+ UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc);
+
+ shortWait();
+ xWindow = UnoRuntime.queryInterface(
+ XWindow.class,tk.getActiveTopWindow());
+
+ shortWait();
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+ XAccessibleContext parentContext = null;
+
+ System.out.println("Get the accessible status bar.");
+ parentContext = AccessibilityTools.getAccessibleObjectForRole(
+ xRoot, AccessibleRole.STATUS_BAR, "");
+ shortWait();
+ if ( parentContext == null ) {
+ fail("Could not create a test object.");
+ }
+ System.out.println("...OK.");
+
+ testObject=parentContext;
+ }
+ catch(com.sun.star.uno.Exception e) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e );
+ }
+ catch(Throwable t) {
+ Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", t );
+ }
+ }
+
+ public void runAllInterfaceTests() {
+ int count = testObject.getAccessibleChildCount();
+ System.out.println("*****");
+ System.out.println("**** Found items to test: " + count);
+ for (int i=0;i<count;i++){
+ System.out.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 = UnoRuntime.queryInterface(
+ XServiceInfo.class,object);
+ String[] services = xSI.getSupportedServiceNames();
+ System.out.println("* Implementation Name: " + xSI.getImplementationName());
+ String accName = object.getAccessibleContext().getAccessibleName();
+ System.out.println("* Accessible Name: " + accName);
+ for (int j=0; i<services.length; i++)
+ {
+ System.out.println("* ServiceName "+i+": "+ services[j]);
+ }
+ System.out.println("*****");
+
+ System.out.println("*** Now testing XAccessibleComponent ***");
+ _XAccessibleComponent _xAccCompTest =
+ new _XAccessibleComponent(object);
+ assertTrue("failed: "+accName+" - XAccessibleComponent::getBounds", _xAccCompTest._getBounds());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::contains", _xAccCompTest._containsPoint());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::getBackground", _xAccCompTest._getBackground());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::getForeground", _xAccCompTest._getForeground());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::getLocation", _xAccCompTest._getLocation());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::getSize", _xAccCompTest._getSize());
+ assertTrue("failed: "+accName+" - XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus());
+
+ System.out.println("*** Now testing XAccessibleContext ***");
+ _XAccessibleContext _xAccContext =
+ new _XAccessibleContext(object);
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet());
+ assertTrue("failed: "+accName+" - XAccessibleContext::getLocale", _xAccContext._getLocale());
+
+ System.out.println("*** Now testing XAccessibleExtendedComponent ***");
+ _XAccessibleExtendedComponent _xAccExtComp =
+ new _XAccessibleExtendedComponent(object);
+ assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont());
+ assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText());
+ assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText());
+
+ System.out.println("*** Now testing XAccessibleEventBroadcaster ***");
+ _XAccessibleEventBroadcaster _xAccEvBcast =
+ new _XAccessibleEventBroadcaster(object, xWindow);
+ assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener());
+ assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener());
+
+ System.out.println("*** Now testing XAccessibleText ***");
+ _XAccessibleText _xAccText =
+ new _XAccessibleText(object, xMSF, "true");
+ assertTrue("failed: "+accName+" - XAccessibleText::getText", _xAccText._getText());
+ assertTrue("failed: "+accName+" - XAccessibleText::getCharacterCount", _xAccText._getCharacterCount());
+ assertTrue("failed: "+accName+" - XAccessibleText::getCharacterBounds", _xAccText._getCharacterBounds());
+ assertTrue("failed: "+accName+" - XAccessibleText::setSelection", _xAccText._setSelection());
+ assertTrue("failed: "+accName+" - XAccessibleText::copyText", _xAccText._copyText());
+ assertTrue("failed: "+accName+" - XAccessibleText::getCharacter", _xAccText._getCharacter());
+ assertTrue("failed: "+accName+" - XAccessibleText::getCharacterAttributes", _xAccText._getCharacterAttributes());
+ assertTrue("failed: "+accName+" - XAccessibleText::getIndexAtPoint", _xAccText._getIndexAtPoint());
+ assertTrue("failed: "+accName+" - XAccessibleText::getSelectedText", _xAccText._getSelectedText());
+ assertTrue("failed: "+accName+" - XAccessibleText::getSelectionEnd", _xAccText._getSelectionEnd());
+ assertTrue("failed: "+accName+" - XAccessibleText::getSelectionStart", _xAccText._getSelectionStart());
+ assertTrue("failed: "+accName+" - XAccessibleText::getTextAtIndex", _xAccText._getTextAtIndex());
+ assertTrue("failed: "+accName+" - XAccessibleText::getTextBeforeIndex", _xAccText._getTextBeforeIndex());
+ assertTrue("failed: "+accName+" - XAccessibleText::getBehindIndex", _xAccText._getTextBehindIndex());
+ assertTrue("failed: "+accName+" - XAccessibleText::getTextRange", _xAccText._getTextRange());
+ assertTrue("failed: "+accName+" - XAccessibleText::setCaretPosition", _xAccText._setCaretPosition());
+ assertTrue("failed: "+accName+" - XAccessibleText::getCaretPosition", _xAccText._getCaretPosition());
+ }
+ }
+
+
+
+
+ @BeforeClass public static void setUpConnection() throws Exception {
+ System.out.println("setUpConnection()");
+ connection.setUp();
+ }
+
+ @AfterClass public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println("tearDownConnection()");
+ connection.tearDown();
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+
+
+}
diff --git a/toolkit/qa/complex/toolkit/Assert.java b/toolkit/qa/complex/toolkit/Assert.java
new file mode 100755
index 000000000000..93b1a2c490e1
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/Assert.java
@@ -0,0 +1,234 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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 java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import com.sun.star.uno.UnoRuntime;
+import static org.junit.Assert.*;
+
+/**
+ * provides assertion capabilities not found in {@link org.junit.Assert}
+ * @author frank.schoenheit@oracle.com
+ */
+public class Assert
+{
+ // --------------------------------------------------------------------------------------------------------
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_message
+ * is the message to print when the check fails
+ * @param i_object
+ * is the object to invoke the method on
+ * @param i_methodName
+ * is the name of the method to invoke
+ * @param i_methodArgs
+ * are the arguments to pass to the method.
+ * @param i_argClasses
+ * are the classes to assume for the arguments of the methods
+ * @param i_expectedExceptionClass
+ * is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final String i_message, final Object i_object, final String i_methodName,
+ final Class[] i_argClasses, final Object[] i_methodArgs, final Class i_expectedExceptionClass )
+ {
+ Class objectClass = i_object.getClass();
+
+ boolean noExceptionAllowed = ( i_expectedExceptionClass == null );
+
+ boolean caughtExpected = noExceptionAllowed ? true : false;
+ try
+ {
+ Method method = impl_getMethod( objectClass, i_methodName, i_argClasses );
+ method.invoke(i_object, i_methodArgs );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ StringBuilder message = new StringBuilder();
+ message.append( "no such method: " ).append( objectClass.getName() ).append( "." ).append( i_methodName ).append( "( " );
+ for ( int i=0; i<i_argClasses.length; ++i )
+ {
+ message.append( i_argClasses[i].getName() );
+ if ( i<i_argClasses.length - 1 )
+ message.append( ", " );
+ }
+ message.append( " )" );
+ fail( message.toString() );
+ }
+ catch ( InvocationTargetException e )
+ {
+ caughtExpected = noExceptionAllowed
+ ? false
+ : ( e.getTargetException().getClass().equals( i_expectedExceptionClass ) );
+ }
+ catch( Exception e )
+ {
+ caughtExpected = false;
+ }
+
+ assertTrue( i_message, caughtExpected );
+ }
+
+ /**
+ * retrieves a method, given by name and parameter signature, from the given class
+ *
+ * The method does somewhat more than simply calling {@link Class.getMethod}. In particular, it recognizes
+ * primitiive parameter types, and attempts to find a method taking the given primitive type, instead of the
+ * type represented by the parameter class.
+ *
+ * For instance, if you have a method <code>foo( int )</code>, {@link Class.getMethod} would not return this
+ * method when you pass <code>Integer.class</code>. <code>impl_getMethod</code> will recognize this, and
+ * properly retrieve the method.
+ *
+ * Note: <code>impl_getMethod</code> is limited in that it will not try all possible combinations of primitive
+ * and non-primitive types. That is, a method like <code>foo( int, Integer, int )</code> is likely to not be
+ * found.
+ *
+ * @param i_obbjectClass
+ * @param i_methodName
+ * @param i_argClasses
+ * @return
+ */
+ private static Method impl_getMethod( final Class i_objectClass, final String i_methodName, final Class[] i_argClasses ) throws NoSuchMethodException
+ {
+ try
+ {
+ return i_objectClass.getMethod( i_methodName, i_argClasses );
+ }
+ catch ( NoSuchMethodException ex )
+ {
+ }
+
+ int substitutedTypes = 0;
+ int substitutedTypesLastRound = 0;
+ final Class[][] substitutionTable = new Class[][] {
+ new Class[] { Long.class, long.class },
+ new Class[] { Integer.class, int.class },
+ new Class[] { Short.class, short.class },
+ new Class[] { Byte.class, byte.class },
+ new Class[] { Double.class, double.class },
+ new Class[] { Float.class, float.class },
+ new Class[] { Character.class, char.class }
+ };
+ do
+ {
+ substitutedTypes = 0;
+ final Class[] argClasses = new Class[ i_argClasses.length ];
+ for ( int i=0; i < argClasses.length; ++i )
+ {
+ argClasses[i] = i_argClasses[i];
+ if ( substitutedTypes > substitutedTypesLastRound )
+ continue;
+
+ for ( int c=0; c<substitutionTable.length; ++c )
+ {
+ if ( i_argClasses[i].equals( substitutionTable[c][0] ) )
+ {
+ argClasses[i] = substitutionTable[c][1];
+ ++substitutedTypes;
+ break;
+ }
+ }
+ }
+ if ( substitutedTypes == substitutedTypesLastRound )
+ throw new NoSuchMethodException();
+ substitutedTypesLastRound = substitutedTypes;
+
+ try
+ {
+ return i_objectClass.getMethod( i_methodName, argClasses );
+ }
+ catch ( NoSuchMethodException e )
+ {
+ }
+ }
+ while ( substitutedTypes > 0 );
+ throw new NoSuchMethodException();
+ }
+
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_message is the message to print when the check fails
+ * @param i_object is the object to invoke the method on
+ * @param i_methodName is the name of the method to invoke
+ * @param i_methodArgs are the arguments to pass to the method. Those implicitly define
+ * the classes of the arguments of the method which is called.
+ * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final String i_message, final Object i_object, final String i_methodName,
+ final Object[] i_methodArgs, final Class i_expectedExceptionClass )
+ {
+ Class[] argClasses = new Class[ i_methodArgs.length ];
+ for ( int i=0; i<i_methodArgs.length; ++i )
+ argClasses[i] = i_methodArgs[i].getClass();
+ assertException( i_message, i_object, i_methodName, argClasses, i_methodArgs, i_expectedExceptionClass );
+ }
+
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_object is the object to invoke the method on
+ * @param i_methodName is the name of the method to invoke
+ * @param i_methodArgs are the arguments to pass to the method. Those implicitly define
+ * the classes of the arguments of the method which is called.
+ * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final Object i_object, final String i_methodName, final Object[] i_methodArgs,
+ final Class i_expectedExceptionClass )
+ {
+ assertException(
+ "did not catch the expected exception (" +
+ ( ( i_expectedExceptionClass == null ) ? "none" : i_expectedExceptionClass.getName() ) +
+ ") while calling " + i_object.getClass().getName() + "." + i_methodName,
+ i_object, i_methodName, i_methodArgs, i_expectedExceptionClass );
+ }
+
+ /** invokes a given method on a given object, and assures a certain exception is caught
+ * @param i_object is the object to invoke the method on
+ * @param i_methodName is the name of the method to invoke
+ * @param i_methodArgs are the arguments to pass to the method
+ * @param i_argClasses are the classes to assume for the arguments of the methods
+ * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null,
+ * it means that <em>no</em> exception must be throw by invoking the method.
+ */
+ public static void assertException( final Object i_object, final String i_methodName, final Class[] i_argClasses,
+ final Object[] i_methodArgs, final Class i_expectedExceptionClass )
+ {
+ assertException(
+ "did not catch the expected exception (" +
+ ( ( i_expectedExceptionClass == null ) ? "none" : i_expectedExceptionClass.getName() ) +
+ ") while calling " + i_object.getClass().getName() + "." + i_methodName,
+ i_object, i_methodName, i_argClasses, i_methodArgs, i_expectedExceptionClass );
+ }
+
+ // --------------------------------------------------------------------------------------------------------
+ public static void assertException( Object i_object, Class _unoInterfaceClass, String i_methodName, Object[] i_methodArgs,
+ Class i_expectedExceptionClass )
+ {
+ assertException( UnoRuntime.queryInterface( _unoInterfaceClass, i_object ), i_methodName,
+ i_methodArgs, i_expectedExceptionClass );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/GridControl.java b/toolkit/qa/complex/toolkit/GridControl.java
new file mode 100755
index 000000000000..a06a52342417
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/GridControl.java
@@ -0,0 +1,687 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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.XControl;
+import com.sun.star.awt.XControlContainer;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XToolkit;
+import com.sun.star.awt.grid.DefaultGridDataModel;
+import com.sun.star.awt.grid.XGridColumn;
+import com.sun.star.awt.grid.XGridColumnModel;
+import com.sun.star.awt.grid.XGridDataModel;
+import com.sun.star.awt.grid.XMutableGridDataModel;
+import com.sun.star.awt.grid.XSortableMutableGridDataModel;
+import com.sun.star.beans.Pair;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.ContainerEvent;
+import com.sun.star.container.XContainerListener;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Exception;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XCloneable;
+import complex.toolkit.awtgrid.DummyColumn;
+import complex.toolkit.awtgrid.TMutableGridDataModel;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+import org.openoffice.test.OfficeConnection;
+
+/** is a unit test for the grid control related implementations
+ * @author frank.schoenheit@sun.com
+ */
+public class GridControl
+{
+ // -----------------------------------------------------------------------------------------------------------------
+ public GridControl()
+ {
+ m_context = m_connection.getComponentContext();
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private static void impl_dispose( final Object... i_components )
+ {
+ for ( int i=0; i<i_components.length; ++i )
+ {
+ if ( i_components[i] != null )
+ {
+ final XComponent component = UnoRuntime.queryInterface( XComponent.class, i_components[i] );
+ component.dispose();
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_recreateGridModel() throws Exception
+ {
+ impl_dispose( m_gridControlModel, m_columnModel, m_dataModel );
+
+ // create a grid control model, and ensure it has a proper data and column model already
+ m_gridControlModel = UnoRuntime.queryInterface( XPropertySet.class,
+ createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) );
+ assertNotNull( "grid control model does not provide XPropertySet interface", m_gridControlModel );
+
+ // ensure that the model has default column/data models
+ m_columnModel = UnoRuntime.queryInterface( XGridColumnModel.class, m_gridControlModel.getPropertyValue( "ColumnModel" ) );
+ assertNotNull( "the control model is expected to have an initial column model", m_columnModel );
+ final XGridDataModel dataModel = UnoRuntime.queryInterface( XGridDataModel.class, m_gridControlModel.getPropertyValue( "GridDataModel" ) );
+ assertNotNull( "the control model is expected to have an initial data model", dataModel );
+ m_dataModel = UnoRuntime.queryInterface( XSortableMutableGridDataModel.class,
+ dataModel );
+ assertNotNull( "the out-of-the-box data model should be mutable and sortable", m_dataModel );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testGridControlCloning() throws Exception
+ {
+ impl_recreateGridModel();
+
+ // give the test something to compare, actually
+ XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
+ m_gridControlModel.getPropertyValue( "ColumnModel" ) );
+ columnModel.setDefaultColumns( 10 );
+
+ // clone the grid model
+ final XCloneable cloneable = UnoRuntime.queryInterface( XCloneable.class, m_gridControlModel );
+ assertNotNull( "all UnoControlModel's are expected to be cloneable", cloneable );
+
+ final XInterface clone = cloneable.createClone();
+ final XPropertySet clonedProps = UnoRuntime.queryInterface( XPropertySet.class, clone );
+
+ // TODO: check all those generic properties for equality
+
+ // the data model and the column model should have been cloned, too
+ // in particular, the clone should not share the sub models with the orignal
+ final XMutableGridDataModel originalDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
+ m_gridControlModel.getPropertyValue( "GridDataModel" ) );
+ final XMutableGridDataModel clonedDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
+ clonedProps.getPropertyValue( "GridDataModel" ) );
+ assertFalse( "data model should not be shared after cloning", UnoRuntime.areSame( originalDataModel, clonedDataModel ) );
+ impl_assertEquality( originalDataModel, clonedDataModel );
+
+ final XGridColumnModel originalColumnModel = columnModel;
+ final XGridColumnModel clonedColumnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
+ clonedProps.getPropertyValue( "ColumnModel" ) );
+ assertFalse( "column model should not be shared after cloning", UnoRuntime.areSame( originalColumnModel, clonedColumnModel ) );
+ impl_assertEquality( originalColumnModel, clonedColumnModel );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testDisposal() throws Exception
+ {
+ impl_recreateGridModel();
+
+ final int columnCount = 3;
+ m_columnModel.setDefaultColumns( columnCount );
+
+ // add disposal listeners to all columns so far
+ final XGridColumn[] columns = m_columnModel.getColumns();
+ assertEquals( "creating default columns resulted in unexpected column count", columnCount, columns.length );
+ final DisposeListener[] columnListeners = new DisposeListener[columnCount];
+ for ( int i=0; i<columnCount; ++i )
+ columnListeners[i] = new DisposeListener( columns[i] );
+
+ // add another column, and check that upon removal, it is disposed
+ final int newColumnIndex = m_columnModel.addColumn( m_columnModel.createColumn() );
+ final DisposeListener columnListener = new DisposeListener( m_columnModel.getColumn( newColumnIndex ) );
+ m_columnModel.removeColumn( newColumnIndex );
+ assertTrue( "explicit column removal is expected to dispose the column", columnListener.isDisposed() );
+
+ // by definition, the grid control model is the owner of both the column and the data model. So, setting
+ // a new column/data model should implicitly dispose the old models
+ final DisposeListener oldDataModelListener = new DisposeListener( m_dataModel );
+ final DisposeListener oldColumnModelListener = new DisposeListener( m_columnModel );
+
+ final Object newDataModel = createInstance( "com.sun.star.awt.grid.DefaultGridDataModel" );
+ final Object newColumnModel = createInstance( "com.sun.star.awt.grid.DefaultGridColumnModel" );
+ final DisposeListener newDataModelListener = new DisposeListener( newDataModel );
+ final DisposeListener newColumnModelListener = new DisposeListener( newColumnModel );
+
+ m_gridControlModel.setPropertyValue( "GridDataModel", newDataModel );
+ assertTrue( "setting a new data model failed", impl_areSameInterface( newDataModel, m_gridControlModel.getPropertyValue( "GridDataModel" ) ) );
+ m_gridControlModel.setPropertyValue( "ColumnModel", newColumnModel );
+ assertTrue( "setting a new column model failed", impl_areSameInterface( newColumnModel, m_gridControlModel.getPropertyValue( "ColumnModel" ) ) );
+
+ assertTrue( "old data model has not been disposed", oldDataModelListener.isDisposed() );
+ assertTrue( "old column model has not been disposed", oldColumnModelListener.isDisposed() );
+ for ( int i=0; i<columnCount; ++i )
+ assertTrue( "column no. " + i + " has not been disposed", columnListeners[i].isDisposed() );
+
+ // the same holds if the grid control model itself is disposed - it should dispose the depending models, too
+ assertFalse( "new data model is already disposed - this is unexpected", newDataModelListener.isDisposed() );
+ assertFalse( "new column model is already disposed - this is unexpected", newColumnModelListener.isDisposed() );
+ impl_dispose( m_gridControlModel );
+ assertTrue( "new data model is not disposed after disposing the grid column model", newDataModelListener.isDisposed() );
+ assertTrue( "new column model is not disposed after disposing the grid column model", newColumnModelListener.isDisposed() );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ /**
+ * tests various aspects of the <code>XMutableGridDataModel</code> interface
+ */
+ @Test
+ public void testMutableGridDataModel() throws Exception
+ {
+ impl_recreateGridModel();
+
+ TMutableGridDataModel test = new TMutableGridDataModel( m_dataModel );
+ test.testAddRow();
+ test.testAddRows();
+ test.testRemoveRow();
+ test.testRemoveAllRows();
+ test.testUpdateCellData();
+ test.testUpdateRowData();
+ test.testUpdateRowHeading();
+ test.cleanup();
+
+ // a somehwat less straight-forward test: the data model is expected to implicitly increase its column count
+ // when you add a row which has more columns than currently known
+ final XMutableGridDataModel dataModel = DefaultGridDataModel.create( m_context );
+ dataModel.addRow( 0, new Object[] { 1 } );
+ assertEquals( "unexpected column count after adding the most simple row", 1, dataModel.getColumnCount() );
+ dataModel.addRow( 1, new Object[] { 1, 2 } );
+ assertEquals( "implicit extension of the column count doesn't work", 2, dataModel.getColumnCount() );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testGridColumnModel() throws Exception
+ {
+ impl_recreateGridModel();
+
+ ColumnModelListener listener = new ColumnModelListener();
+ m_columnModel.addContainerListener( listener );
+
+ // insert default columns into the previously empty model, ensure we get the right notifications
+ final int defaultColumnsCount = 3;
+ m_columnModel.setDefaultColumns( defaultColumnsCount );
+ impl_assertColumnModelConsistency();
+ List< ContainerEvent > events = listener.assertExclusiveInsertionEvents();
+ listener.reset();
+ assertEquals( "wrong number of events fired by setDefaulColumns", defaultColumnsCount, events.size() );
+ for ( int i=0; i<defaultColumnsCount; ++i )
+ {
+ final ContainerEvent event = events.get(i);
+ final int index = impl_assertInteger( event.Accessor );
+ assertEquals( "unexpected Accessor value in insert notification", i, index );
+ assertTrue( "wrong column object notified in insert notification",
+ impl_areSameInterface( event.Element, m_columnModel.getColumn(i) ) );
+ }
+
+ // insert some more default columns, ensure that all previously existing columns are removed
+ final int moreDefaultColumnsCount = 5;
+ m_columnModel.setDefaultColumns( moreDefaultColumnsCount );
+ impl_assertColumnModelConsistency();
+ assertEquals( "setting default columns is expected to remove all previously existing columns",
+ moreDefaultColumnsCount, m_columnModel.getColumnCount() );
+
+ // in this situation, both removal and insertion events have been notified
+ final List< ContainerEvent > removalEvents = listener.getRemovalEvents();
+ final List< ContainerEvent > insertionEvents = listener.getInsertionEvents();
+ listener.reset();
+
+ // for the removal events, check the indexes
+ assertEquals( "wrong number of columns removed (or notified) upon setting default columns",
+ defaultColumnsCount, removalEvents.size() );
+ for ( int i=0; i<removalEvents.size(); ++i )
+ {
+ final ContainerEvent event = removalEvents.get(i);
+ final int removedIndex = impl_assertInteger( event.Accessor );
+
+ // The implementation is allowed to remove the columns from the beginning, in which case the
+ // index of the removed column must always be 0, since e.g. the second column has index 0
+ // after the first column (which previously had index 0) had been removed.
+ // Alternatively, the implementation is allowed to remove columns from the end, which means
+ // that the column index given in the event is steadily increasing.
+ assertTrue( "unexpected column removal event column index",
+ ( removedIndex == 0 ) || ( removedIndex == removalEvents.size() - 1 - i ) );
+ }
+
+ // for the insertion events, check the indexes as well
+ assertEquals( "wrong number of insertion events when setting default columns over existing columns",
+ moreDefaultColumnsCount, insertionEvents.size() );
+ for ( int i=0; i<insertionEvents.size(); ++i )
+ {
+ final ContainerEvent event = insertionEvents.get(i);
+ final int index = impl_assertInteger( event.Accessor );
+ assertEquals( i, index );
+ }
+
+ // okay, remove all those columns
+ while ( m_columnModel.getColumnCount() != 0 )
+ {
+ final int columnCount = m_columnModel.getColumnCount();
+ final int removeColumnIndex = m_randomGenerator.nextInt( columnCount );
+ m_columnModel.removeColumn( removeColumnIndex );
+ events = listener.assertExclusiveRemovalEvents();
+ listener.reset();
+ assertEquals( "removing a single column should notify a single event", 1, events.size() );
+ final ContainerEvent event = events.get(0);
+ final int removalIndex = impl_assertInteger( event.Accessor );
+ assertEquals( "removing an arbitrary column does not notify the proper accessor",
+ removeColumnIndex, removalIndex );
+ }
+
+ // calling addColumn with a column not created by the given model/implementatoion should not succeed
+ boolean caughtExpected = false;
+ try
+ {
+ m_columnModel.addColumn( new DummyColumn() );
+ }
+ catch( final com.sun.star.lang.IllegalArgumentException e )
+ {
+ assertTrue( impl_areSameInterface( e.Context, m_columnModel ) );
+ caughtExpected = true;
+ }
+ assertTrue( "adding a dummy (self-implemented) grid column to the model should not succeed", caughtExpected );
+
+ // adding a single column to the end should succeed, properly notify, and still be consistent
+ final XGridColumn newColumn = m_columnModel.createColumn();
+ m_columnModel.addColumn( newColumn );
+ impl_assertColumnModelConsistency();
+ events = listener.assertExclusiveInsertionEvents();
+ listener.reset();
+ assertEquals( "addColumn notifies the wrong number of insertion events", 1, events.size() );
+ final int insertionIndex = impl_assertInteger( events.get(0).Accessor );
+ assertEquals( insertionIndex, newColumn.getIndex() );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testSortableDataModel() throws Exception
+ {
+ impl_recreateGridModel();
+
+ final int colCount = 3;
+ final int rowCount = 10;
+ // initialize with some data
+ final Object[][] data = new Object[][] {
+ new Object[] { 15, 17, 0 },
+ new Object[] { 9, 8, 14 },
+ new Object[] { 17, 2, 16 },
+ new Object[] { 0, 7, 14 },
+ new Object[] { 10, 16, 16 },
+ new Object[] { 2, 8, 10 },
+ new Object[] { 4, 8, 3 },
+ new Object[] { 7, 9, 0 },
+ new Object[] { 15, 6, 19 },
+ new Object[] { 2, 14, 19 }
+ };
+ final Object[] rowHeadings = new Object[] {
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
+ };
+ // ensure consistency of the test data
+ assertEquals( rowHeadings.length, rowCount );
+ assertEquals( data.length, rowCount );
+ for ( Object[] rowData : data )
+ assertEquals( rowData.length, colCount );
+
+ // add the test data
+ m_dataModel.addRows( rowHeadings, data );
+ assertEquals( rowCount, m_dataModel.getRowCount() );
+ assertEquals( colCount, m_dataModel.getColumnCount() );
+
+ // sort by each column
+ for ( int colIndex = 0; colIndex < colCount; ++colIndex )
+ {
+ for ( boolean ascending : new boolean[] { true, false } )
+ {
+ m_dataModel.sortByColumn( colIndex, ascending );
+ Pair currentSortOrder = m_dataModel.getCurrentSortOrder();
+ assertEquals( "invalid current sort column (column " + colIndex + ")", ((Integer)currentSortOrder.First).intValue(), colIndex );
+ assertEquals( "invalid current sort direction", ((Boolean)currentSortOrder.Second).booleanValue(), ascending );
+
+ /*for ( int i=0; i<rowCount; ++i )
+ {
+ for ( int j=0; j<colCount; ++j )
+ System.out.print( m_dataModel.getCellData( j, i ).toString() + ", " );
+ System.out.println();
+ }*/
+
+ // verify the data is actually sorted by this column
+ for ( int rowIndex = 0; rowIndex < rowCount - 1; ++rowIndex )
+ {
+ final Object currentValue = m_dataModel.getCellData( colIndex, rowIndex );
+ final int currentIntValue = impl_assertInteger( currentValue );
+ final Object nextValue = m_dataModel.getCellData( colIndex, rowIndex + 1 );
+ final int nextIntValue = impl_assertInteger( nextValue );
+ assertTrue( "data in row " + rowIndex + " is actually not sorted " + ( ascending ? "ascending" : "descending" ),
+ ascending ? currentIntValue <= nextIntValue
+ : currentIntValue >= nextIntValue );
+
+ // ensure the data in the other columns, and the row headings, are sorted as well
+ final Object rowHeading = m_dataModel.getRowHeading( rowIndex );
+ final int unsortedRowIndex = impl_assertInteger( rowHeading );
+ for ( int innerColIndex = 0; innerColIndex < colCount; ++innerColIndex )
+ {
+ assertEquals( "sorted row " + rowIndex + ", unsorted row " + unsortedRowIndex + ", col " + innerColIndex +
+ ": wrong data",
+ data[unsortedRowIndex][innerColIndex], m_dataModel.getCellData( innerColIndex, rowIndex ) );
+ }
+ }
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @Test
+ public void testModelViewInteraction() throws Exception
+ {
+ final List< Object > disposables = new ArrayList< Object >();
+ try
+ {
+ // create a siple dialog model/control/peer trinity
+ final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" );
+ disposables.add( dialogModel );
+ final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel );
+ dialogProps.setPropertyValue( "Width", 200 );
+ dialogProps.setPropertyValue( "Height", 100 );
+ dialogProps.setPropertyValue( "Title", "Grid Control Unit Test" );
+ final XControl dialogControl = createInstance( XControl.class, "com.sun.star.awt.UnoControlDialog" );
+ disposables.add( dialogControl );
+ dialogControl.setModel( dialogModel );
+ dialogControl.createPeer( createInstance( XToolkit.class, "com.sun.star.awt.Toolkit" ), null );
+
+ // insert a grid control model
+ final XMultiServiceFactory controlModelFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class,
+ dialogModel );
+ XPropertySet gridModelProps = UnoRuntime.queryInterface( XPropertySet.class,
+ controlModelFactory.createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) );
+ disposables.add( gridModelProps );
+ gridModelProps.setPropertyValue( "PositionX", 6 );
+ gridModelProps.setPropertyValue( "PositionY", 6 );
+ gridModelProps.setPropertyValue( "Width", 188 );
+ gridModelProps.setPropertyValue( "Height", 88 );
+ final XNameContainer modelContainer = UnoRuntime.queryInterface( XNameContainer.class, dialogModel );
+ modelContainer.insertByName( "grid", gridModelProps );
+
+ // check the respective control has been created
+ final XControlContainer controlContainer = UnoRuntime.queryInterface( XControlContainer.class, dialogControl );
+ final XControl gridControl = controlContainer.getControl( "grid" );
+ assertNotNull( "no grid control created in the dialog", gridControl );
+
+ // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer)
+ // ensures that if there are no columns in the column model, but in the data model, then the column model
+ // will implicitly have the needed columns added.
+ // To ensure that clients which rely on this do not break in the future, check this here.
+ final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class,
+ gridModelProps.getPropertyValue( "GridDataModel" ) );
+ assertNotNull( dataModel );
+ assertEquals( 0, dataModel.getColumnCount() );
+
+ final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class,
+ gridModelProps.getPropertyValue( "ColumnModel" ) );
+ assertNotNull( columnModel );
+ assertEquals( 0, columnModel.getColumnCount() );
+
+ dataModel.addRow( null, new Object[] { 1, 2, 3 } );
+ assertEquals( 3, dataModel.getColumnCount() );
+ assertEquals( 3, columnModel.getColumnCount() );
+ }
+ finally
+ {
+ impl_dispose( disposables.toArray());
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private int impl_assertInteger( final Object i_object )
+ {
+ assertTrue( i_object instanceof Integer );
+ return ((Integer)i_object).intValue();
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertColumnModelConsistency() throws IndexOutOfBoundsException
+ {
+ for ( int col = 0; col < m_columnModel.getColumnCount(); ++col )
+ {
+ final XGridColumn column = m_columnModel.getColumn( col );
+ assertNotNull( column );
+ assertEquals( "column/model inconsistency: column " + col + " has a wrong index!", col, column.getIndex() );
+ }
+
+ final XGridColumn[] allColumns = m_columnModel.getColumns();
+ assertEquals( "getColumns returns the wrong number of column objects",
+ m_columnModel.getColumnCount(), allColumns.length );
+ for ( int col = 0; col < m_columnModel.getColumnCount(); ++col )
+ {
+ assertTrue( "getColumns inconsistency", impl_areSameInterface( allColumns[col], m_columnModel.getColumn(col) ) );
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertEquality( final XGridDataModel i_reference, final XGridDataModel i_compare ) throws IndexOutOfBoundsException
+ {
+ assertNotNull( i_reference );
+ assertNotNull( i_compare );
+
+ assertEquals( "data model comparison: wrong column counts", i_reference.getColumnCount(), i_compare.getColumnCount() );
+ assertEquals( "data model comparison: wrong row counts", i_reference.getRowCount(), i_compare.getRowCount() );
+
+ for ( int row = 0; row < i_reference.getRowCount(); ++row )
+ {
+ assertEquals( "data model comparison: wrong row heading content in row " + row,
+ i_reference.getRowHeading( row ) );
+ for ( int col = 0; col < i_reference.getRowCount(); ++col )
+ {
+ assertEquals( "data model comparison: wrong cell content in cell (" + col + ", " + row + ")",
+ i_reference.getCellData( col, row ) );
+ assertEquals( "data model comparison: wrong tooltip content in cell (" + col + ", " + row + ")",
+ i_reference.getCellToolTip( col, row ) );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertEquality( final XGridColumnModel i_reference, final XGridColumnModel i_compare ) throws IndexOutOfBoundsException
+ {
+ assertEquals( "column model comparison: wrong column counts", i_reference.getColumnCount(), i_compare.getColumnCount() );
+ for ( int col = 0; col < i_reference.getColumnCount(); ++col )
+ {
+ final XGridColumn referenceColumn = i_reference.getColumn( col );
+ final XGridColumn compareColumn = i_compare.getColumn( col );
+ impl_assertEquality( referenceColumn, compareColumn );
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private void impl_assertEquality( final XGridColumn i_reference, final XGridColumn i_compare )
+ {
+ final Method[] methods = XGridColumn.class.getMethods();
+ for ( int m=0; m<methods.length; ++m )
+ {
+ if ( !methods[m].getName().startsWith( "get" ) )
+ continue;
+ try
+ {
+ final Object referenceValue = methods[m].invoke( i_reference );
+ final Object compareValue = methods[m].invoke( i_compare );
+ assertEquals( "grid column comparison: column attribute '" + methods[m].getName().substring(3) + "' does not match",
+ referenceValue, compareValue );
+ }
+ catch ( java.lang.Exception ex )
+ {
+ fail( " could not retrieve object attributes: " + ex.toString() );
+ }
+ }
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private boolean impl_areSameInterface( final Object i_lhs, final Object i_rhs )
+ {
+ final XInterface lhs = UnoRuntime.queryInterface( XInterface.class, i_lhs );
+ final XInterface rhs = UnoRuntime.queryInterface( XInterface.class, i_rhs );
+ return UnoRuntime.areSame( lhs, rhs );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @BeforeClass
+ public static void setUpConnection() throws java.lang.Exception
+ {
+ System.out.println( "--------------------------------------------------------------------------------" );
+ System.out.println( "starting class: " + GridControl.class.getName() );
+ System.out.print( "connecting ... " );
+ m_connection.setUp();
+ System.out.println( "done.");
+
+ final long seed = m_randomGenerator.nextLong();
+ m_randomGenerator.setSeed( seed );
+ System.out.println( "seeding random number generator with " + seed );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ @AfterClass
+ public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println();
+ System.out.println( "tearing down connection" );
+ m_connection.tearDown();
+ System.out.println( "finished class: " + GridControl.class.getName() );
+ System.out.println( "--------------------------------------------------------------------------------" );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ public <T> T createInstance( Class<T> i_interfaceClass, final String i_serviceIndentifer ) throws Exception
+ {
+ return UnoRuntime.queryInterface( i_interfaceClass, createInstance( i_serviceIndentifer ) );
+ }
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private Object createInstance( final String i_serviceName ) throws Exception
+ {
+ Object instance = m_context.getServiceManager().createInstanceWithContext( i_serviceName, m_context );
+ assertNotNull( "could not create an instance of '" + i_serviceName + "'", instance );
+ return instance;
+ }
+ // -----------------------------------------------------------------------------------------------------------------
+ private static final class DisposeListener implements XEventListener
+ {
+ DisposeListener( final Object i_component )
+ {
+ m_component = UnoRuntime.queryInterface( XComponent.class, i_component );
+ assertNotNull( m_component );
+ m_component.addEventListener( this );
+ }
+
+ public void disposing( EventObject i_event )
+ {
+ assertTrue( UnoRuntime.areSame( i_event.Source, m_component ) );
+ m_isDisposed = true;
+ }
+
+ final boolean isDisposed() { return m_isDisposed; }
+
+ private final XComponent m_component;
+ private boolean m_isDisposed;
+ };
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private static final class ColumnModelListener implements XContainerListener
+ {
+ ColumnModelListener()
+ {
+ }
+
+ public void elementInserted( ContainerEvent i_event )
+ {
+ m_insertionEvents.add( i_event );
+ }
+
+ public void elementRemoved( ContainerEvent i_event )
+ {
+ m_removalEvents.add( i_event );
+ }
+
+ public void elementReplaced( ContainerEvent i_event )
+ {
+ m_replacementEvents.add( i_event );
+ }
+
+ public void disposing( EventObject eo )
+ {
+ m_isDisposed = true;
+ }
+
+ private List< ContainerEvent > assertExclusiveInsertionEvents()
+ {
+ assertFalse( m_insertionEvents.isEmpty() );
+ assertTrue( m_removalEvents.isEmpty() );
+ assertTrue( m_replacementEvents.isEmpty() );
+ return m_insertionEvents;
+ }
+
+ private List< ContainerEvent > assertExclusiveRemovalEvents()
+ {
+ assertTrue( m_insertionEvents.isEmpty() );
+ assertFalse( m_removalEvents.isEmpty() );
+ assertTrue( m_replacementEvents.isEmpty() );
+ return m_removalEvents;
+ }
+
+ private void reset()
+ {
+ m_insertionEvents = new ArrayList< ContainerEvent >();
+ m_removalEvents = new ArrayList< ContainerEvent >();
+ m_replacementEvents = new ArrayList< ContainerEvent >();
+ }
+
+ private List< ContainerEvent > getInsertionEvents() { return m_insertionEvents; }
+ private List< ContainerEvent > getRemovalEvents() { return m_removalEvents; }
+
+ final boolean isDisposed() { return m_isDisposed; }
+
+ private List< ContainerEvent > m_insertionEvents = new ArrayList< ContainerEvent >();
+ private List< ContainerEvent > m_removalEvents = new ArrayList< ContainerEvent >();
+ private List< ContainerEvent > m_replacementEvents = new ArrayList< ContainerEvent >();
+ private boolean m_isDisposed = false;
+ };
+
+ // -----------------------------------------------------------------------------------------------------------------
+ private static final OfficeConnection m_connection = new OfficeConnection();
+ private static Random m_randomGenerator = new Random();
+ private final XComponentContext m_context;
+
+ private XPropertySet m_gridControlModel;
+ private XGridColumnModel m_columnModel;
+ private XSortableMutableGridDataModel m_dataModel;
+}
diff --git a/toolkit/qa/complex/toolkit/UnitConversion.java b/toolkit/qa/complex/toolkit/UnitConversion.java
new file mode 100644
index 000000000000..b4cf8a8e1490
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/UnitConversion.java
@@ -0,0 +1,247 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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.XUnitConversion;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.awt.XWindow;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.awt.XWindowPeer;
+
+import util.DesktopTools;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openoffice.test.OfficeConnection;
+import static org.junit.Assert.*;
+
+/**
+ * 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 UnitConversion
+{
+ /**
+ * 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);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aSizeIn.Width + " " + _sEinheit);
+ System.out.println("Height:" + aSizeIn.Height + " " + _sEinheit);
+ System.out.println("");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ System.out.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'
+ *
+ */
+ @Test
+ public void testXUnitConversion()
+ {
+ final XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
+
+ assertNotNull("failed: There is no office.", xMSF);
+
+ // create a window
+ XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF);
+ assertNotNull("failed: there is no window peer", xWindowPeer);
+
+
+ // resize and move the window to a well known position and size
+ XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer);
+ assertNotNull("failed: there is no window, cast wrong?", xWindow);
+
+ 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);
+
+ System.out.println("Window position and size in pixel:");
+ System.out.println("X:" + aPoint.X);
+ System.out.println("Y:" + aPoint.Y);
+ System.out.println("Width:" + aSize.Width);
+ System.out.println("Height:" + aSize.Height);
+ System.out.println("");
+
+ assertTrue("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y);
+
+ m_xConversion = 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);
+ System.out.println("Window position:");
+ System.out.println("X:" + aPointInMM_100TH.X + " 1/100mm");
+ System.out.println("Y:" + aPointInMM_100TH.Y + " 1/100mm");
+ System.out.println("");
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ fail("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage());
+ }
+
+ // 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);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm");
+ System.out.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm");
+ System.out.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);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm");
+ System.out.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm");
+ System.out.println("");
+
+ // check the size with a delta which must be smaller a given difference
+ assertTrue("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10);
+ assertTrue("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)
+ {
+ fail("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage());
+ }
+
+ // 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);
+ System.out.println("Window size:");
+ System.out.println("Width:" + aNewSize.Width + " pixel");
+ System.out.println("Height:" + aNewSize.Height + " pixel");
+
+ // assure the pixels are the same as we already know
+ assertTrue("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ fail("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage());
+ }
+
+ // close the window.
+ // IMHO a little bit stupid, but the XWindow doesn't support a XCloseable interface
+ xWindow.dispose();
+ }
+
+ @BeforeClass
+ public static void setUpConnection() throws Exception
+ {
+ System.out.println( "--------------------------------------------------------------------------------" );
+ System.out.println( "starting class: " + UnitConversion.class.getName() );
+ System.out.println( "connecting ..." );
+ connection.setUp();
+ }
+
+ @AfterClass
+ public static void tearDownConnection()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ System.out.println();
+ System.out.println( "tearing down connection" );
+ connection.tearDown();
+ System.out.println( "finished class: " + UnitConversion.class.getName() );
+ System.out.println( "--------------------------------------------------------------------------------" );
+ }
+
+ private static final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
new file mode 100755
index 000000000000..7dca37ce18b7
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
@@ -0,0 +1,498 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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.accessibility;
+
+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
+ * @param object
+ */
+ public _XAccessibleComponent(XInterface object/*, LogWriter log*/) {
+ oObj = 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>
+ * @return
+ */
+ 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) {
+ System.out.println("Upper bound of box contains point ("
+ + curX + ",0) - OK");
+ } else {
+ System.out.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) {
+
+ System.out.println("Contains returns false for ("+curX+","+bounds.Height+")");
+ curX++;
+ }
+ //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) {
+ if (curX < bounds.Width) {
+ System.out.println("Lower bound of box contains point ("
+ + curX + "," + (bounds.Height - 1) + ") - OK");
+ } else {
+ System.out.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) {
+ System.out.println("Left bound of box contains point (0,"
+ + curY + ") - OK");
+ } else {
+ System.out.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) {
+ System.out.println("Right bound of box contains point ("
+ + (bounds.Width - 1) + "," + curY + ") - OK");
+ } else {
+ System.out.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) {
+ System.out.println("Outer upper and lower bounds contain no component "
+ + "points - OK");
+ } else {
+ System.out.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) {
+ System.out.println("Outer left and right bounds contain no component "
+ + "points - OK");
+ } else {
+ System.out.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.
+ * @return
+ */
+ 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;
+ }
+ System.out.println("Checking child with bounds " +
+ "(" + chBnd.X + "," + chBnd.Y + "),("
+ + chBnd.Width + "," + chBnd.Height + "): "
+ + util.AccessibilityTools.accessibleToString(children[i]));
+
+ System.out.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) {
+ System.out.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) {
+ System.out.println("The child not found at point ("
+ + (chBnd.X ) + "," + chBnd.Y + ") - FAILED");
+ result = false;
+ } else {
+ XAccessible xAccCh = UnoRuntime.queryInterface
+ (XAccessible.class, children[i]);
+ System.out.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) {
+ System.out.println("The children found is not the same");
+ System.out.println("The expected child " +
+ xAccCh.getAccessibleContext().getAccessibleName());
+ System.out.println("is hidden behind the found Child ");
+ System.out.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK");
+ } else {
+ System.out.println("The children found is not the same - FAILED");
+ System.out.println("Expected: "
+ +xAccCh.getAccessibleContext().getAccessibleName());
+ System.out.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) {
+ System.out.println("No children found at point ("
+ + (chBnd.X - 1) + "," + (chBnd.Y - 1) + ") - OK");
+ result &= true;
+ } else {
+ XAccessible xAccCh = UnoRuntime.queryInterface(XAccessible.class, children[i]);
+ boolean res = util.AccessibilityTools.equals(xAccCh, xAcc);
+ if (res) {
+ System.out.println("The same child found outside "
+ + "its bounds - FAILED");
+ result = false ;
+ }
+ }
+ }
+ } else {
+ System.out.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.
+ * @return
+ */
+ public boolean _getBounds() {
+ boolean result = true ;
+
+ bounds = oObj.getBounds() ;
+ result &= bounds != null
+ && bounds.X >=0 && bounds.Y >=0
+ && bounds.Width >0 && bounds.Height >0;
+
+ System.out.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>
+ * @return
+ */
+ 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>
+ * @return
+ */
+ public boolean _getLocationOnScreen() {
+
+ XAccessibleComponent parent = getParentComponent();
+
+ boolean result = true ;
+ Point loc = oObj.getLocationOnScreen();
+ System.out.println("Location is (" + loc.X + "," + loc.Y + ")");
+
+ if (parent != null) {
+ Point parLoc = parent.getLocationOnScreen();
+ System.out.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>
+ * @return
+ */
+ 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.
+ * @return
+ */
+ 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 = UnoRuntime.queryInterface(XAccessible.class, oObj) ;
+ if (xAcc == null) {
+ System.out.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 = 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 = UnoRuntime.queryInterface(XAccessible.class, oObj) ;
+ if (xAcc == null) {
+ System.out.println("Component doesn't support XAccessible.");
+ return null;
+ }
+
+ XAccessibleContext xAccCon = xAcc.getAccessibleContext();
+ XAccessible xAccPar = xAccCon.getAccessibleParent();
+
+ if (xAccPar == null) {
+ System.out.println("Component has no accessible parent.");
+ return null;
+ }
+ XAccessibleContext xAccConPar = xAccPar.getAccessibleContext();
+ XAccessibleComponent parent = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar);
+ if (parent == null) {
+ System.out.println
+ ("Accessible parent doesn't support XAccessibleComponent");
+ return null;
+ }
+
+ return parent;
+ }
+
+ /**
+ * Just calls the method.
+ * @return
+ */
+ public boolean _getForeground() {
+ int forColor = oObj.getForeground();
+ System.out.println("getForeground(): " + forColor);
+ return true;
+ }
+
+ /**
+ * Just calls the method.
+ * @return
+ */
+ public boolean _getBackground() {
+ int backColor = oObj.getBackground();
+ System.out.println("getBackground(): " + backColor);
+ return true;
+ }
+
+}
diff --git a/toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java
new file mode 100755
index 000000000000..14debda92cd8
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.accessibility;
+
+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) {
+ oObj = 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.
+ * @return
+ */
+ public boolean _getAccessibleChildCount() {
+ childCount = oObj.getAccessibleChildCount();
+ System.out.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>
+ * @return
+ */
+ 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();
+
+ System.out.println(" Child " + i + ": " +
+ chAC.getAccessibleDescription()) ;
+
+ if (!AccessibilityTools.equals
+ (chAC.getAccessibleParent().getAccessibleContext(), oObj)){
+
+ System.out.println("Role:");
+ System.out.println("Getting: "+chAC.getAccessibleParent().getAccessibleContext().getAccessibleRole());
+ System.out.println("Expected: "+oObj.getAccessibleRole());
+
+ System.out.println("ImplementationName:");
+ System.out.println("Getting: "+util.utils.getImplName(chAC.getAccessibleParent().getAccessibleContext()));
+ System.out.println("Expected: "+util.utils.getImplName(oObj));
+
+ System.out.println("The parent of child and component "+
+ "itself differ.");
+ System.out.println("Getting(Description): "
+ +chAC.getAccessibleParent().getAccessibleContext().getAccessibleDescription());
+ System.out.println("Expected(Description): "
+ +oObj.getAccessibleDescription());
+
+ bOK = false;
+ } else {
+ System.out.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.
+ * @return
+ */
+ 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>
+ * @return
+ */
+ 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) {
+ System.out.println("Expected: "+util.utils.getImplName(oObj));
+ System.out.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.
+ * @return
+ */
+ public boolean _getAccessibleRole() {
+ short role = oObj.getAccessibleRole();
+ System.out.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.
+ * @return
+ */
+ public boolean _getAccessibleName() {
+ String name = oObj.getAccessibleName();
+ System.out.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.
+ * @return
+ */
+ public boolean _getAccessibleDescription() {
+ String descr = oObj.getAccessibleDescription();
+ System.out.println("The description is '" + descr + "'");
+ return descr != null;
+ }
+
+ /**
+ * Just gets the set. <p>
+ *
+ * Has <b> OK </b> status if the set is not null.
+ * @return
+ */
+ 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.
+ * @return
+ */
+ 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.
+ * @return
+ */
+ public boolean _getLocale() {
+ Locale loc = null ;
+ try {
+ loc = oObj.getLocale();
+ System.out.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/accessibility/_XAccessibleEventBroadcaster.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java
new file mode 100755
index 000000000000..535c7ce36c68
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.accessibility;
+
+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.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;
+
+/**
+ * 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 {
+
+ public XAccessibleEventBroadcaster oObj = null;
+ 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) {
+ System.out.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
+ * @param object
+ * @param eventMessage
+ * @param window
+ */
+ public _XAccessibleEventBroadcaster(XInterface object, XWindow window) {
+ oObj = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, object);
+ prod = new EventProducer(window);
+ }
+
+ /**
+ * Adds two listeners and fires event by mean of object relation. <p>
+ * Has <b> OK </b> status if both listeners were called
+ * @return
+ */
+ public boolean _addEventListener() {
+ System.out.println("adding two listeners");
+ oObj.addEventListener(list);
+ boolean isTransient = chkTransient(oObj);
+ System.out.println("fire event");
+ prod.fireEvent() ;
+
+ try {
+ Thread.sleep(1500);
+ }
+ catch (InterruptedException ex) {
+ }
+
+ boolean works = true;
+
+ if (list.notifiedEvent == null) {
+ if (!isTransient) {
+ System.out.println("listener wasn't called");
+ works = false;
+ } else {
+ System.out.println("Object is Transient, listener isn't expected to be called");
+ }
+ oObj.removeEventListener(list);
+ }
+
+ 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>
+ * @return
+ */
+ public boolean _removeEventListener() {
+
+ list.notifiedEvent = null;
+
+ System.out.println("remove first listener");
+ oObj.removeEventListener(list);
+
+ System.out.println("fire event");
+ prod.fireEvent() ;
+
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException ex) {
+ }
+
+ if (list.notifiedEvent == null) {
+ System.out.println("listener wasn't called -- OK");
+ }
+
+ return list.notifiedEvent == null;
+
+ }
+
+ protected static boolean chkTransient(Object Testcase) {
+ XAccessibleContext accCon = 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/accessibility/_XAccessibleExtendedComponent.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java
new file mode 100755
index 000000000000..551b00acada7
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java
@@ -0,0 +1,101 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package complex.toolkit.accessibility;
+
+// 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 = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, object);
+ // this.log = log;
+ }
+
+ /**
+ * Just calls the method.
+ * @return
+ */
+ public boolean _getFont() {
+ XFont font = oObj.getFont();
+ System.out.println("getFont(): " + font);
+ return true;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value isn't null.
+ * @return
+ */
+ public boolean _getTitledBorderText() {
+ String titleBorderText = oObj.getTitledBorderText();
+ System.out.println("getTitledBorderText(): '" + titleBorderText + "'");
+ return titleBorderText != null;
+ }
+
+ /**
+ * Calls the method and checks returned value.
+ * Has OK status if returned value isn't null.
+ * @return
+ */
+ public boolean _getToolTipText() {
+ String toolTipText = oObj.getToolTipText();
+ System.out.println("getToolTipText(): '" + toolTipText + "'");
+ return toolTipText != null;
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java
new file mode 100755
index 000000000000..a12d93a2d9e2
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java
@@ -0,0 +1,1033 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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.accessibility;
+
+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, XMultiServiceFactory xMSF, String editOnly) {
+ oObj = 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>
+ * @return
+ */
+ public boolean _getCaretPosition() {
+
+ if (editOnly != null) {
+ System.out.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();
+ System.out.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>
+ * @return
+ */
+ public boolean _setCaretPosition() {
+ boolean res = true;
+
+ try {
+ System.out.println("setCaretPosition(-1):");
+ oObj.setCaretPosition(-1);
+ res &= false;
+ System.out.println("exception was expected");
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("setCaretPosition(chCount+1):");
+ oObj.setCaretPosition(chCount+1);
+ res &= false;
+ System.out.println("exception was expected");
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("expected exception");
+ res &= true;
+ }
+ if ( chCount > 0 ) {
+ try {
+ System.out.println("setCaretPosition(chCount - 1)");
+ oObj.setCaretPosition(chCount - 1);
+ res &= true;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getCharacter() {
+ boolean res = true;
+
+ try {
+ System.out.println("getCharacter(-1)");
+ oObj.getCharacter(-1);
+ System.out.println("Exception was expected");
+ res = false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res = true;
+ }
+
+ try {
+ System.out.println("getCharacter(chCount)");
+ oObj.getCharacter(chCount);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.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) {
+ System.out.println("At the position " + i +
+ "was expected character: " + text.charAt(i));
+ System.out.println("but was returned: " + ch);
+ break;
+ }
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getCharacterAttributes() {
+ boolean res = true;
+
+ try {
+ System.out.println("getCharacterAttributes(-1)");
+ oObj.getCharacterAttributes(-1, new String[0]);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("getCharacterAttributes(chCount)");
+ oObj.getCharacterAttributes(chCount, new String[0]);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if ( chCount > 0 ) {
+ System.out.println("getCharacterAttributes(chCount-1)");
+ PropertyValue[] props = oObj.getCharacterAttributes(chCount - 1, new String[0]);
+ res &= props != null;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getCharacterBounds() {
+ boolean res = true;
+
+ try {
+ System.out.println("getCharacterBounds(-1)");
+ oObj.getCharacterBounds(-1);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("getCharacterBounds(chCount)");
+ oObj.getCharacterBounds(chCount);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if (chCount > 0) {
+ System.out.println("getCharacterBounds(chCount-1)");
+ chBounds = oObj.getCharacterBounds(chCount-1);
+ res &= chBounds != null;
+ System.out.println("rect: " + chBounds.X + ", " + chBounds.Y + ", " +
+ chBounds.Width + ", " + chBounds.Height);
+ }
+
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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.
+ * @return
+ */
+ public boolean _getCharacterCount() {
+ chCount = oObj.getCharacterCount();
+ System.out.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>
+ * @return
+ */
+ public boolean _getIndexAtPoint() {
+
+ boolean res = true;
+ System.out.println("getIndexAtPoint(-1, -1):");
+ Point pt = new Point(-1, -1);
+ int index = oObj.getIndexAtPoint(pt);
+ System.out.println(Integer.toString(index));
+ res &= index == -1;
+
+ if (chBounds != null) {
+ pt = new Point(chBounds.X , chBounds.Y );
+ System.out.println("getIndexAtPoint(" + pt.X + ", " + pt.Y + "):");
+ index = oObj.getIndexAtPoint(pt);
+ System.out.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>
+ * @return
+ */
+ public boolean _getSelectedText() {
+ if (editOnly != null) {
+ System.out.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ System.out.println("setSelection(0, 0)");
+ oObj.setSelection(0, 0);
+ System.out.println("getSelectedText():");
+ String txt = oObj.getSelectedText();
+ System.out.println("'" + txt + "'");
+ res &= txt.length() == 0;
+
+ System.out.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ System.out.println("getSelectedText():");
+ txt = oObj.getSelectedText();
+ System.out.println("'" + txt + "'");
+ res &= txt.equals(text);
+
+ if (chCount > 2) {
+ System.out.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ System.out.println("getSelectedText():");
+ txt = oObj.getSelectedText();
+ System.out.println("'" + txt + "'");
+ res &= txt.equals(text.substring(1, chCount - 1));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getSelectionStart() {
+ if (editOnly != null) {
+ System.out.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ System.out.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ int start = oObj.getSelectionStart();
+ System.out.println("getSelectionStart():" + start);
+ res &= start == 0;
+
+ if (chCount > 2) {
+ System.out.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ start = oObj.getSelectionStart();
+ System.out.println("getSelectionStart():" + start);
+ res &= start == 1;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getSelectionEnd() {
+ if (editOnly != null) {
+ System.out.println(editOnly);
+ return true;
+ }
+
+ boolean res = true;
+
+ try {
+ System.out.println("setSelection(0, chCount)");
+ oObj.setSelection(0, chCount);
+ int end = oObj.getSelectionEnd();
+ System.out.println("getSelectionEnd():" + end);
+ res &= end == chCount;
+
+ if (chCount > 2) {
+ System.out.println("setSelection(1, chCount-1)");
+ oObj.setSelection(1, chCount - 1);
+ end = oObj.getSelectionEnd();
+ System.out.println("getSelectionEnd():" + end);
+ res &= end == chCount - 1;
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _setSelection() {
+ boolean res = true;
+ boolean locRes = true;
+
+ if (editOnly != null) {
+ System.out.println(editOnly);
+ return true;
+ }
+
+ try {
+ System.out.println("setSelection(-1, chCount-1):");
+ locRes = oObj.setSelection(-1, chCount - 1);
+ System.out.println(locRes + " exception was expected");
+ res &= !locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("setSelection(0, chCount+1):");
+ locRes = oObj.setSelection(0, chCount + 1);
+ System.out.println(locRes + " excepion was expected");
+ res &= !locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ if (chCount > 2) {
+ System.out.println("setSelection(1, chCount-1):");
+ locRes = oObj.setSelection(1, chCount - 1);
+ System.out.println(Boolean.toString(locRes));
+ res &= locRes;
+
+ System.out.println("setSelection(chCount-1, 1):");
+ locRes = oObj.setSelection(chCount - 1, 1);
+ System.out.println(Boolean.toString(locRes));
+ res &= locRes;
+ }
+
+ if (chCount > 1) {
+ System.out.println("setSelection(0, chCount-1):");
+ locRes = oObj.setSelection(0, chCount-1);
+ System.out.println(Boolean.toString(locRes));
+ res &= locRes;
+
+ System.out.println("setSelection(chCount-1, 0):");
+ locRes = oObj.setSelection(chCount-1, 0);
+ System.out.println(Boolean.toString(locRes));
+ res &= locRes;
+ }
+
+ System.out.println("setSelection(0, 0):");
+ locRes = oObj.setSelection(0, 0);
+ System.out.println(Boolean.toString(locRes));
+ res &= locRes;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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.
+ * @return
+ */
+ public boolean _getText() {
+ text = oObj.getText();
+ System.out.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>
+ * @return
+ */
+ public boolean _getTextRange() {
+ boolean res = true;
+ boolean locRes = true;
+
+ try {
+ if (chCount > 3) {
+ System.out.println("getTextRange(1, chCount - 2): ");
+ String txtRange = oObj.getTextRange(1, chCount - 2);
+ System.out.println(txtRange);
+ locRes = txtRange.equals(text.substring(1, chCount - 2));
+ res &= locRes;
+ if (!locRes) {
+ System.out.println("Was expected: " +
+ text.substring(1, chCount - 2));
+ }
+ }
+
+ if (chCount > 0) {
+ System.out.println("getTextRange(0, chCount-1): ");
+ String txtRange = oObj.getTextRange(0, chCount-1);
+ System.out.println(txtRange);
+ locRes = txtRange.equals(text.substring(0, chCount - 1));
+ res &= locRes;
+ if (!locRes) {
+ System.out.println("Was expected: " +
+ text.substring(0, chCount - 1));
+ }
+
+ System.out.println("getTextRange(chCount, 0): ");
+ txtRange = oObj.getTextRange(chCount, 0);
+ System.out.println(txtRange);
+ res &= txtRange.equals(text);
+
+ System.out.println("getTextRange(0, 0): ");
+ txtRange = oObj.getTextRange(0, 0);
+ System.out.println(txtRange);
+ locRes = txtRange.equals("");
+ res &= locRes;
+ if (!locRes) {
+ System.out.println("Empty string was expected");
+ }
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ try {
+ System.out.println("getTextRange(-1, chCount - 1): ");
+ String txtRange = oObj.getTextRange(-1, chCount - 1);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("getTextRange(0, chCount + 1): ");
+ String txtRange = oObj.getTextRange(0, chCount + 1);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("getTextRange(chCount+1, -1): ");
+ String txtRange = oObj.getTextRange(chCount+1, -1);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getTextAtIndex() {
+ boolean res = true;
+
+ try {
+ System.out.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt =
+ oObj.getTextAtIndex(-1, AccessibleTextType.PARAGRAPH);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("getTextAtIndex(chCount+1," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextAtIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ if ( chCount > 0 ) {
+ System.out.println("getTextAtIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextAtIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+
+ System.out.println("getTextAtIndex(1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextAtIndex(1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text);
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getTextBeforeIndex() {
+ boolean res = true;
+
+ try {
+ System.out.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBeforeIndex(-1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ System.out.println("getTextBeforeIndex(chCount+1, " +
+ "AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBeforeIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ TextSegment txt = null;
+ try {
+ if (chCount > 0) {
+ System.out.println("getTextBeforeIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBeforeIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == chCount ;
+
+ System.out.println("getTextBeforeIndex(1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBeforeIndex(1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+ }
+
+ if (chCount > 2) {
+ System.out.println("getTextBeforeIndex(chCount-1," +
+ " AccessibleTextType.CHARACTER):");
+ txt = oObj.getTextBeforeIndex(chCount - 1,
+ AccessibleTextType.CHARACTER);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(chCount - 2, chCount - 1));
+ System.out.println("getTextBeforeIndex(2," +
+ " AccessibleTextType.CHARACTER):");
+ txt = oObj.getTextBeforeIndex(2,
+ AccessibleTextType.CHARACTER);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(1, 2));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.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>
+ * @return
+ */
+ public boolean _getTextBehindIndex() {
+ boolean res = true;
+
+ try {
+ System.out.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(-1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ System.out.println("getTextBehindIndex(chCount+1, " +
+ "AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount + 1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+
+ try {
+ if ( chCount > 0 ) {
+ System.out.println("getTextBehindIndex(chCount," +
+ " AccessibleTextType.PARAGRAPH):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+
+ System.out.println("getTextBehindIndex(chCount-1," +
+ " AccessibleTextType.PARAGRAPH):");
+ txt = oObj.getTextBehindIndex(chCount - 1,
+ AccessibleTextType.PARAGRAPH);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.length() == 0;
+ }
+ if ( chCount > 1 ) {
+ System.out.println("getTextBehindIndex(1," +
+ " AccessibleTextType.CHARACTER):");
+ TextSegment txt = oObj.getTextBehindIndex(1,
+ AccessibleTextType.CHARACTER);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(2, 3));
+ }
+ if (chCount > 2) {
+ System.out.println("getTextBehindIndex(chCount-2," +
+ " AccessibleTextType.CHARACTER):");
+ TextSegment txt = oObj.getTextBehindIndex(chCount - 2,
+ AccessibleTextType.CHARACTER);
+ System.out.println("'" + txt.SegmentText + "'");
+ res &= txt.SegmentText.equals(text.substring(chCount - 1, chCount));
+ }
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ System.out.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>.
+ * @return
+ */
+ public boolean _copyText() {
+ boolean res = true;
+ boolean locRes = true;
+
+ if (editOnly != null) {
+ System.out.println(editOnly);
+ return true;
+ }
+
+ try {
+ System.out.println("copyText(-1,chCount):");
+ oObj.copyText(-1, chCount);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("copyText(0,chCount+1):");
+ oObj.copyText(0, chCount + 1);
+ System.out.println("Exception was expected");
+ res &= false;
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Expected exception");
+ res &= true;
+ }
+
+ try {
+ System.out.println("copyText(0,chCount):");
+ locRes = oObj.copyText(0, chCount);
+ System.out.println(""+locRes);
+ res &= locRes;
+
+ String cbText = null;
+ try {
+ cbText =
+ util.SysUtils.getSysClipboardText(xMSF);
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Couldn't access system clipboard :");
+ e.printStackTrace();
+ }
+ System.out.println("Clipboard: '" + cbText + "'");
+ res &= text.equals(cbText);
+
+ if (chCount > 2) {
+ System.out.println("copyText(1,chCount-1):");
+ locRes = oObj.copyText(1, chCount - 1);
+ System.out.println(""+locRes);
+ res &= locRes;
+
+ try {
+ cbText = util.SysUtils.getSysClipboardText(xMSF);
+ } catch (com.sun.star.uno.Exception e) {
+ System.out.println("Couldn't access system clipboard :");
+ e.printStackTrace();
+ }
+
+ System.out.println("Clipboard: '" + cbText + "'");
+ res &= text.substring(1, chCount - 1).equals(cbText);
+ }
+
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ System.out.println("Unexpected exception");
+ e.printStackTrace();
+ res &= false;
+ }
+
+ return res;
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java b/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java
new file mode 100755
index 000000000000..11e4a4b19f80
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java
@@ -0,0 +1,180 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public 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.awtgrid;
+
+import com.sun.star.awt.grid.XGridColumn;
+import com.sun.star.awt.grid.XGridColumnListener;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.XEventListener;
+import com.sun.star.style.HorizontalAlignment;
+import com.sun.star.util.XCloneable;
+
+/**
+ * a dummy implementation of css.awt.grid.XGridColumn
+ * @author frank.schoenheit@oracle.com
+ */
+public class DummyColumn implements XGridColumn
+{
+ public DummyColumn()
+ {
+ }
+
+ public Object getIdentifier()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setIdentifier( Object o )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getColumnWidth()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setColumnWidth( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getMinWidth()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setMinWidth( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getMaxWidth()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setMaxWidth( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public boolean getResizeable()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setResizeable( boolean bln )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getFlexibility()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setFlexibility( int i ) throws IllegalArgumentException
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public HorizontalAlignment getHorizontalAlign()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setHorizontalAlign( HorizontalAlignment ha )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public String getTitle()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setTitle( String string )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public String getHelpText()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setHelpText( String string )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getIndex()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public int getDataColumnIndex()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void setDataColumnIndex( int i )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void addGridColumnListener( XGridColumnListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void removeGridColumnListener( XGridColumnListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void dispose()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void addEventListener( XEventListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public void removeEventListener( XEventListener xl )
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+
+ public XCloneable createClone()
+ {
+ throw new UnsupportedOperationException( "Not supported yet." );
+ }
+}
diff --git a/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java b/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java
new file mode 100755
index 000000000000..c31f27796cf1
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java
@@ -0,0 +1,98 @@
+package complex.toolkit.awtgrid;
+
+import com.sun.star.awt.grid.GridDataEvent;
+import com.sun.star.awt.grid.XGridDataListener;
+import com.sun.star.lang.EventObject;
+import static org.junit.Assert.*;
+
+final public class GridDataListener implements XGridDataListener
+{
+ public GridDataListener()
+ {
+ }
+
+ public void rowsInserted( GridDataEvent i_event )
+ {
+ assertNull( m_rowInsertionEvent );
+ m_rowInsertionEvent = i_event;
+ }
+
+ public void rowsRemoved( GridDataEvent i_event )
+ {
+ assertNull( m_rowRemovalEvent );
+ m_rowRemovalEvent = i_event;
+ }
+
+ public void dataChanged( GridDataEvent i_event )
+ {
+ assertNull( m_dataChangeEvent );
+ m_dataChangeEvent = i_event;
+ }
+
+ public void rowHeadingChanged( GridDataEvent i_event )
+ {
+ assertNull( m_rowHeadingChangeEvent );
+ m_rowHeadingChangeEvent = i_event;
+ }
+
+ public void disposing( EventObject eo )
+ {
+ m_disposed = true;
+ }
+
+ public final GridDataEvent assertSingleRowInsertionEvent()
+ {
+ assertNotNull( m_rowInsertionEvent );
+ assertNull( m_rowRemovalEvent );
+ assertNull( m_dataChangeEvent );
+ assertNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_rowInsertionEvent;
+ }
+
+ public final GridDataEvent assertSingleRowRemovalEvent()
+ {
+ assertNull( m_rowInsertionEvent );
+ assertNotNull( m_rowRemovalEvent );
+ assertNull( m_dataChangeEvent );
+ assertNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_rowRemovalEvent;
+ }
+
+ public final GridDataEvent assertSingleDataChangeEvent()
+ {
+ assertNull( m_rowInsertionEvent );
+ assertNull( m_rowRemovalEvent );
+ assertNotNull( m_dataChangeEvent );
+ assertNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_dataChangeEvent;
+ }
+
+ public final GridDataEvent assertSingleRowHeadingChangeEvent()
+ {
+ assertNull( m_rowInsertionEvent );
+ assertNull( m_rowRemovalEvent );
+ assertNull( m_dataChangeEvent );
+ assertNotNull( m_rowHeadingChangeEvent );
+ assertFalse( m_disposed );
+ return m_rowHeadingChangeEvent;
+ }
+
+ public final boolean isDisposed()
+ {
+ return m_disposed;
+ }
+
+ public final void reset()
+ {
+ m_rowInsertionEvent = m_rowRemovalEvent = m_dataChangeEvent = m_rowHeadingChangeEvent = null;
+ // m_disposed is not reset intentionally
+ }
+ private GridDataEvent m_rowInsertionEvent = null;
+ private GridDataEvent m_rowRemovalEvent = null;
+ private GridDataEvent m_dataChangeEvent = null;
+ private GridDataEvent m_rowHeadingChangeEvent = null;
+ private boolean m_disposed = false;
+}
diff --git a/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java
new file mode 100755
index 000000000000..c550dd9a047d
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java
@@ -0,0 +1,314 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ *************************************************************************/
+
+package complex.toolkit.awtgrid;
+
+import java.lang.reflect.Method;
+import com.sun.star.awt.grid.GridDataEvent;
+import com.sun.star.awt.grid.XMutableGridDataModel;
+import com.sun.star.lang.IllegalArgumentException;
+import com.sun.star.lang.IndexOutOfBoundsException;
+import static org.junit.Assert.*;
+import static complex.toolkit.Assert.*;
+
+/** test for the <code>css.awt.grid.XMutableGridData</code> interface
+ *
+ * @author frank.schoenheit@oracle.com
+ */
+public class TMutableGridDataModel
+{
+ public TMutableGridDataModel( final XMutableGridDataModel i_dataModel )
+ {
+ m_dataModel = i_dataModel;
+
+ m_listener = new GridDataListener();
+ m_dataModel.addGridDataListener( m_listener );
+ }
+
+ /*
+ * tests the XMutableGridDataModel.addRow method
+ */
+ public void testAddRow() throws IndexOutOfBoundsException
+ {
+ m_dataModel.addRow( 1, m_rowValues[0] );
+ GridDataEvent event = m_listener.assertSingleRowInsertionEvent();
+ m_listener.reset();
+ assertEquals( "row insertion: wrong FirstRow (1)", 0, event.FirstRow );
+ assertEquals( "row insertion: wrong LastRow (1)", 0, event.LastRow );
+ impl_assertRowData( 0 );
+
+ m_dataModel.addRow( 2, m_rowValues[1] );
+ event = m_listener.assertSingleRowInsertionEvent();
+ m_listener.reset();
+ assertEquals( "row insertion: wrong FirstRow (2)", 1, event.FirstRow );
+ assertEquals( "row insertion: wrong LastRow (2)", 1, event.LastRow );
+ impl_assertRowData( 1 );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.addRows method
+ */
+ public void testAddRows() throws IndexOutOfBoundsException, IllegalArgumentException
+ {
+ assertEquals( "precondition not met: call this directly after testAddRow, please!", 2, m_dataModel.getRowCount() );
+
+ m_dataModel.addRows( new Object[] { "3", 4.0, "5" }, new Object[][] { m_rowValues[2], m_rowValues[3], m_rowValues[4] } );
+ GridDataEvent event = m_listener.assertSingleRowInsertionEvent();
+ assertEquals( "row insertion: wrong FirstRow (1)", 2, event.FirstRow );
+ assertEquals( "row insertion: wrong LastRow (1)", 4, event.LastRow );
+ m_listener.reset();
+
+ assertEquals( "data model's row count is not adjusted when adding rows", m_rowValues.length, m_dataModel.getRowCount() );
+ assertEquals( "data model's column count is not adjusted when adding rows", m_rowValues[0].length, m_dataModel.getColumnCount() );
+ for ( int row=0; row<m_rowValues.length; ++row )
+ {
+ for ( int col=0; col<m_rowValues[row].length; ++col )
+ {
+ assertEquals( "added row values are not preserved",
+ m_rowValues[row][col], m_dataModel.getCellData( col, row ) );
+ }
+ }
+
+ assertException( "addRows is expected to throw when invoked with different-sized arrays",
+ m_dataModel, "addRows", new Object[] { new Object[0], new Object[1][2] }, IllegalArgumentException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.removeRow method
+ */
+ public void testRemoveRow() throws IndexOutOfBoundsException
+ {
+ assertEquals( "precondition not met: call this directly after testAddRows, please!", m_rowValues.length, m_dataModel.getRowCount() );
+
+ final int rowToRemove = 2;
+ m_dataModel.removeRow( rowToRemove );
+ GridDataEvent event = m_listener.assertSingleRowRemovalEvent();
+ assertEquals( "incorrect notification of row removal (FirstRow)", rowToRemove, event.FirstRow );
+ assertEquals( "incorrect notification of row removal (LastRow)", rowToRemove, event.LastRow );
+ m_listener.reset();
+
+ assertEquals( "data model's row count does not reflect the removed row", m_rowValues.length - 1, m_dataModel.getRowCount() );
+ for ( int row = rowToRemove; row<m_rowValues.length-1; ++row )
+ {
+ for ( int col=0; col<m_rowValues[row].length; ++col )
+ {
+ assertEquals( "unexpected row values after removing a row (col: " + col + ", row: " + row + ")",
+ m_rowValues[row+1][col], m_dataModel.getCellData( col, row ) );
+ }
+ }
+
+ assertException( "removeRow silently ignores an invalid index (1)",
+ m_dataModel, "removeRow", new Object[] { -1 }, IndexOutOfBoundsException.class );
+ assertException( "removeRow silently ignores an invalid index (2)",
+ m_dataModel, "removeRow", new Object[] { m_dataModel.getRowCount() }, IndexOutOfBoundsException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.removeAllRows method
+ */
+ public void testRemoveAllRows()
+ {
+ assertEquals( "precondition not met: call this directly after testRemoveRow, please!", m_rowValues.length - 1, m_dataModel.getRowCount() );
+
+ m_dataModel.removeAllRows();
+ final GridDataEvent event = m_listener.assertSingleRowRemovalEvent();
+ if ( event.FirstRow != -1 )
+ { // notifying "-1" is allowed, this means "all rows affected", by definition
+ assertEquals( "removeAllRows is not notifying properly (1)", 0, event.FirstRow );
+ assertEquals( "removeAllRows is not notifying properly (2)", m_rowValues.length - 1, event.LastRow );
+ }
+ m_listener.reset();
+ }
+
+ /**
+ * tests the XMutableGridDataModel.updateCellData method
+ */
+ public void testUpdateCellData() throws IndexOutOfBoundsException, IllegalArgumentException
+ {
+ assertEquals( "precondition not met: call this directly after testRemoveAllRows, please!", 0, m_dataModel.getRowCount() );
+
+ m_dataModel.addRows( new Object[] { 1, 2, 3, 4, 5 }, m_rowValues );
+ m_listener.assertSingleRowInsertionEvent();
+ m_listener.reset();
+
+ final Object[][] modifyValues = new Object[][] {
+ new Object[] { 2, 1, "text" },
+ new Object[] { 3, 0, null },
+ new Object[] { 0, 4, new Double( 33.0 ) }
+ };
+ for ( int i = 0; i < modifyValues.length; ++i )
+ {
+ final int row = ((Integer)modifyValues[i][0]).intValue();
+ final int col = ((Integer)modifyValues[i][1]).intValue();
+ final Object value = modifyValues[i][2];
+ m_dataModel.updateCellData( col, row, value );
+
+ final GridDataEvent event = m_listener.assertSingleDataChangeEvent();
+ assertEquals( "data change notification: FirstRow is invalid", row, event.FirstRow );
+ assertEquals( "data change notification: LastRow is invalid", row, event.LastRow );
+ assertEquals( "data change notification: FirstColumn is invalid", col, event.FirstColumn );
+ assertEquals( "data change notification: LastColumn is invalid", col, event.LastColumn );
+ m_listener.reset();
+
+ assertEquals( "data change at (" + col + ", " + row + ") not successful", value, m_dataModel.getCellData( col, row ) );
+ }
+
+ assertException( "updateCellData silently ignores an invalid index (1)",
+ m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class },
+ new Object[] { -1, -1, "text" }, IndexOutOfBoundsException.class );
+ assertException( "updateCellData silently ignores an invalid index (2)",
+ m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class },
+ new Object[] { 0, m_dataModel.getRowCount(), "text" }, IndexOutOfBoundsException.class );
+ assertException( "updateCellData silently ignores an invalid index (3)",
+ m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class },
+ new Object[] { m_dataModel.getColumnCount(), 0, "text" }, IndexOutOfBoundsException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.updateRowData method
+ */
+ public void testUpdateRowData() throws IndexOutOfBoundsException, IllegalArgumentException
+ {
+ assertEquals( "precondition not met: call this directly after testRemoveAllRows, please!", m_rowValues.length, m_dataModel.getRowCount() );
+
+ // get data from before the update
+ final Object[][] preUpdateValues = impl_getCurrentData();
+
+ // do the update
+ final int[] colIndexes = new int[] {
+ 0, 3, 4
+ };
+ final Object[] values = new Object[] {
+ 13, null, 42.0
+ };
+ final int rowToUpdate = 2;
+ m_dataModel.updateRowData( colIndexes, rowToUpdate, values );
+ final GridDataEvent event = m_listener.assertSingleDataChangeEvent();
+ assertEquals( "row update notification: FirstRow is invalid", rowToUpdate, event.FirstRow );
+ assertEquals( "row update notification: LastRow is invalid", rowToUpdate, event.LastRow );
+ assertEquals( "row update notification: FirstColumn is invalid", 0, event.FirstColumn );
+ assertEquals( "row update notification: LastColumn is invalid", 4, event.LastColumn );
+ m_listener.reset();
+
+ // reflect the changes made in the pre-update data
+ for ( int i=0; i<colIndexes.length; ++i )
+ {
+ preUpdateValues[rowToUpdate][colIndexes[i]] = values[i];
+ }
+
+ // get data from after the update
+ final Object[][] postUpdateValues = impl_getCurrentData();
+
+ // ensure both the manually updated pre-update data and the post-update data are identical
+ assertArrayEquals( preUpdateValues, postUpdateValues );
+
+
+ assertException( "updateRowData silently ignores an invalid index (1)",
+ m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class },
+ new Object[] { new int[] { -1 }, 0, new Object[] { "text" } }, IndexOutOfBoundsException.class );
+ assertException( "updateRowData silently ignores an invalid index (2)",
+ m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class },
+ new Object[] { new int[] { 0 }, -1, new Object[] { "" } }, IndexOutOfBoundsException.class );
+ assertException( "updateRowData silently ignores different-sized arrays",
+ m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class },
+ new Object[] { new int[] { 0, 0 }, 0, new Object[] { "" } }, IllegalArgumentException.class );
+ }
+
+ /**
+ * tests the XMutableGridDataModel.updateRowHeading method
+ */
+ public void testUpdateRowHeading() throws IndexOutOfBoundsException
+ {
+ assertEquals( "precondition not met: call this directly after testUpdateRowData, please!", m_rowValues.length, m_dataModel.getRowCount() );
+
+ final Object[] preUpdateHeadings = impl_getCurrentRowHeadings();
+
+ final int rowToUpdate = 2;
+ final String valueToUpdate = "some text";
+ m_dataModel.updateRowHeading( rowToUpdate, valueToUpdate );
+ final GridDataEvent event = m_listener.assertSingleRowHeadingChangeEvent();
+ assertEquals( "row heading update notification: FirstRow is invalid", rowToUpdate, event.FirstRow );
+ assertEquals( "row heading update notification: FirstRow is invalid", rowToUpdate, event.LastRow );
+ m_listener.reset();
+
+ preUpdateHeadings[rowToUpdate] = valueToUpdate;
+
+ final Object[] postUpdateHeadings = impl_getCurrentRowHeadings();
+ assertArrayEquals( preUpdateHeadings, postUpdateHeadings );
+
+ assertException( "updateRowHeading silently ignores an invalid index",
+ m_dataModel, "updateRowHeading", new Class[] { int.class, Object.class },
+ new Object[] { -1, "" }, IndexOutOfBoundsException.class );
+ }
+
+ public void cleanup()
+ {
+ m_dataModel.removeGridDataListener( m_listener );
+ }
+
+ private Object[][] impl_getCurrentData() throws IndexOutOfBoundsException
+ {
+ final int rowCount = m_dataModel.getRowCount();
+ final int colCount = m_dataModel.getColumnCount();
+ final Object[][] data = new Object[rowCount][colCount];
+ for ( int row=0; row<rowCount; ++row )
+ {
+ for ( int col=0; col<colCount; ++col )
+ {
+ data[row][col] = m_dataModel.getCellData( col, row );
+ }
+ }
+ return data;
+ }
+
+ private Object[] impl_getCurrentRowHeadings() throws IndexOutOfBoundsException
+ {
+ final int rowCount = m_dataModel.getRowCount();
+ final Object[] headings = new Object[rowCount];
+ for ( int row=0; row<rowCount; ++row )
+ headings[row] = m_dataModel.getRowHeading( row );
+ return headings;
+ }
+
+ private void impl_assertRowData( final int i_rowIndex ) throws IndexOutOfBoundsException
+ {
+ for ( int i=0; i<m_rowValues[i_rowIndex].length; ++i )
+ {
+ assertEquals( m_rowValues[i_rowIndex][i], m_dataModel.getCellData( i, i_rowIndex ) );
+ }
+ }
+
+ private final XMutableGridDataModel m_dataModel;
+ private final GridDataListener m_listener;
+
+ private final static Object[][] m_rowValues = new Object[][] {
+ new Object[] { 1, 2, "3", 4, 5 },
+ new Object[] { 2, 3, 4, "5", 6 },
+ new Object[] { "3", 4, 5, 6, 7 },
+ new Object[] { 4, 5, 6, 7, "8" },
+ new Object[] { 5, "6", 7, 8, 9 },
+ };
+}
diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk
new file mode 100755
index 000000000000..ecb173f9bdac
--- /dev/null
+++ b/toolkit/qa/complex/toolkit/makefile.mk
@@ -0,0 +1,97 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+.IF "$(OOO_JUNIT_JAR)" == ""
+nothing .PHONY:
+ @echo -----------------------------------------------------
+ @echo - JUnit not available, not building anything
+ @echo -----------------------------------------------------
+.ELSE # IF "$(OOO_JUNIT_JAR)" != ""
+
+PRJ = ../../..
+PRJNAME = toolkit
+TARGET = qa_complex_toolkit
+PACKAGE = complex/toolkit
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+#----- compile .java files -----------------------------------------
+
+JARFILES = OOoRunnerLight.jar ridl.jar test.jar unoil.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+
+JAVAFILES = \
+ $(JAVATESTFILES) \
+ accessibility/_XAccessibleComponent.java \
+ accessibility/_XAccessibleContext.java \
+ accessibility/_XAccessibleEventBroadcaster.java \
+ accessibility/_XAccessibleExtendedComponent.java \
+ accessibility/_XAccessibleText.java \
+ Assert.java \
+ awtgrid/GridDataListener.java \
+ awtgrid/TMutableGridDataModel.java \
+ awtgrid/DummyColumn.java \
+
+#----- create a jar from compiled files ----------------------------
+
+JARTARGET = $(TARGET).jar
+
+#----- JUnit tests class -------------------------------------------
+
+JAVATESTFILES = \
+ GridControl.java \
+ UnitConversion.java \
+
+
+# disabled for now - the tests fail on at least one platform
+# no issue, yet (not sure this is worth it. Don't know who to give the issue to, and don't know whether the test really makes sense)
+DISABLED_JAVA_TEST_FILES=\
+ AccessibleStatusBar.java\
+ AccessibleStatusBarItem.java
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE: target.mk
+
+ALL : ALLTAR
+
+# --- subsequent tests ---------------------------------------------
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" != ""
+
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+ # Sample how to debug
+ # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
+
+.END # "$(OOO_SUBSEQUENT_TESTS)" == ""
+
+.END # ELSE "$(OOO_JUNIT_JAR)" != ""
diff --git a/toolkit/qa/unoapi/Test.java b/toolkit/qa/unoapi/Test.java
new file mode 100644
index 000000000000..0543fee83f9f
--- /dev/null
+++ b/toolkit/qa/unoapi/Test.java
@@ -0,0 +1,52 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+package org.openoffice.toolkit.qa.unoapi;
+
+import org.openoffice.Runner;
+import org.openoffice.test.OfficeConnection;
+import org.openoffice.test.Argument;
+import static org.junit.Assert.*;
+
+public final class Test {
+ @org.junit.Before public void setUp() throws Exception {
+ connection.setUp();
+ }
+
+ @org.junit.After public void tearDown()
+ throws InterruptedException, com.sun.star.uno.Exception
+ {
+ connection.tearDown();
+ }
+
+ @org.junit.Test public void test() {
+ assertTrue(
+ Runner.run(
+ "-sce", Argument.get("sce"), "-xcl", Argument.get("xcl"), "-tdoc",
+ Argument.get("tdoc"), "-cs", connection.getDescription()));
+ }
+
+ private final OfficeConnection connection = new OfficeConnection();
+}
diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl
new file mode 100644
index 000000000000..273b4b72dbe2
--- /dev/null
+++ b/toolkit/qa/unoapi/knownissues.xcl
@@ -0,0 +1,260 @@
+### 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
+
+### 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.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
+
+### i109643 ###
+toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleValue
+toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleEventBroadcaster
+toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection
+
+### i111113 ###
+toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent
+toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext
+
+### i111195 ###
+toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleValue
+
+### i113489 ###
+toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleText
+toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleComponent
+toolkit.AccessibleMenuSeparator::com::sun::star::accessibility::XAccessibleComponent
+
+### i114213 ###
+toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleSelection
+
+### i114636 ###
+toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleAction
+toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleContext
diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk
new file mode 100644
index 000000000000..9517601c3917
--- /dev/null
+++ b/toolkit/qa/unoapi/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.
+#***********************************************************************/
+
+.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
+nothing .PHONY:
+.ELSE
+
+PRJ = ../..
+PRJNAME = toolkit
+TARGET = qa_unoapi
+
+.IF "$(OOO_JUNIT_JAR)" != ""
+PACKAGE = org/openoffice/toolkit/qa/unoapi
+JAVATESTFILES = Test.java
+JAVAFILES = $(JAVATESTFILES)
+JARFILES = OOoRunner.jar ridl.jar test.jar
+EXTRAJARFILES = $(OOO_JUNIT_JAR)
+.END
+
+.INCLUDE: settings.mk
+.INCLUDE: target.mk
+.INCLUDE: installationtest.mk
+
+ALLTAR : javatest
+
+.END
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..00af010d23d6
--- /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
+#i111225 -o toolkit.AccessibleStatusBar
+-o toolkit.AccessibleStatusBarItem
+#i109643 -o toolkit.AccessibleTabControl
+#i109643 -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
+-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
+#allegedly was i80788, but still broken: -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/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx
new file mode 100755
index 000000000000..c9c640d51c60
--- /dev/null
+++ b/toolkit/source/awt/animatedimagespeer.cxx
@@ -0,0 +1,538 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/awt/animatedimagespeer.hxx"
+#include "toolkit/helper/property.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XAnimatedImages.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <comphelper/processfactory.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/urlobj.hxx>
+#include <vcl/throbber.hxx>
+
+#include <limits>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::awt::XAnimatedImages;
+ using ::com::sun::star::awt::Size;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::graphic::XGraphicProvider;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::graphic::XGraphic;
+ /** === end UNO using === **/
+ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+
+ //==================================================================================================================
+ //= AnimatedImagesPeer_Data
+ //==================================================================================================================
+ struct CachedImage
+ {
+ ::rtl::OUString sImageURL;
+ mutable Reference< XGraphic > xGraphic;
+
+ CachedImage()
+ :sImageURL()
+ ,xGraphic()
+ {
+ }
+
+ CachedImage( ::rtl::OUString const& i_imageURL )
+ :sImageURL( i_imageURL )
+ ,xGraphic()
+ {
+ }
+ };
+
+ struct AnimatedImagesPeer_Data
+ {
+ AnimatedImagesPeer& rAntiImpl;
+ ::std::vector< ::std::vector< CachedImage > > aCachedImageSets;
+
+ AnimatedImagesPeer_Data( AnimatedImagesPeer& i_antiImpl )
+ :rAntiImpl( i_antiImpl )
+ ,aCachedImageSets()
+ {
+ }
+ };
+
+ //==================================================================================================================
+ //= helper
+ //==================================================================================================================
+ namespace
+ {
+ //--------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString lcl_getHighContrastURL( ::rtl::OUString const& i_imageURL )
+ {
+ INetURLObject aURL( i_imageURL );
+ if ( aURL.GetProtocol() != INET_PROT_PRIV_SOFFICE )
+ {
+ OSL_VERIFY( aURL.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "hicontrast" ) ), false, 0 ) );
+ return aURL.GetMainURL( INetURLObject::NO_DECODE );
+ }
+ // the private: scheme is not considered to be hierarchical by INetURLObject, so manually insert the
+ // segment
+ const sal_Int32 separatorPos = i_imageURL.indexOf( '/' );
+ ENSURE_OR_RETURN( separatorPos != -1, "lcl_getHighContrastURL: unsipported URL scheme - cannot automatically determine HC version!", i_imageURL );
+
+ ::rtl::OUStringBuffer composer;
+ composer.append( i_imageURL.copy( 0, separatorPos ) );
+ composer.appendAscii( "/hicontrast" );
+ composer.append( i_imageURL.copy( separatorPos ) );
+ return composer.makeStringAndClear();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ bool lcl_ensureImage_throw( Reference< XGraphicProvider > const& i_graphicProvider, const bool i_isHighContrast, const CachedImage& i_cachedImage )
+ {
+ if ( !i_cachedImage.xGraphic.is() )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ if ( i_isHighContrast )
+ {
+ // try (to find) the high-contrast version of the graphic first
+ aMediaProperties.put( "URL", lcl_getHighContrastURL( i_cachedImage.sImageURL ) );
+ i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY );
+ }
+ if ( !i_cachedImage.xGraphic.is() )
+ {
+ aMediaProperties.put( "URL", i_cachedImage.sImageURL );
+ i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY );
+ }
+ }
+ return i_cachedImage.xGraphic.is();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ Size lcl_getGraphicSizePixel( Reference< XGraphic > const& i_graphic )
+ {
+ Size aSizePixel;
+ try
+ {
+ if ( i_graphic.is() )
+ {
+ const Reference< XPropertySet > xGraphicProps( i_graphic, UNO_QUERY_THROW );
+ OSL_VERIFY( xGraphicProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SizePixel" ) ) ) >>= aSizePixel );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return aSizePixel;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_init( Sequence< ::rtl::OUString > const& i_imageURLs, ::std::vector< CachedImage >& o_images )
+ {
+ o_images.resize(0);
+ size_t count = size_t( i_imageURLs.getLength() );
+ o_images.reserve( count );
+ for ( size_t i = 0; i < count; ++i )
+ {
+ o_images.push_back( CachedImage( i_imageURLs[i] ) );
+ }
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_updateImageList_nothrow( AnimatedImagesPeer_Data& i_data )
+ {
+ Throbber* pThrobber = dynamic_cast< Throbber* >( i_data.rAntiImpl.GetWindow() );
+ if ( pThrobber == NULL )
+ return;
+
+ try
+ {
+ // collect the image sizes of the different image sets
+ const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ const Reference< XGraphicProvider > xGraphicProvider( aContext.createComponent( "com.sun.star.graphic.GraphicProvider" ), UNO_QUERY_THROW );
+
+ const bool isHighContrast = pThrobber->GetSettings().GetStyleSettings().GetHighContrastMode();
+
+ sal_Int32 nPreferredSet = -1;
+ const size_t nImageSetCount = i_data.aCachedImageSets.size();
+ if ( nImageSetCount < 2 )
+ {
+ nPreferredSet = sal_Int32( nImageSetCount ) - 1;
+ }
+ else
+ {
+ ::std::vector< Size > aImageSizes( nImageSetCount );
+ for ( sal_Int32 nImageSet = 0; size_t( nImageSet ) < nImageSetCount; ++nImageSet )
+ {
+ ::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nImageSet ] );
+ if ( ( rImageSet.empty() )
+ || ( !lcl_ensureImage_throw( xGraphicProvider, isHighContrast, rImageSet[0] ) )
+ )
+ {
+ aImageSizes[ nImageSet ] = Size( ::std::numeric_limits< long >::max(), ::std::numeric_limits< long >::max() );
+ }
+ else
+ {
+ aImageSizes[ nImageSet ] = lcl_getGraphicSizePixel( rImageSet[0].xGraphic );
+ }
+ }
+
+ // find the set with the smallest difference between window size and image size
+ const ::Size aWindowSizePixel = pThrobber->GetSizePixel();
+ long nMinimalDistance = ::std::numeric_limits< long >::max();
+ for ( ::std::vector< Size >::const_iterator check = aImageSizes.begin();
+ check != aImageSizes.end();
+ ++check
+ )
+ {
+ if ( ( check->Width > aWindowSizePixel.Width() )
+ || ( check->Height > aWindowSizePixel.Height() )
+ )
+ // do not use an image set which doesn't fit into the window
+ continue;
+
+ const sal_Int64 distance =
+ ( aWindowSizePixel.Width() - check->Width ) * ( aWindowSizePixel.Width() - check->Width )
+ + ( aWindowSizePixel.Height() - check->Height ) * ( aWindowSizePixel.Height() - check->Height );
+ if ( distance < nMinimalDistance )
+ {
+ nMinimalDistance = distance;
+ nPreferredSet = check - aImageSizes.begin();
+ }
+ }
+ }
+
+ // found a set?
+ Sequence< Reference< XGraphic > > aImages;
+ if ( ( nPreferredSet >= 0 ) && ( size_t( nPreferredSet ) < nImageSetCount ) )
+ {
+ // => set the images
+ ::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nPreferredSet ] );
+ aImages.realloc( rImageSet.size() );
+ sal_Int32 imageIndex = 0;
+ for ( ::std::vector< CachedImage >::const_iterator cachedImage = rImageSet.begin();
+ cachedImage != rImageSet.end();
+ ++cachedImage, ++imageIndex
+ )
+ {
+ lcl_ensureImage_throw( xGraphicProvider, isHighContrast, *cachedImage );
+ aImages[ imageIndex ] = cachedImage->xGraphic;
+ }
+ }
+ pThrobber->setImageList( aImages );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void lcl_updateImageList_nothrow( AnimatedImagesPeer_Data& i_data, const Reference< XAnimatedImages >& i_images )
+ {
+ try
+ {
+ const sal_Int32 nImageSetCount = i_images->getImageSetCount();
+ i_data.aCachedImageSets.resize(0);
+ for ( sal_Int32 set = 0; set < nImageSetCount; ++set )
+ {
+ const Sequence< ::rtl::OUString > aImageURLs( i_images->getImageSet( set ) );
+ ::std::vector< CachedImage > aImages;
+ lcl_init( aImageURLs, aImages );
+ i_data.aCachedImageSets.push_back( aImages );
+ }
+
+ lcl_updateImageList_nothrow( i_data );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //==================================================================================================================
+ //= AnimatedImagesPeer
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesPeer::AnimatedImagesPeer()
+ :AnimatedImagesPeer_Base()
+ ,m_pData( new AnimatedImagesPeer_Data( *this ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesPeer::~AnimatedImagesPeer()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::startAnimation( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->start();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::stopAnimation( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->stop();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL AnimatedImagesPeer::isAnimationRunning( ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ return pThrobber->isRunning();
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::setProperty( const ::rtl::OUString& i_propertyName, const Any& i_value ) throw(RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
+ {
+ VCLXWindow::setProperty( i_propertyName, i_value );
+ return;
+ }
+
+ const sal_uInt16 nPropertyId = GetPropertyId( i_propertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME:
+ {
+ sal_Int32 nStepTime( 0 );
+ if ( i_value >>= nStepTime )
+ pThrobber->setStepTime( nStepTime );
+ break;
+ }
+ case BASEPROPERTY_AUTO_REPEAT:
+ {
+ sal_Bool bRepeat( sal_True );
+ if ( i_value >>= bRepeat )
+ pThrobber->setRepeat( bRepeat );
+ break;
+ }
+
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ {
+ sal_Int16 nScaleMode( ImageScaleMode::Anisotropic );
+ ImageControl* pImageControl = dynamic_cast< ImageControl* >( GetWindow() );
+ if ( pImageControl && ( i_value >>= nScaleMode ) )
+ {
+ pImageControl->SetScaleMode( nScaleMode );
+ }
+ }
+ break;
+
+ default:
+ AnimatedImagesPeer_Base::setProperty( i_propertyName, i_value );
+ break;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL AnimatedImagesPeer::getProperty( const ::rtl::OUString& i_propertyName ) throw(RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Any aReturn;
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
+ return VCLXWindow::getProperty( i_propertyName );
+
+ const sal_uInt16 nPropertyId = GetPropertyId( i_propertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME:
+ aReturn <<= pThrobber->getStepTime();
+ break;
+
+ case BASEPROPERTY_AUTO_REPEAT:
+ aReturn <<= pThrobber->getRepeat();
+ break;
+
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ {
+ ImageControl const* pImageControl = dynamic_cast< ImageControl* >( GetWindow() );
+ aReturn <<= ( pImageControl ? pImageControl->GetScaleMode() : ImageScaleMode::Anisotropic );
+ }
+ break;
+
+ default:
+ aReturn = AnimatedImagesPeer_Base::getProperty( i_propertyName );
+ break;
+ }
+
+ return aReturn;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AnimatedImagesPeer::ProcessWindowEvent( const VclWindowEvent& i_windowEvent )
+ {
+ switch ( i_windowEvent.GetId() )
+ {
+ case VCLEVENT_WINDOW_RESIZE:
+ lcl_updateImageList_nothrow( *m_pData );
+ break;
+ }
+
+ AnimatedImagesPeer_Base::ProcessWindowEvent( i_windowEvent );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void AnimatedImagesPeer::impl_updateImages_nolck( const Reference< XInterface >& i_animatedImages )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ lcl_updateImageList_nothrow( *m_pData, Reference< XAnimatedImages >( i_animatedImages, UNO_QUERY_THROW ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW );
+
+ sal_Int32 nPosition(0);
+ OSL_VERIFY( i_event.Accessor >>= nPosition );
+ size_t position = size_t( nPosition );
+ if ( position > m_pData->aCachedImageSets.size() )
+ {
+ OSL_ENSURE( false, "AnimatedImagesPeer::elementInserted: illegal accessor/index!" );
+ lcl_updateImageList_nothrow( *m_pData, xAnimatedImages );
+ }
+
+ Sequence< ::rtl::OUString > aImageURLs;
+ OSL_VERIFY( i_event.Element >>= aImageURLs );
+ ::std::vector< CachedImage > aImages;
+ lcl_init( aImageURLs, aImages );
+ m_pData->aCachedImageSets.insert( m_pData->aCachedImageSets.begin() + position, aImages );
+ lcl_updateImageList_nothrow( *m_pData );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW );
+
+ sal_Int32 nPosition(0);
+ OSL_VERIFY( i_event.Accessor >>= nPosition );
+ size_t position = size_t( nPosition );
+ if ( position >= m_pData->aCachedImageSets.size() )
+ {
+ OSL_ENSURE( false, "AnimatedImagesPeer::elementRemoved: illegal accessor/index!" );
+ lcl_updateImageList_nothrow( *m_pData, xAnimatedImages );
+ }
+
+ m_pData->aCachedImageSets.erase( m_pData->aCachedImageSets.begin() + position );
+ lcl_updateImageList_nothrow( *m_pData );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Reference< XAnimatedImages > xAnimatedImages( i_event.Source, UNO_QUERY_THROW );
+
+ sal_Int32 nPosition(0);
+ OSL_VERIFY( i_event.Accessor >>= nPosition );
+ size_t position = size_t( nPosition );
+ if ( position >= m_pData->aCachedImageSets.size() )
+ {
+ OSL_ENSURE( false, "AnimatedImagesPeer::elementReplaced: illegal accessor/index!" );
+ lcl_updateImageList_nothrow( *m_pData, xAnimatedImages );
+ }
+
+ Sequence< ::rtl::OUString > aImageURLs;
+ OSL_VERIFY( i_event.Element >>= aImageURLs );
+ ::std::vector< CachedImage > aImages;
+ lcl_init( aImageURLs, aImages );
+ m_pData->aCachedImageSets[ position ] = aImages;
+ lcl_updateImageList_nothrow( *m_pData );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ VCLXWindow::disposing( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::modified( const EventObject& i_event ) throw (RuntimeException)
+ {
+ impl_updateImages_nolck( i_event.Source );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesPeer::dispose( ) throw(RuntimeException)
+ {
+ AnimatedImagesPeer_Base::dispose();
+ ::vos::OGuard aGuard( GetMutex() );
+ m_pData->aCachedImageSets.resize(0);
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/awt/asynccallback.cxx b/toolkit/source/awt/asynccallback.cxx
new file mode 100644
index 000000000000..9e5334b2d28c
--- /dev/null
+++ b/toolkit/source/awt/asynccallback.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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);
+}
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/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/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx
new file mode 100644
index 000000000000..fc3ec241101c
--- /dev/null
+++ b/toolkit/source/awt/stylesettings.cxx
@@ -0,0 +1,987 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "stylesettings.hxx"
+#include <toolkit/awt/vclxwindow.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/interfacecontainer.hxx>
+#include <vos/mutex.hxx>
+#include <osl/mutex.hxx>
+#include <vcl/window.hxx>
+#include <vcl/settings.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::FontDescriptor;
+ using ::com::sun::star::awt::XStyleChangeListener;
+ using ::com::sun::star::awt::FontDescriptor;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= WindowStyleSettings_Data
+ //==================================================================================================================
+ struct WindowStyleSettings_Data
+ {
+ ::vos::IMutex& rMutex;
+ VCLXWindow* pOwningWindow;
+ ::cppu::OInterfaceContainerHelper aStyleChangeListeners;
+
+ WindowStyleSettings_Data( ::vos::IMutex& i_rWindowMutex, ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow )
+ :rMutex( i_rWindowMutex )
+ ,pOwningWindow( &i_rOwningWindow )
+ ,aStyleChangeListeners( i_rListenerMutex )
+ {
+ }
+
+ DECL_LINK( OnWindowEvent, const VclWindowEvent* );
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ IMPL_LINK( WindowStyleSettings_Data, OnWindowEvent, const VclWindowEvent*, i_pEvent )
+ {
+ if ( !i_pEvent || ( i_pEvent->GetId() != VCLEVENT_WINDOW_DATACHANGED ) )
+ return 0L;
+ const DataChangedEvent* pDataChangedEvent = static_cast< const DataChangedEvent* >( i_pEvent->GetData() );
+ if ( !pDataChangedEvent || ( pDataChangedEvent->GetType() != DATACHANGED_SETTINGS ) )
+ return 0L;
+ if ( ( pDataChangedEvent->GetFlags() & SETTINGS_STYLE ) == 0 )
+ return 0L;
+
+ EventObject aEvent( *pOwningWindow );
+ aStyleChangeListeners.notifyEach( &XStyleChangeListener::styleSettingsChanged, aEvent );
+ return 1L;
+ }
+
+ //==================================================================================================================
+ //= StyleMethodGuard
+ //==================================================================================================================
+ class StyleMethodGuard
+ {
+ public:
+ StyleMethodGuard( WindowStyleSettings_Data& i_rData )
+ :m_aGuard( i_rData.rMutex )
+ {
+ if ( i_rData.pOwningWindow == NULL )
+ throw DisposedException();
+ }
+
+ ~StyleMethodGuard()
+ {
+ }
+
+ private:
+ ::vos::OGuard m_aGuard;
+ };
+
+ //==================================================================================================================
+ //= WindowStyleSettings
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ WindowStyleSettings::WindowStyleSettings( ::vos::IMutex& i_rWindowMutex, ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow )
+ :m_pData( new WindowStyleSettings_Data( i_rWindowMutex, i_rListenerMutex, i_rOwningWindow ) )
+ {
+ Window* pWindow = i_rOwningWindow.GetWindow();
+ if ( !pWindow )
+ throw new RuntimeException();
+ pWindow->AddEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ WindowStyleSettings::~WindowStyleSettings()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void WindowStyleSettings::dispose()
+ {
+ StyleMethodGuard aGuard( *m_pData );
+
+ Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ OSL_ENSURE( pWindow, "WindowStyleSettings::dispose: window has been reset before we could revoke the listener!" );
+ if ( pWindow )
+ pWindow->RemoveEventListener( LINK( m_pData.get(), WindowStyleSettings_Data, OnWindowEvent ) );
+
+ EventObject aEvent( *this );
+ m_pData->aStyleChangeListeners.disposeAndClear( aEvent );
+
+ m_pData->pOwningWindow = NULL;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ sal_Int32 lcl_getStyleColor( WindowStyleSettings_Data& i_rData, Color const & (StyleSettings::*i_pGetter)() const )
+ {
+ const Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ const AllSettings aAllSettings = pWindow->GetSettings();
+ const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ return (aStyleSettings.*i_pGetter)().GetColor();
+ }
+
+ void lcl_setStyleColor( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( Color const & ), const sal_Int32 i_nColor )
+ {
+ Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ AllSettings aAllSettings = pWindow->GetSettings();
+ StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ (aStyleSettings.*i_pSetter)( Color( i_nColor ) );
+ aAllSettings.SetStyleSettings( aStyleSettings );
+ pWindow->SetSettings( aAllSettings );
+ }
+
+ FontDescriptor lcl_getStyleFont( WindowStyleSettings_Data& i_rData, Font const & (StyleSettings::*i_pGetter)() const )
+ {
+ const Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ const AllSettings aAllSettings = pWindow->GetSettings();
+ const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ return VCLUnoHelper::CreateFontDescriptor( (aStyleSettings.*i_pGetter)() );
+ }
+
+ void lcl_setStyleFont( WindowStyleSettings_Data& i_rData, void (StyleSettings::*i_pSetter)( Font const &),
+ Font const & (StyleSettings::*i_pGetter)() const, const FontDescriptor& i_rFont )
+ {
+ Window* pWindow = i_rData.pOwningWindow->GetWindow();
+ AllSettings aAllSettings = pWindow->GetSettings();
+ StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ const Font aNewFont = VCLUnoHelper::CreateFont( i_rFont, (aStyleSettings.*i_pGetter)() );
+ (aStyleSettings.*i_pSetter)( aNewFont );
+ aAllSettings.SetStyleSettings( aStyleSettings );
+ pWindow->SetSettings( aAllSettings );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveBorderColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveBorderColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setActiveBorderColor( ::sal_Int32 _activebordercolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveBorderColor, _activebordercolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setActiveColor( ::sal_Int32 _activecolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveColor, _activecolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTabColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTabColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setActiveTabColor( ::sal_Int32 _activetabcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTabColor, _activetabcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getActiveTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetActiveTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setActiveTextColor( ::sal_Int32 _activetextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetActiveTextColor, _activetextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonRolloverTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonRolloverTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonRolloverTextColor, _buttonrollovertextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getButtonTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetButtonTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setButtonTextColor( ::sal_Int32 _buttontextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetButtonTextColor, _buttontextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getCheckedColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetCheckedColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setCheckedColor( ::sal_Int32 _checkedcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetCheckedColor, _checkedcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDarkShadowColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDarkShadowColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setDarkShadowColor( ::sal_Int32 _darkshadowcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDarkShadowColor, _darkshadowcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveBorderColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveBorderColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveBorderColor, _deactivebordercolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setDeactiveColor( ::sal_Int32 _deactivecolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveColor, _deactivecolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDeactiveTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDeactiveTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setDeactiveTextColor( ::sal_Int32 _deactivetextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDeactiveTextColor, _deactivetextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setDialogColor( ::sal_Int32 _dialogcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogColor, _dialogcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDialogTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDialogTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setDialogTextColor( ::sal_Int32 _dialogtextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDialogTextColor, _dialogtextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getDisableColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetDisableColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setDisableColor( ::sal_Int32 _disablecolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetDisableColor, _disablecolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetFaceColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setFaceColor( ::sal_Int32 _facecolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetFaceColor, _facecolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getFaceGradientColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ const Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ const AllSettings aAllSettings = pWindow->GetSettings();
+ const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ return aStyleSettings.GetFaceGradientColor().GetColor();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setFieldColor( ::sal_Int32 _fieldcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldColor, _fieldcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldRolloverTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldRolloverTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldRolloverTextColor, _fieldrollovertextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getFieldTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetFieldTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setFieldTextColor( ::sal_Int32 _fieldtextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetFieldTextColor, _fieldtextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getGroupTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetGroupTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setGroupTextColor( ::sal_Int32 _grouptextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetGroupTextColor, _grouptextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setHelpColor( ::sal_Int32 _helpcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpColor, _helpcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getHelpTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetHelpTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setHelpTextColor( ::sal_Int32 _helptextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetHelpTextColor, _helptextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setHighlightColor( ::sal_Int32 _highlightcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightColor, _highlightcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getHighlightTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetHighlightTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setHighlightTextColor( ::sal_Int32 _highlighttextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetHighlightTextColor, _highlighttextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getInactiveTabColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetInactiveTabColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setInactiveTabColor( ::sal_Int32 _inactivetabcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetInactiveTabColor, _inactivetabcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getInfoTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetInfoTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setInfoTextColor( ::sal_Int32 _infotextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetInfoTextColor, _infotextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getLabelTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetLabelTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setLabelTextColor( ::sal_Int32 _labeltextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetLabelTextColor, _labeltextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getLightColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetLightColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setLightColor( ::sal_Int32 _lightcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetLightColor, _lightcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuBarColor( ::sal_Int32 _menubarcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarColor, _menubarcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBarTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBarTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuBarTextColor( ::sal_Int32 _menubartextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBarTextColor, _menubartextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuBorderColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuBorderColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuBorderColor( ::sal_Int32 _menubordercolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuBorderColor, _menubordercolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuColor( ::sal_Int32 _menucolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuColor, _menucolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightColor, _menuhighlightcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuHighlightTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuHighlightTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuHighlightTextColor, _menuhighlighttextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMenuTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMenuTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuTextColor( ::sal_Int32 _menutextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMenuTextColor, _menutextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getMonoColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetMonoColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMonoColor( ::sal_Int32 _monocolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetMonoColor, _monocolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getRadioCheckTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetRadioCheckTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetRadioCheckTextColor, _radiochecktextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getSeparatorColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ const Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ const AllSettings aAllSettings = pWindow->GetSettings();
+ const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ return aStyleSettings.GetSeparatorColor().GetColor();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getShadowColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetShadowColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setShadowColor( ::sal_Int32 _shadowcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetShadowColor, _shadowcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setWindowColor( ::sal_Int32 _windowcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowColor, _windowcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getWindowTextColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetWindowTextColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setWindowTextColor( ::sal_Int32 _windowtextcolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetWindowTextColor, _windowtextcolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL WindowStyleSettings::getWorkspaceColor() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleColor( *m_pData, &StyleSettings::GetWorkspaceColor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setWorkspaceColor( ::sal_Int32 _workspacecolor ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleColor( *m_pData, &StyleSettings::SetWorkspaceColor, _workspacecolor );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL WindowStyleSettings::getHighContrastMode() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ const Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ const AllSettings aAllSettings = pWindow->GetSettings();
+ const StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ return aStyleSettings.GetHighContrastMode();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setHighContrastMode( ::sal_Bool _highcontrastmode ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ Window* pWindow = m_pData->pOwningWindow->GetWindow();
+ AllSettings aAllSettings = pWindow->GetSettings();
+ StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ aStyleSettings.SetHighContrastMode( _highcontrastmode );
+ aAllSettings.SetStyleSettings( aStyleSettings );
+ pWindow->SetSettings( aAllSettings );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getApplicationFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetAppFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setApplicationFont( const FontDescriptor& _applicationfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetAppFont, &StyleSettings::GetAppFont, _applicationfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getHelpFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetHelpFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setHelpFont( const FontDescriptor& _helpfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetHelpFont, &StyleSettings::GetHelpFont, _helpfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getTitleFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetTitleFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setTitleFont( const FontDescriptor& _titlefont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetTitleFont, &StyleSettings::GetTitleFont, _titlefont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getFloatTitleFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetFloatTitleFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setFloatTitleFont( const FontDescriptor& _floattitlefont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetFloatTitleFont, &StyleSettings::GetFloatTitleFont, _floattitlefont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getMenuFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetMenuFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setMenuFont( const FontDescriptor& _menufont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetMenuFont, &StyleSettings::GetMenuFont, _menufont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getToolFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetToolFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setToolFont( const FontDescriptor& _toolfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetToolFont, &StyleSettings::GetToolFont, _toolfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getGroupFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetGroupFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setGroupFont( const FontDescriptor& _groupfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetGroupFont, &StyleSettings::GetGroupFont, _groupfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getLabelFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetLabelFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setLabelFont( const FontDescriptor& _labelfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetLabelFont, &StyleSettings::GetLabelFont, _labelfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getInfoFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetInfoFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setInfoFont( const FontDescriptor& _infofont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetInfoFont, &StyleSettings::GetInfoFont, _infofont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getRadioCheckFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetRadioCheckFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setRadioCheckFont( const FontDescriptor& _radiocheckfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetRadioCheckFont, &StyleSettings::GetRadioCheckFont, _radiocheckfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getPushButtonFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetPushButtonFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setPushButtonFont( const FontDescriptor& _pushbuttonfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetPushButtonFont, &StyleSettings::GetPushButtonFont, _pushbuttonfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ FontDescriptor SAL_CALL WindowStyleSettings::getFieldFont() throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ return lcl_getStyleFont( *m_pData, &StyleSettings::GetFieldFont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::setFieldFont( const FontDescriptor& _fieldfont ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ lcl_setStyleFont( *m_pData, &StyleSettings::SetFieldFont, &StyleSettings::GetFieldFont, _fieldfont );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::addStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ if ( i_rListener.is() )
+ m_pData->aStyleChangeListeners.addInterface( i_rListener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL WindowStyleSettings::removeStyleChangeListener( const Reference< XStyleChangeListener >& i_rListener ) throw (RuntimeException)
+ {
+ StyleMethodGuard aGuard( *m_pData );
+ if ( i_rListener.is() )
+ m_pData->aStyleChangeListeners.removeInterface( i_rListener );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/awt/stylesettings.hxx b/toolkit/source/awt/stylesettings.hxx
new file mode 100644
index 000000000000..466e50bad1f1
--- /dev/null
+++ b/toolkit/source/awt/stylesettings.hxx
@@ -0,0 +1,188 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_STYLESETTINGS_HXX
+#define TOOLKIT_STYLESETTINGS_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XStyleSettings.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace vos
+{
+ class IMutex;
+}
+namespace osl
+{
+ class Mutex;
+}
+
+class VCLXWindow;
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= WindowStyleSettings
+ //==================================================================================================================
+ struct WindowStyleSettings_Data;
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::awt::XStyleSettings
+ > WindowStyleSettings_Base;
+ class WindowStyleSettings : public WindowStyleSettings_Base
+ {
+ public:
+ WindowStyleSettings( ::vos::IMutex& i_rWindowMutex, ::osl::Mutex& i_rListenerMutex, VCLXWindow& i_rOwningWindow );
+ ~WindowStyleSettings();
+
+ void dispose();
+
+ // XStyleSettings
+ virtual ::sal_Int32 SAL_CALL getActiveBorderColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveBorderColor( ::sal_Int32 _activebordercolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getActiveColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveColor( ::sal_Int32 _activecolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getActiveTabColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTabColor( ::sal_Int32 _activetabcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getActiveTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setActiveTextColor( ::sal_Int32 _activetextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getButtonRolloverTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setButtonRolloverTextColor( ::sal_Int32 _buttonrollovertextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getButtonTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setButtonTextColor( ::sal_Int32 _buttontextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCheckedColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setCheckedColor( ::sal_Int32 _checkedcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDarkShadowColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDarkShadowColor( ::sal_Int32 _darkshadowcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDeactiveBorderColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDeactiveBorderColor( ::sal_Int32 _deactivebordercolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDeactiveColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDeactiveColor( ::sal_Int32 _deactivecolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDeactiveTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDeactiveTextColor( ::sal_Int32 _deactivetextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDialogColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDialogColor( ::sal_Int32 _dialogcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDialogTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDialogTextColor( ::sal_Int32 _dialogtextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDisableColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDisableColor( ::sal_Int32 _disablecolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFaceColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFaceColor( ::sal_Int32 _facecolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFaceGradientColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFieldColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFieldColor( ::sal_Int32 _fieldcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFieldRolloverTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFieldRolloverTextColor( ::sal_Int32 _fieldrollovertextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFieldTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFieldTextColor( ::sal_Int32 _fieldtextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getGroupTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroupTextColor( ::sal_Int32 _grouptextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getHelpColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpColor( ::sal_Int32 _helpcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getHelpTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpTextColor( ::sal_Int32 _helptextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getHighlightColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHighlightColor( ::sal_Int32 _highlightcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getHighlightTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHighlightTextColor( ::sal_Int32 _highlighttextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getInactiveTabColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInactiveTabColor( ::sal_Int32 _inactivetabcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getInfoTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInfoTextColor( ::sal_Int32 _infotextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getLabelTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLabelTextColor( ::sal_Int32 _labeltextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getLightColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLightColor( ::sal_Int32 _lightcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMenuBarColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuBarColor( ::sal_Int32 _menubarcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMenuBarTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuBarTextColor( ::sal_Int32 _menubartextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMenuBorderColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuBorderColor( ::sal_Int32 _menubordercolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMenuColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuColor( ::sal_Int32 _menucolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMenuHighlightColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuHighlightColor( ::sal_Int32 _menuhighlightcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMenuHighlightTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuHighlightTextColor( ::sal_Int32 _menuhighlighttextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMenuTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuTextColor( ::sal_Int32 _menutextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMonoColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMonoColor( ::sal_Int32 _monocolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRadioCheckTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRadioCheckTextColor( ::sal_Int32 _radiochecktextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getSeparatorColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getShadowColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setShadowColor( ::sal_Int32 _shadowcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getWindowColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setWindowColor( ::sal_Int32 _windowcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getWindowTextColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setWindowTextColor( ::sal_Int32 _windowtextcolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getWorkspaceColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setWorkspaceColor( ::sal_Int32 _workspacecolor ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getHighContrastMode() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHighContrastMode( ::sal_Bool _highcontrastmode ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getApplicationFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setApplicationFont( const ::com::sun::star::awt::FontDescriptor& _applicationfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getHelpFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpFont( const ::com::sun::star::awt::FontDescriptor& _helpfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getTitleFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setTitleFont( const ::com::sun::star::awt::FontDescriptor& _titlefont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getFloatTitleFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFloatTitleFont( const ::com::sun::star::awt::FontDescriptor& _floattitlefont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getMenuFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMenuFont( const ::com::sun::star::awt::FontDescriptor& _menufont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getToolFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setToolFont( const ::com::sun::star::awt::FontDescriptor& _toolfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getGroupFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setGroupFont( const ::com::sun::star::awt::FontDescriptor& _groupfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getLabelFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setLabelFont( const ::com::sun::star::awt::FontDescriptor& _labelfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getInfoFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setInfoFont( const ::com::sun::star::awt::FontDescriptor& _infofont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getRadioCheckFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRadioCheckFont( const ::com::sun::star::awt::FontDescriptor& _radiocheckfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getPushButtonFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPushButtonFont( const ::com::sun::star::awt::FontDescriptor& _pushbuttonfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::FontDescriptor SAL_CALL getFieldFont() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFieldFont( const ::com::sun::star::awt::FontDescriptor& _fieldfont ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addStyleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleChangeListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeStyleChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleChangeListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ ::boost::scoped_ptr< WindowStyleSettings_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_STYLESETTINGS_HXX
diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx
new file mode 100644
index 000000000000..de5ebab36b2a
--- /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( sal_False ).is() )
+ {
+ aOldValue <<= pWindow->GetAccessible( sal_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->GetAccessibleRelationLabeledBy();
+ 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->GetAccessibleRelationLabelFor();
+ 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( (sal_uInt16)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 ( sal_uInt16 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..70ebade69ddc
--- /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( const rtl::OUString& rId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetHelpId( rtl::OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) );
+}
+
+::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..9d52064c68bf
--- /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( const rtl::OUString& 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..9d46107d8522
--- /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;
+}
+
+sal_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 ? sal_True : sal_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 ( sal_uInt16 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 );
+
+ sal_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 ( sal_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..edaf64799d43
--- /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)
+ {
+ 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..817899cdcd35
--- /dev/null
+++ b/toolkit/source/awt/vclxmenu.cxx
@@ -0,0 +1,1103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <vos/mutex.hxx>
+
+#include <vcl/menu.hxx>
+#include <vcl/keycod.hxx>
+#include <vcl/image.hxx>
+#include <vcl/mnemonic.hxx>
+#include <vcl/svapp.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;
+ }
+}
+
+sal_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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ return mpMenu ? mpMenu->GetItemCount() : 0;
+}
+
+sal_Int16 VCLXMenu::getItemId( sal_Int16 nPos ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->InsertSeparator( nPos );
+}
+
+void VCLXMenu::setDefaultItem( sal_Int16 nItemId ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+
+ if ( mpMenu )
+ mpMenu->SetDefaultItem( nItemId );
+}
+
+sal_Int16 VCLXMenu::getDefaultItem( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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 );
+ sal_uInt16 nKey = (sal_uInt16)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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return IsPopupMenu();
+}
+
+void SAL_CALL VCLXMenu::clear( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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)
+{
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ::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( sal_False );
+}
+
+VCLXMenuBar::VCLXMenuBar( MenuBar* pMenuBar ) : VCLXMenu( (Menu *)pMenuBar )
+{
+ DBG_CTOR( VCLXMenuBar, 0 );
+}
+
+// ----------------------------------------------------
+// class VCLXPopupMenu
+// ----------------------------------------------------
+
+DBG_NAME(VCLXPopupMenu);
+
+VCLXPopupMenu::VCLXPopupMenu()
+{
+ DBG_CTOR( VCLXPopupMenu, 0 );
+ ImplCreateMenu( sal_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..2b42eecc5872
--- /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 <tools/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..2a7d56554dd8
--- /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() );
+
+ sal_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..773b9922ea56
--- /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();
+ sal_uInt16 id = sal::static_int_cast< sal_uInt16 >( 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< sal_uInt16 >( ID ) ) == NULL )
+ throw IndexOutOfBoundsException();
+ pTabControl->RemovePage( sal::static_int_cast< sal_uInt16 >( ID ) );
+}
+
+void SAL_CALL VCLXTabControl::activateTab( sal_Int32 ID ) throw (uno::RuntimeException, IndexOutOfBoundsException)
+{
+ TabControl *pTabControl = getTabControl();
+ if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == NULL )
+ throw IndexOutOfBoundsException();
+ pTabControl->SelectTabPage( sal::static_int_cast< sal_uInt16 >( 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< sal_uInt16 >( 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< sal_uInt16 >( 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< sal_uInt16 >( 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< sal_uInt16 >( ID ) ) ) );
+ ADD_PROP( props, 1, "Position", pTabControl->GetPagePos( sal::static_int_cast< sal_uInt16 >( 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< sal_uInt16 >( 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< sal_uInt16 >( i+1 ) );
+ ::Rectangle page_rect = pTabControl->GetTabPageBounds( sal::static_int_cast< sal_uInt16 >( 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< sal_uInt16 >( 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:
+ {
+ sal_uLong page = (sal_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< sal_uInt16 >( 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/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
new file mode 100644
index 000000000000..d4f7a5048701
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#include "precompiled_toolkit.hxx"
+
+#include <toolkit/awt/vclxtabpagecontainer.hxx>
+#include <com/sun/star/awt/tab/XTabPageModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/tkresmgr.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+using ::rtl::OUString;
+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::container;
+using namespace ::com::sun::star::view;
+// ----------------------------------------------------
+// class VCLXTabPageContainer
+// ----------------------------------------------------
+void VCLXTabPageContainer::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+VCLXTabPageContainer::VCLXTabPageContainer() :
+ m_aTabPageListeners( *this )
+{
+}
+
+VCLXTabPageContainer::~VCLXTabPageContainer()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+void SAL_CALL VCLXTabPageContainer::draw( sal_Int32 nX, sal_Int32 nY ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabControl = (TabControl*)GetWindow();
+ if ( pTabControl )
+ {
+ TabPage *pTabPage = pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( pTabControl->GetCurPageId( ) ) );
+ 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 );
+/*
+ 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 VCLXTabPageContainer::getInfo() throw(RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+void SAL_CALL VCLXTabPageContainer::setProperty(const ::rtl::OUString& PropertyName, const Any& Value ) throw(RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ TabControl* pTabPage = (TabControl*)GetWindow();
+ if ( pTabPage )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+}
+::sal_Int16 SAL_CALL VCLXTabPageContainer::getActiveTabPageID() throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ return pTabCtrl != NULL ? pTabCtrl->GetCurPageId( ) : 0;
+}
+void SAL_CALL VCLXTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ if ( pTabCtrl )
+ pTabCtrl->SelectTabPage(_activetabpageid);
+}
+::sal_Int32 SAL_CALL VCLXTabPageContainer::getTabPageCount( ) throw (RuntimeException)
+{
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ return pTabCtrl != NULL ? pTabCtrl->GetPageCount() : 0;
+}
+::sal_Bool SAL_CALL VCLXTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ return (getActiveTabPageID() == tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ return (tabPageIndex >= 0 && tabPageIndex < static_cast<sal_Int16>(m_aTabPages.size())) ? m_aTabPages[tabPageIndex] : NULL;
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException)
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage;
+ ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aIter = m_aTabPages.begin();
+ ::std::vector< Reference< ::com::sun::star::awt::tab::XTabPage > >::iterator aEnd = m_aTabPages.end();
+ for(;aIter != aEnd;++aIter)
+ {
+ Reference< awt::XControl > xControl(*aIter,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ if ( tabPageID == xP->getTabPageID() )
+ {
+ xTabPage = *aIter;
+ break;
+ }
+ }
+ return xTabPage;
+}
+void SAL_CALL VCLXTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.addInterface( listener );
+}
+void SAL_CALL VCLXTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.removeInterface( listener );
+}
+
+void VCLXTabPageContainer::ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent )
+{
+ ::vos::OClearableGuard aGuard( GetMutex() );
+ TabControl* pTabControl = static_cast< TabControl* >( GetWindow() );
+ if ( pTabControl )
+ {
+ switch ( _rVclWindowEvent.GetId() )
+ {
+ case VCLEVENT_TABPAGE_ACTIVATE:
+ {
+// allocateArea( maAllocation );
+ sal_uLong page = (sal_uLong)_rVclWindowEvent.GetData();
+ awt::tab::TabPageActivatedEvent aEvent(NULL,page);
+ m_aTabPageListeners.tabPageActivated(aEvent);
+ break;
+ }
+ default:
+ aGuard.clear();
+ VCLXWindow::ProcessWindowEvent( _rVclWindowEvent );
+ break;
+ }
+ }
+}
+void SAL_CALL VCLXTabPageContainer::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
+void SAL_CALL VCLXTabPageContainer::elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
+ if ( pTabCtrl && xTabPage.is() )
+ {
+ Reference< awt::XControl > xControl(xTabPage,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ sal_Int16 nPageID = xP->getTabPageID();
+
+ Window* pWindow = VCLUnoHelper::GetWindow(xControl->getPeer());
+ TabPage* pPage = (TabPage*)pWindow;
+ pTabCtrl->InsertPage(nPageID,pPage->GetText());
+
+ pPage->Hide();
+ pTabCtrl->SetTabPage(nPageID,pPage);
+ pTabCtrl->SetHelpText(nPageID,xP->getTooltip());
+ pTabCtrl->SetPageImage(nPageID,TkResMgr::getImageFromURL(xP->getImageURL()));
+ pTabCtrl->SelectTabPage(nPageID);
+ m_aTabPages.push_back(xTabPage);
+ }
+}
+void SAL_CALL VCLXTabPageContainer::elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ TabControl* pTabCtrl = (TabControl*)GetWindow();
+ Reference< ::com::sun::star::awt::tab::XTabPage > xTabPage(Event.Element,uno::UNO_QUERY);
+ if ( pTabCtrl && xTabPage.is() )
+ {
+ Reference< awt::XControl > xControl(xTabPage,UNO_QUERY );
+ Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
+ pTabCtrl->RemovePage(xP->getTabPageID());
+ m_aTabPages.erase(::std::remove(m_aTabPages.begin(),m_aTabPages.end(),xTabPage));
+ }
+}
+void SAL_CALL VCLXTabPageContainer::elementReplaced( const ::com::sun::star::container::ContainerEvent& /*Event*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+}
diff --git a/toolkit/source/awt/vclxtabpagemodel.cxx b/toolkit/source/awt/vclxtabpagemodel.cxx
new file mode 100644
index 000000000000..c7145992bd7f
--- /dev/null
+++ b/toolkit/source/awt/vclxtabpagemodel.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 "precompiled_toolkit.hxx"
+
+#include <toolkit/awt/vclxtabpagemodel.hxx>
+#include <vcl/tabpage.hxx>
+#include <vcl/tabctrl.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <cppuhelper/typeprovider.hxx>
+// ----------------------------------------------------
+// class VCLXDialog
+// ----------------------------------------------------
+
+VCLXTabPageModel::VCLXTabPageModel()
+{
+}
+
+VCLXTabPageModel::~VCLXTabPageModel()
+{
+#ifndef __SUNPRO_CC
+ OSL_TRACE ("%s", __FUNCTION__);
+#endif
+}
+
+void SAL_CALL VCLXTabPageModel::draw( sal_Int32 nX, sal_Int32 nY ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard 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 VCLXTabPageModel::getInfo() throw(::com::sun::star::uno::RuntimeException)
+{
+ ::com::sun::star::awt::DeviceInfo aInfo;// = VCLXDevice::getInfo();
+ return aInfo;
+}
+
+
+void SAL_CALL VCLXTabPageModel::setProperty(
+ const ::rtl::OUString& /*PropertyName*/,
+ const ::com::sun::star::uno::Any& /*Value*/ )
+throw(::com::sun::star::uno::RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ /*TabPage* pTabPage = (TabPage*)GetWindow();
+ if ( pTabPage )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ }*/
+}
+//XTabPageModel
+::sal_Int16 SAL_CALL VCLXTabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+::sal_Bool SAL_CALL VCLXTabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+{
+ return false;
+}
+void SAL_CALL VCLXTabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // pTabControl->EnablePage(0, true);
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // return pTabControl->GetPageText(0);
+ //else
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //TabControl* pTabControl = (TabControl*)GetWindow();
+ //if ( pTabControl )
+ // pTabControl->SetPageText(0, _title);
+
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setImageURL( const ::rtl::OUString& /*_imageurl*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //m_sImageURL = _imageurl;
+}
+::rtl::OUString SAL_CALL VCLXTabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+{
+ //return m_sTooltip;
+ return ::rtl::OUString::createFromAscii("");
+}
+void SAL_CALL VCLXTabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)_tooltip;
+}
+::cppu::IPropertyArrayHelper& VCLXTabPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > VCLXTabPageModel::getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
new file mode 100644
index 000000000000..dd6e28807bc6
--- /dev/null
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -0,0 +1,1738 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/ImageScaleMode.hpp>
+#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/vclxtabpagecontainer.hxx>
+#include <toolkit/awt/vclxtabpagemodel.hxx>
+
+#include <toolkit/awt/xsimpleanimation.hxx>
+#include <toolkit/awt/xthrobber.hxx>
+#include <toolkit/awt/animatedimagespeer.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 <vcl/throbber.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 },
+ { "animatedimages", 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 },
+ { "tabpagecontainer", WINDOW_CONTROL },
+ { "tabpagemodel", WINDOW_TABPAGE }
+};
+
+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 sal_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 )
+ || ( nType == WINDOW_MESSBOX )
+ || ( nType == WINDOW_INFOBOX )
+ || ( nType == WINDOW_WARNINGBOX )
+ || ( nType == WINDOW_ERRORBOX )
+ || ( nType == WINDOW_QUERYBOX )
+ )
+ 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 )
+ {
+ 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( sal_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( sal_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( sal_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=sal_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( sal_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 );
+ *ppNewComp = new VCLXTabPageContainer;
+ break;
+ case WINDOW_TABDIALOG:
+ pNewWindow = new TabDialog( pParent, nWinBits );
+ break;
+ case WINDOW_TABPAGE:
+ /*
+ if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("tabpagemodel") ) )
+ {
+ pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
+ }
+ else
+ */
+ {
+ 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( sal_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 ( aServiceName.EqualsAscii( "simpleanimation" ) )
+ {
+ pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE );
+ ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic );
+ // (compatibility)
+ *ppNewComp = new ::toolkit::XSimpleAnimation;
+ }
+ else if ( aServiceName.EqualsAscii( "throbber" ) )
+ {
+ pNewWindow = new Throbber( pParent, nWinBits, Throbber::IMAGES_NONE );
+ ((Throbber*)pNewWindow)->SetScaleMode( css::awt::ImageScaleMode::Anisotropic );
+ // (compatibility)
+ *ppNewComp = new ::toolkit::XThrobber;
+ }
+ else if ( rDescriptor.WindowServiceName.equalsIgnoreAsciiCase(
+ ::rtl::OUString::createFromAscii("tabpagecontainer") ) )
+ {
+ pNewWindow = new TabControl( pParent, nWinBits );
+ *ppNewComp = new VCLXTabPageContainer;
+ }
+ else if ( aServiceName.EqualsAscii( "animatedimages" ) )
+ {
+ pNewWindow = new Throbber( pParent, nWinBits );
+ *ppNewComp = new ::toolkit::AnimatedImagesPeer;
+ }
+ break;
+ default:
+ OSL_ENSURE( false, "VCLXToolkit::ImplCreateWindow: unknown window type!" );
+ break;
+ }
+ }
+
+ 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", sal_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( sal_True );
+ xRef = pNewComp;
+ pNewWindow->SetComponentInterface( xRef );
+ }
+ DBG_ASSERT( pNewWindow->GetComponentInterface( sal_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..669b49e29313
--- /dev/null
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -0,0 +1,2631 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/lang/DisposedException.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 <comphelper/flagguard.hxx>
+#include <toolkit/helper/solarrelease.hxx>
+#include "stylesettings.hxx"
+#include <tools/urlobj.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::RuntimeException;
+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::awt::XStyleSettings;
+using ::com::sun::star::lang::DisposedException;
+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;
+
+using ::toolkit::ReleaseSolarMutex;
+
+//====================================================================
+//= VCLXWindowImpl
+//====================================================================
+class SAL_DLLPRIVATE VCLXWindowImpl
+{
+private:
+ typedef ::std::vector< VCLXWindow::Callback > CallbackArray;
+
+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;
+
+ CallbackArray maCallbackEvents;
+ sal_uLong mnCallbackEventId;
+
+public:
+ bool mbDisposing : 1;
+ bool mbDesignMode : 1;
+ bool mbSynthesizingVCLEvent : 1;
+ bool mbWithDefaultProps : 1;
+
+ sal_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;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XStyleSettings >
+ mxWindowStyleSettings;
+
+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; }
+
+ /** impl-version of VCLXWindow::ImplExecuteAsyncWithoutSolarLock
+ */
+ void callBackAsync( const VCLXWindow::Callback& i_callback );
+
+ /** notifies the object that its VCLXWindow is being disposed
+ */
+ void disposing();
+
+ inline ::toolkit::AccessibilityClient& getAccessibleFactory()
+ {
+ return maAccFactory;
+ }
+
+ Reference< XStyleSettings > getStyleSettings();
+
+ /** 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();
+
+private:
+ DECL_LINK( OnProcessCallbacks, void* );
+
+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 )
+ ,mnCallbackEventId( 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 ( mnCallbackEventId )
+ Application::RemoveUserEvent( mnCallbackEventId );
+ mnCallbackEventId = 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 );
+
+ ::toolkit::WindowStyleSettings* pStyleSettings = static_cast< ::toolkit::WindowStyleSettings* >( mxWindowStyleSettings.get() );
+ if ( pStyleSettings != NULL )
+ pStyleSettings->dispose();
+ mxWindowStyleSettings.clear();
+}
+
+//--------------------------------------------------------------------
+void VCLXWindowImpl::callBackAsync( const VCLXWindow::Callback& i_callback )
+{
+ DBG_TESTSOLARMUTEX();
+ maCallbackEvents.push_back( i_callback );
+ if ( !mnCallbackEventId )
+ {
+ // ensure our VCLXWindow is not destroyed while the event is underway
+ mrAntiImpl.acquire();
+ mnCallbackEventId = Application::PostUserEvent( LINK( this, VCLXWindowImpl, OnProcessCallbacks ) );
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+IMPL_LINK( VCLXWindowImpl, OnProcessCallbacks, void*, EMPTYARG )
+{
+ const Reference< uno::XInterface > xKeepAlive( mrAntiImpl );
+
+ // work on a copy of the callback array
+ CallbackArray aCallbacksCopy;
+ {
+ ::vos::OGuard aGuard( mrMutex );
+ aCallbacksCopy = maCallbackEvents;
+ maCallbackEvents.clear();
+
+ // we acquired our VCLXWindow once before posting the event, release this one ref now
+ mrAntiImpl.release();
+
+ if ( !mnCallbackEventId )
+ // we were disposed while waiting for the mutex to lock
+ return 1L;
+
+ mnCallbackEventId = 0;
+ }
+
+ {
+ ReleaseSolarMutex aReleaseSolar( ReleaseSolarMutex::RescheduleDuringAcquire );
+ for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin();
+ loop != aCallbacksCopy.end();
+ ++loop
+ )
+ {
+ (*loop)();
+ }
+ }
+
+ return 0L;
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXWindowImpl::acquire()
+{
+ mrAntiImpl.acquire();
+}
+
+//--------------------------------------------------------------------
+void SAL_CALL VCLXWindowImpl::release()
+{
+ mrAntiImpl.release();
+}
+
+//--------------------------------------------------------------------
+Reference< XStyleSettings > VCLXWindowImpl::getStyleSettings()
+{
+ ::vos::OGuard aGuard( mrMutex );
+ if ( mbDisposed )
+ throw DisposedException( ::rtl::OUString(), mrAntiImpl );
+ if ( !mxWindowStyleSettings.is() )
+ mxWindowStyleSettings = new ::toolkit::WindowStyleSettings( mrMutex, maListenerContainerMutex, mrAntiImpl );
+ return mxWindowStyleSettings;
+}
+
+//====================================================================
+//====================================================================
+
+// 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 );
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void VCLXWindow::ImplExecuteAsyncWithoutSolarLock( const Callback& i_callback )
+{
+ mpImpl->callBackAsync( i_callback );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+::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;
+}
+
+namespace
+{
+ struct CallWindow2Listener
+ {
+ CallWindow2Listener( ::cppu::OInterfaceContainerHelper& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent )
+ :m_rWindow2Listeners( i_rWindow2Listeners )
+ ,m_bEnabled( i_bEnabled )
+ ,m_aEvent( i_rEvent )
+ {
+ }
+
+ void operator()()
+ {
+ m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent );
+ }
+
+ ::cppu::OInterfaceContainerHelper& m_rWindow2Listeners;
+ const bool m_bEnabled;
+ const EventObject m_aEvent;
+ };
+}
+
+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:
+ {
+ Callback aCallback = CallWindow2Listener(
+ mpImpl->getWindow2Listeners(),
+ ( VCLEVENT_WINDOW_ENABLED == rVclWindowEvent.GetId() ),
+ EventObject( *this )
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
+ 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;
+
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mousePressed,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
+ }
+ 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 ) );
+
+ Callback aCallback = ::boost::bind(
+ pMouseEvt->IsEnterWindow() ? &MouseListenerMultiplexer::mouseEntered : &MouseListenerMultiplexer::mouseExited,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
+
+ 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 ) );
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mousePressed,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_MOUSEBUTTONUP:
+ {
+ if ( mpImpl->getMouseListeners().getLength() )
+ {
+ awt::MouseEvent aEvent( VCLUnoHelper::createMouseEvent( *(MouseEvent*)rVclWindowEvent.GetData(), *this ) );
+ Callback aCallback = ::boost::bind(
+ &MouseListenerMultiplexer::mouseReleased,
+ &mpImpl->getMouseListeners(),
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
+ }
+ 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() )
+ {
+ sal_Bool *p_bFloating = (sal_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;
+}
+
+sal_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, sal_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( sal_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, sal_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 )
+ {
+ sal_Bool bEnableRTL = sal_False;
+ switch ( _nWritingMode )
+ {
+ case WritingMode2::LR_TB: bEnableRTL = sal_False; break;
+ case WritingMode2::RL_TB: bEnableRTL = sal_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 = sal_False; break;
+ case WritingMode2::RL_TB: bEnableRTL = sal_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();
+
+ sal_uInt16 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, sal_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 )
+ {
+ INetURLObject aHelpURL( aURL );
+ if ( aHelpURL.GetProtocol() == INET_PROT_HID )
+ pWindow->SetHelpId( rtl::OUStringToOString( aHelpURL.GetURLPath(), RTL_TEXTENCODING_UTF8 ) );
+ else
+ pWindow->SetHelpId( rtl::OUStringToOString( aURL, RTL_TEXTENCODING_UTF8 ) );
+ }
+ }
+ 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( sal_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( sal_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( sal_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, sal_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:
+ {
+ sal_uInt16 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:
+ {
+ rtl::OUString aHelpId( rtl::OStringToOUString( GetWindow()->GetHelpId(), RTL_TEXTENCODING_UTF8 ) );
+ aProp <<= ::rtl::OUString( aHelpId );
+ }
+ 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() )
+ {
+ ::comphelper::FlagGuard aDrawingflagGuard( mpImpl->getDrawingOntoParent_ref() );
+
+ sal_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( sal_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
+ {
+ sal_Bool bOldNW =pWindow->IsNativeWidgetEnabled();
+ if( bOldNW )
+ pWindow->EnableNativeWidget(sal_False);
+ pWindow->PaintToDevice( pDev, aP, aSz );
+ if( bOldNW )
+ pWindow->EnableNativeWidget(sal_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 sal_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 sal_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 sal_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 sal_False;
+}
+
+sal_Bool SAL_CALL VCLXWindow::isActive( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if( GetWindow() )
+ return GetWindow()->IsActive();
+ else
+ return sal_False;
+
+}
+
+sal_Bool SAL_CALL VCLXWindow::isEnabled( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if( GetWindow() )
+ return GetWindow()->IsEnabled();
+ else
+ return sal_False;
+}
+
+sal_Bool SAL_CALL VCLXWindow::hasFocus( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+ if( GetWindow() )
+ return GetWindow()->HasFocus();
+ else
+ return sal_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 );
+}
+
+Reference< XStyleSettings > SAL_CALL VCLXWindow::getStyleSettings() throw (RuntimeException)
+{
+ return mpImpl->getStyleSettings();
+}
diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx
new file mode 100644
index 000000000000..3572607772dc
--- /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( 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..2b3bc2b2c01b
--- /dev/null
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -0,0 +1,6248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/XGraphicProvider.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 <toolkit/helper/tkresmgr.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/resource/XStringResourceResolver.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/awt/XItemList.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#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 <vcl/tabctrl.hxx>
+#include <tools/diagnose_ex.h>
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::makeAny;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::lang::EventObject;
+using ::com::sun::star::awt::ItemListEvent;
+using ::com::sun::star::awt::XItemList;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
+
+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( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 2 / 3 ) );
+ aStyleSettings.SetLightBorderColor( aLightShadow );
+
+ Color aLight( nBackgroundColor );
+ aLight.IncreaseLuminance( (sal_uInt8)( ( nWhiteLuminance - nBackgroundLuminance ) * 1 / 3 ) );
+ aStyleSettings.SetLightColor( aLight );
+
+ Color aShadow( nBackgroundColor );
+ aShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 1 / 3 ) );
+ aStyleSettings.SetShadowColor( aShadow );
+
+ Color aDarkShadow( nBackgroundColor );
+ aDarkShadow.DecreaseLuminance( (sal_uInt8)( nBackgroundLuminance * 2 / 3 ) );
+ aStyleSettings.SetDarkShadowColor( aDarkShadow );
+ }
+
+ aSettings.SetStyleSettings( aStyleSettings );
+ _pWindow->SetSettings( aSettings, sal_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 )
+ {
+ AllSettings aSettings = _pWindow->GetSettings();
+ StyleSettings aStyleSettings = aSettings.GetStyleSettings();
+
+ sal_Int16 nStyle = LOOK3D;
+ OSL_VERIFY( _rValue >>= nStyle );
+ switch ( nStyle )
+ {
+ case FLAT:
+ aStyleSettings.SetOptions( aStyleSettings.GetOptions() & ~STYLE_OPTION_MONO );
+ break;
+ case LOOK3D:
+ default:
+ aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_MONO );
+ }
+ aSettings.SetStyleSettings( aStyleSettings );
+ _pWindow->SetSettings( aSettings );
+ }
+
+ static Any getVisualEffect( Window* _pWindow )
+ {
+ Any aEffect;
+
+ StyleSettings aStyleSettings = _pWindow->GetSettings().GetStyleSettings();
+ if ( (aStyleSettings.GetOptions() & STYLE_OPTION_MONO) )
+ aEffect <<= (sal_Int16)FLAT;
+ else
+ aEffect <<= (sal_Int16)LOOK3D;
+ return aEffect;
+ }
+}
+
+// ----------------------------------------------------
+// class VCLXGraphicControl
+// ----------------------------------------------------
+
+void VCLXGraphicControl::ImplGetPropertyIds( std::list< sal_uInt16 > &rIds )
+{
+ VCLXWindow::ImplGetPropertyIds( rIds );
+}
+
+void VCLXGraphicControl::ImplSetNewImage()
+{
+ OSL_PRECOND( GetWindow(), "VCLXGraphicControl::ImplSetNewImage: window is required to be not-NULL!" );
+ Button* pButton = static_cast< Button* >( GetWindow() );
+ pButton->SetModeImage( GetImage() );
+}
+
+void VCLXGraphicControl::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 ) )
+ ImplSetNewImage();
+ }
+}
+
+void VCLXGraphicControl::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 VCLXGraphicControl::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);
+ VCLXGraphicControl::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 );
+ VCLXGraphicControl::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:
+ {
+ VCLXGraphicControl::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 <<= VCLXGraphicControl::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;
+
+ Callback aCallback = ::boost::bind(
+ &ActionListenerMultiplexer::actionPerformed,
+ &maActionListeners,
+ aEvent
+ );
+ ImplExecuteAsyncWithoutSolarLock( aCallback );
+ }
+ }
+ 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:
+ VCLXGraphicControl::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);
+ VCLXGraphicControl::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->SetImage( GetImage() );
+}
+
+::com::sun::star::awt::Size VCLXImageControl::getMinimumSize( ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aSz = GetImage().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:
+ VCLXGraphicControl::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 = VCLXGraphicControl::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);
+ VCLXGraphicControl::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 : VCLXGraphicControl::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 ),
+ VCLXGraphicControl::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 );
+ VCLXGraphicControl::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 );
+ 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:
+ {
+ VCLXGraphicControl::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 );
+ break;
+ case BASEPROPERTY_TRISTATE:
+ aProp <<= (sal_Bool)pCheckBox->IsTriStateEnabled();
+ break;
+ case BASEPROPERTY_STATE:
+ aProp <<= (sal_Int16)pCheckBox->GetState();
+ break;
+ default:
+ {
+ aProp <<= VCLXGraphicControl::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:
+ VCLXGraphicControl::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);
+ VCLXGraphicControl::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 : VCLXGraphicControl::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 ),
+ VCLXGraphicControl::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 );
+ VCLXGraphicControl::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 );
+ break;
+
+ case BASEPROPERTY_STATE:
+ {
+ sal_Int16 n = sal_Int16();
+ if ( Value >>= n )
+ {
+ sal_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:
+ {
+ VCLXGraphicControl::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 );
+ break;
+ case BASEPROPERTY_STATE:
+ aProp <<= (sal_Int16) ( pButton->IsChecked() ? 1 : 0 );
+ break;
+ case BASEPROPERTY_AUTOTOGGLE:
+ aProp <<= (sal_Bool) pButton->IsRadioCheckEnabled();
+ break;
+ default:
+ {
+ aProp <<= VCLXGraphicControl::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( sal_False );
+ break;
+
+ case VCLEVENT_RADIOBUTTON_TOGGLE:
+ ImplClickedOrToggled( sal_True );
+ break;
+
+ default:
+ VCLXGraphicControl::ProcessWindowEvent( rVclWindowEvent );
+ break;
+ }
+}
+
+void VCLXRadioButton::ImplClickedOrToggled( sal_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_MULTISELECTION_SIMPLEMODE,
+ BASEPROPERTY_ITEM_SEPARATOR_POS,
+ 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 )
+{
+}
+
+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 )
+ {
+ sal_Bool bChanged = sal_False;
+ for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; )
+ {
+ sal_uInt16 nPos = (sal_uInt16) aPositions.getConstArray()[--n];
+ if ( pBox->IsEntryPosSelected( nPos ) != bSelect )
+ {
+ pBox->SelectEntryPos( nPos, bSelect );
+ bChanged = sal_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_ITEM_SEPARATOR_POS:
+ {
+ sal_Int16 nSeparatorPos(0);
+ if ( Value >>= nSeparatorPos )
+ pListBox->SetSeparatorPos( nSeparatorPos );
+ }
+ break;
+ 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_MULTISELECTION_SIMPLEMODE:
+ ::toolkit::adjustBooleanWindowStyle( Value, pListBox, WB_SIMPLEMODE, sal_False );
+ 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_ITEM_SEPARATOR_POS:
+ aProp <<= sal_Int16( pListBox->GetSeparatorPos() );
+ break;
+ case BASEPROPERTY_READONLY:
+ {
+ aProp <<= (sal_Bool) pListBox->IsReadOnly();
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION:
+ {
+ aProp <<= (sal_Bool) pListBox->IsMultiSelectionEnabled();
+ }
+ break;
+ case BASEPROPERTY_MULTISELECTION_SIMPLEMODE:
+ {
+ aProp <<= (sal_Bool)( ( pListBox->GetStyle() & WB_SIMPLEMODE ) == 0 );
+ }
+ 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 );
+ }
+}
+namespace
+{
+ Image lcl_getImageFromURL( const ::rtl::OUString& i_rImageURL )
+ {
+ if ( !i_rImageURL.getLength() )
+ return Image();
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ return Image( xGraphic );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+ }
+}
+void SAL_CALL VCLXListBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemInserted: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemInserted: illegal (inconsistent) item position!" );
+ pListBox->InsertEntry(
+ i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
+ i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
+ i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemRemoved: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemRemoved: illegal (inconsistent) item position!" );
+
+ pListBox->RemoveEntry( i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pListBox->GetEntryCount() ) ),
+ "VCLXListBox::listItemModified: illegal (inconsistent) item position!" );
+
+ // VCL's ListBox does not support changing an entry's text or image, so remove and re-insert
+
+ const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pListBox->GetEntry( i_rEvent.ItemPosition ) );
+ const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? TkResMgr::getImageFromURL( i_rEvent.ItemImageURL.Value ) : pListBox->GetEntryImage( i_rEvent.ItemPosition ) );
+
+ pListBox->RemoveEntry( i_rEvent.ItemPosition );
+ pListBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXListBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+
+ pListBox->Clear();
+
+ (void)i_rEvent;
+}
+
+void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ListBox* pListBox = dynamic_cast< ListBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pListBox, "VCLXListBox::listItemModified: no ListBox?!" );
+
+ pListBox->Clear();
+
+ uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+ uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
+ if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) )
+ {
+ xStringResourceResolver.set(
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
+ uno::UNO_QUERY
+ );
+ }
+
+
+ Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
+ for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
+ {
+ ::rtl::OUString aLocalizationKey( aItems[i].First );
+ if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' )
+ {
+ aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
+ }
+ pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
+ }
+}
+
+void SAL_CALL VCLXListBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ // just disambiguate
+ VCLXWindow::disposing( i_rEvent );
+}
+
+// ----------------------------------------------------
+// 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::XDialog2*, this ),
+ 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::XDialog2>* ) NULL ),
+ getCppuType( ( ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDialog>* ) NULL ),
+ VCLXTopWindow::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void SAL_CALL VCLXDialog::endDialog( ::sal_Int32 i_result ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Dialog* pDialog = dynamic_cast< Dialog* >( GetWindow() );
+ if ( pDialog )
+ pDialog->EndDialog( i_result );
+}
+
+void SAL_CALL VCLXDialog::setHelpId( const ::rtl::OUString& rId ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Window* pWindow = GetWindow();
+ if ( pWindow )
+ pWindow->SetHelpId( rtl::OUStringToOString( rId, RTL_TEXTENCODING_UTF8 ) );
+}
+
+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;
+ Window* pSetParent = NULL;
+ if ( pParent && !pParent->IsReallyVisible() )
+ {
+ pOldParent = pDlg->GetParent();
+ Window* pFrame = pDlg->GetWindow( WINDOW_FRAME );
+ if( pFrame != pDlg )
+ {
+ pDlg->SetParent( pFrame );
+ pSetParent = pFrame;
+ }
+ }
+
+ nRet = pDlg->Execute();
+
+ // set the parent back only in case no new parent was set from outside
+ // in other words, revert only own changes
+ if ( pOldParent && pDlg->GetParent() == pSetParent )
+ pDlg->SetParent( pOldParent );
+ }
+ return nRet;
+}
+
+void VCLXDialog::endExecute() throw(::com::sun::star::uno::RuntimeException)
+{
+ 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;
+ case BASEPROPERTY_TITLE:
+ {
+ ::rtl::OUString sTitle;
+ if ( Value >>= sTitle )
+ {
+ pTabPage->SetText(sTitle);
+ }
+ }
+ 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& rMaxSize ) throw(::com::sun::star::uno::RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Size aAdjustedSize( VCLUnoHelper::ConvertToVCLSize( rMaxSize ) );
+ FixedText* pFixedText = (FixedText*)GetWindow();
+ if ( pFixedText )
+ aAdjustedSize = pFixedText->CalcMinimumSize( rMaxSize.Width );
+ return VCLUnoHelper::ConvertToAWTSize( aAdjustedSize );
+}
+
+// ----------------------------------------------------
+// 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() );
+ sal_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::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 ( nP == 0xFFFF )
+ {
+ OSL_ENSURE( false, "VCLXComboBox::addItems: too many entries!" );
+ // skip remaining entries, list cannot hold them, anyway
+ break;
+ }
+ }
+ }
+}
+
+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 )
+ {
+ pComboBox->Clear();
+ addItems( aItems, 0 );
+ }
+ }
+ 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;
+ }
+}
+void SAL_CALL VCLXComboBox::listItemInserted( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemInserted: no ComboBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition <= sal_Int32( pComboBox->GetEntryCount() ) ),
+ "VCLXComboBox::listItemInserted: illegal (inconsistent) item position!" );
+ pComboBox->InsertEntry(
+ i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString(),
+ i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : Image(),
+ i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXComboBox::listItemRemoved( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemRemoved: no ComboBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
+ "VCLXComboBox::listItemRemoved: illegal (inconsistent) item position!" );
+
+ pComboBox->RemoveEntry( i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXComboBox::listItemModified( const ItemListEvent& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
+ ENSURE_OR_RETURN_VOID( ( i_rEvent.ItemPosition >= 0 ) && ( i_rEvent.ItemPosition < sal_Int32( pComboBox->GetEntryCount() ) ),
+ "VCLXComboBox::listItemModified: illegal (inconsistent) item position!" );
+
+ // VCL's ComboBox does not support changing an entry's text or image, so remove and re-insert
+
+ const ::rtl::OUString sNewText = i_rEvent.ItemText.IsPresent ? i_rEvent.ItemText.Value : ::rtl::OUString( pComboBox->GetEntry( i_rEvent.ItemPosition ) );
+ const Image aNewImage( i_rEvent.ItemImageURL.IsPresent ? lcl_getImageFromURL( i_rEvent.ItemImageURL.Value ) : pComboBox->GetEntryImage( i_rEvent.ItemPosition ) );
+
+ pComboBox->RemoveEntry( i_rEvent.ItemPosition );
+ pComboBox->InsertEntry( sNewText, aNewImage, i_rEvent.ItemPosition );
+}
+
+void SAL_CALL VCLXComboBox::allItemsRemoved( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
+
+ pComboBox->Clear();
+
+ (void)i_rEvent;
+}
+
+void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ ::vos::OGuard aGuard( GetMutex() );
+
+ ComboBox* pComboBox = dynamic_cast< ComboBox* >( GetWindow() );
+ ENSURE_OR_RETURN_VOID( pComboBox, "VCLXComboBox::listItemModified: no ComboBox?!" );
+
+ pComboBox->Clear();
+
+ uno::Reference< beans::XPropertySet > xPropSet( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySetInfo > xPSI( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+ // bool localize = xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) );
+ uno::Reference< resource::XStringResourceResolver > xStringResourceResolver;
+ if ( xPSI->hasPropertyByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ) )
+ {
+ xStringResourceResolver.set(
+ xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ) ) ),
+ uno::UNO_QUERY
+ );
+ }
+
+
+ Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
+ uno::Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > aItems = xItemList->getAllItems();
+ for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
+ {
+ ::rtl::OUString aLocalizationKey( aItems[i].First );
+ if ( xStringResourceResolver.is() && aLocalizationKey.getLength() != 0 && aLocalizationKey[0] == '&' )
+ {
+ aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
+ }
+ pComboBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
+ }
+}
+void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent ) throw (RuntimeException)
+{
+ // just disambiguate
+ VCLXEdit::disposing( i_rEvent );
+}
+
+// ----------------------------------------------------
+// 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..75701cb94b46
--- /dev/null
+++ b/toolkit/source/awt/xsimpleanimation.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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 <tools/debug.hxx>
+#include <vcl/throbber.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= XSimpleAnimation
+ //====================================================================
+ DBG_NAME( XSimpleAnimation )
+
+ //--------------------------------------------------------------------
+ XSimpleAnimation::XSimpleAnimation()
+ {
+ DBG_CTOR( XSimpleAnimation, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ XSimpleAnimation::~XSimpleAnimation()
+ {
+ DBG_DTOR( XSimpleAnimation, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::start() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->start();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::stop() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->stop();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::setImageList( const uno::Sequence< uno::Reference< graphic::XGraphic > >& rImageList )
+ throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->setImageList( rImageList );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XSimpleAnimation::setProperty( const ::rtl::OUString& PropertyName, const uno::Any& Value )
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
+ {
+ VCLXWindow::setProperty( PropertyName, Value );
+ return;
+ }
+
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME: {
+ sal_Int32 nStepTime( 0 );
+ if ( Value >>= nStepTime )
+ pThrobber->setStepTime( nStepTime );
+
+ break;
+ }
+ case BASEPROPERTY_REPEAT: {
+ sal_Bool bRepeat( sal_True );
+ if ( Value >>= bRepeat )
+ pThrobber->setRepeat( bRepeat );
+ break;
+ }
+ default:
+ VCLXWindow::setProperty( PropertyName, Value );
+ }
+ }
+
+ //--------------------------------------------------------------------
+ uno::Any SAL_CALL XSimpleAnimation::getProperty( const ::rtl::OUString& PropertyName )
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL )
+ return VCLXWindow::getProperty( PropertyName );
+
+ uno::Any aReturn;
+ sal_uInt16 nPropertyId = GetPropertyId( PropertyName );
+ switch ( nPropertyId )
+ {
+ case BASEPROPERTY_STEP_TIME:
+ aReturn <<= pThrobber->getStepTime();
+ break;
+ case BASEPROPERTY_REPEAT:
+ aReturn <<= pThrobber->getRepeat();
+ 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..3b9b361202e9
--- /dev/null
+++ b/toolkit/source/awt/xthrobber.cxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+
+#ifndef _TOOLKIT_AWT_XTHROBBER_HRC_
+#include "xthrobber.hrc"
+#endif
+#include <tools/debug.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/timer.hxx>
+#include <vcl/throbber.hxx>
+
+//........................................................................
+namespace toolkit
+{
+//........................................................................
+
+ using namespace ::com::sun::star;
+
+ //====================================================================
+ //= XThrobber
+ //====================================================================
+ DBG_NAME( XThrobber )
+
+ //--------------------------------------------------------------------
+ XThrobber::XThrobber()
+ {
+ DBG_CTOR( XThrobber, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ XThrobber::~XThrobber()
+ {
+ DBG_DTOR( XThrobber, NULL );
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XThrobber::start() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->start();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XThrobber::stop() throw ( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber != NULL)
+ pThrobber->stop();
+ }
+
+ //--------------------------------------------------------------------
+ void XThrobber::SetWindow( Window* pWindow )
+ {
+ XThrobber_Base::SetWindow( pWindow );
+ InitImageList();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL XThrobber::InitImageList()
+ throw( uno::RuntimeException )
+ {
+ ::vos::OGuard aGuard( GetMutex() );
+
+ Throbber* pThrobber( dynamic_cast< Throbber* >( GetWindow() ) );
+ if ( pThrobber == NULL)
+ return;
+
+ uno::Sequence< uno::Reference< graphic::XGraphic > > aImageList(12);
+ sal_uInt16 nIconIdStart = RID_TK_ICON_THROBBER_START;
+
+ if ( pThrobber->GetSettings().GetStyleSettings().GetHighContrastMode() )
+ 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();
+ }
+
+ pThrobber->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/animatedimages.cxx b/toolkit/source/controls/animatedimages.cxx
new file mode 100755
index 000000000000..c2fd91f1ea46
--- /dev/null
+++ b/toolkit/source/controls/animatedimages.cxx
@@ -0,0 +1,493 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/controls/animatedimages.hxx"
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/property.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/awt/VisualEffect.hpp>
+#include <com/sun/star/awt/ImageScaleMode.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::container::XContainerListener;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::XControlModel;
+ using ::com::sun::star::awt::XAnimatedImages;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::awt::XWindowPeer;
+ using ::com::sun::star::util::XModifyListener;
+ using ::com::sun::star::awt::XToolkit;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ /** === end UNO using === **/
+ namespace VisualEffect = ::com::sun::star::awt::VisualEffect;
+ namespace ImageScaleMode = ::com::sun::star::awt::ImageScaleMode;
+
+ //==================================================================================================================
+ //= AnimatedImagesControl
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControl::AnimatedImagesControl( Reference< XMultiServiceFactory > const & i_factory )
+ :AnimatedImagesControl_Base( i_factory )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString AnimatedImagesControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AnimatedImages" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::startAnimation( ) throw (RuntimeException)
+ {
+ Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->startAnimation();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::stopAnimation( ) throw (RuntimeException)
+ {
+ Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
+ if ( xAnimation.is() )
+ xAnimation->stopAnimation();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL AnimatedImagesControl::isAnimationRunning( ) throw (RuntimeException)
+ {
+ Reference< XAnimation > xAnimation( getPeer(), UNO_QUERY );
+ if ( xAnimation.is() )
+ return xAnimation->isAnimationRunning();
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AnimatedImagesControl::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.AnimatedImagesControl" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControl::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServices( AnimatedImagesControl_Base::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControl );
+ return aServices;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ void lcl_updatePeer( Reference< XWindowPeer > const& i_peer, Reference< XControlModel > const& i_model )
+ {
+ const Reference< XModifyListener > xPeerModify( i_peer, UNO_QUERY );
+ if ( xPeerModify.is() )
+ {
+ EventObject aEvent;
+ aEvent.Source = i_model;
+ xPeerModify->modified( aEvent );
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL AnimatedImagesControl::setModel( const Reference< XControlModel >& i_rModel ) throw ( RuntimeException )
+ {
+ const Reference< XAnimatedImages > xOldContainer( getModel(), UNO_QUERY );
+ const Reference< XAnimatedImages > xNewContainer( i_rModel, UNO_QUERY );
+
+ if ( !AnimatedImagesControl_Base::setModel( i_rModel ) )
+ return sal_False;
+
+ if ( xOldContainer.is() )
+ xOldContainer->removeContainerListener( this );
+
+ if ( xNewContainer.is() )
+ xNewContainer->addContainerListener( this );
+
+ lcl_updatePeer( getPeer(), getModel() );
+
+ return sal_True;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::createPeer( const Reference< XToolkit >& i_toolkit, const Reference< XWindowPeer >& i_parentPeer ) throw(RuntimeException)
+ {
+ AnimatedImagesControl_Base::createPeer( i_toolkit, i_parentPeer );
+
+ lcl_updatePeer( getPeer(), getModel() );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
+ if ( xPeerListener.is() )
+ xPeerListener->elementInserted( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
+ if ( xPeerListener.is() )
+ xPeerListener->elementRemoved( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ const Reference< XContainerListener > xPeerListener( getPeer(), UNO_QUERY );
+ if ( xPeerListener.is() )
+ xPeerListener->elementReplaced( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControl::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ UnoControlBase::disposing( i_event );
+ }
+
+ //==================================================================================================================
+ //= AnimatedImagesControlModel_Data
+ //==================================================================================================================
+ struct AnimatedImagesControlModel_Data
+ {
+ ::std::vector< Sequence< ::rtl::OUString > > aImageSets;
+ };
+
+ namespace
+ {
+ void lcl_checkIndex( const AnimatedImagesControlModel_Data& i_data, const sal_Int32 i_index, const Reference< XInterface >& i_context,
+ const bool i_forInsert = false )
+ {
+ if ( ( i_index < 0 ) || ( size_t( i_index ) > i_data.aImageSets.size() + ( i_forInsert ? 1 : 0 ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), i_context );
+ }
+
+ void lcl_notify( ::osl::ClearableMutexGuard& i_guard, ::cppu::OBroadcastHelper& i_broadcaseHelper,
+ void ( SAL_CALL XContainerListener::*i_notificationMethod )( const ContainerEvent& ),
+ const sal_Int32 i_accessor, const Sequence< ::rtl::OUString >& i_imageURLs, const Reference< XInterface >& i_context )
+ {
+ ::cppu::OInterfaceContainerHelper* pContainerListeners = i_broadcaseHelper.getContainer( XContainerListener::static_type() );
+ if ( pContainerListeners == NULL )
+ return;
+
+ ContainerEvent aEvent;
+ aEvent.Source = i_context;
+ aEvent.Accessor <<= i_accessor;
+ aEvent.Element <<= i_imageURLs;
+
+ i_guard.clear();
+ pContainerListeners->notifyEach( i_notificationMethod, aEvent );
+ }
+ }
+
+ //==================================================================================================================
+ //= AnimatedImagesControlModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControlModel::AnimatedImagesControlModel( Reference< XMultiServiceFactory > const & i_factory )
+ :AnimatedImagesControlModel_Base( i_factory )
+ ,m_pData( new AnimatedImagesControlModel_Data )
+ {
+ ImplRegisterProperty( BASEPROPERTY_AUTO_REPEAT );
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGE_SCALE_MODE );
+ ImplRegisterProperty( BASEPROPERTY_STEP_TIME );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControlModel::AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource )
+ :AnimatedImagesControlModel_Base( i_copySource )
+ ,m_pData( new AnimatedImagesControlModel_Data( *i_copySource.m_pData ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ AnimatedImagesControlModel::~AnimatedImagesControlModel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UnoControlModel* AnimatedImagesControlModel::Clone() const
+ {
+ return new AnimatedImagesControlModel( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XPropertySetInfo > SAL_CALL AnimatedImagesControlModel::getPropertySetInfo( ) throw(RuntimeException)
+ {
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AnimatedImagesControlModel::getServiceName() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL AnimatedImagesControlModel::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( "org.openoffice.comp.toolkit.AnimatedImagesControlModel" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControlModel::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(2);
+ aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ aServiceNames[1] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 i_handle, const Any& i_value ) throw (Exception)
+ {
+ switch ( i_handle )
+ {
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ {
+ sal_Int16 nImageScaleMode( ImageScaleMode::Anisotropic );
+ OSL_VERIFY( i_value >>= nImageScaleMode ); // convertFastPropertyValue ensures that this has the proper type
+ if ( ( nImageScaleMode != ImageScaleMode::None )
+ && ( nImageScaleMode != ImageScaleMode::Isotropic )
+ && ( nImageScaleMode != ImageScaleMode::Anisotropic )
+ )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ }
+ break;
+ }
+
+ AnimatedImagesControlModel_Base::setFastPropertyValue_NoBroadcast( i_handle, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any AnimatedImagesControlModel::ImplGetDefaultValue( sal_uInt16 i_propertyId ) const
+ {
+ switch ( i_propertyId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return makeAny( ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControl ) );
+
+ case BASEPROPERTY_BORDER:
+ return makeAny( VisualEffect::NONE );
+
+ case BASEPROPERTY_STEP_TIME:
+ return makeAny( (sal_Int32) 100 );
+
+ case BASEPROPERTY_AUTO_REPEAT:
+ return makeAny( (sal_Bool)sal_True );
+
+ case BASEPROPERTY_IMAGE_SCALE_MODE:
+ return makeAny( ImageScaleMode::None );
+
+ default:
+ return UnoControlModel::ImplGetDefaultValue( i_propertyId );
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::cppu::IPropertyArrayHelper& SAL_CALL AnimatedImagesControlModel::getInfoHelper()
+ {
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence< sal_Int32 > aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getStepTime() throw (RuntimeException)
+ {
+ sal_Int32 nStepTime( 100 );
+ OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ) ) >>= nStepTime );
+ return nStepTime;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setStepTime( ::sal_Int32 i_stepTime ) throw (RuntimeException)
+ {
+ setPropertyValue( GetPropertyName( BASEPROPERTY_STEP_TIME ), makeAny( i_stepTime ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL AnimatedImagesControlModel::getAutoRepeat() throw (RuntimeException)
+ {
+ sal_Bool bAutoRepeat( sal_True );
+ OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ) ) >>= bAutoRepeat );
+ return bAutoRepeat;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setAutoRepeat( ::sal_Bool i_autoRepeat ) throw (RuntimeException)
+ {
+ setPropertyValue( GetPropertyName( BASEPROPERTY_AUTO_REPEAT ), makeAny( i_autoRepeat ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int16 SAL_CALL AnimatedImagesControlModel::getScaleMode() throw (RuntimeException)
+ {
+ sal_Int16 nImageScaleMode( ImageScaleMode::Anisotropic );
+ OSL_VERIFY( getPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ) ) >>= nImageScaleMode );
+ return nImageScaleMode;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::setScaleMode( ::sal_Int16 i_scaleMode ) throw (IllegalArgumentException, RuntimeException)
+ {
+ setPropertyValue( GetPropertyName( BASEPROPERTY_IMAGE_SCALE_MODE ), makeAny( i_scaleMode ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL AnimatedImagesControlModel::getImageSetCount( ) throw (RuntimeException)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ return m_pData->aImageSets.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL AnimatedImagesControlModel::getImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this );
+
+ return m_pData->aImageSets[ i_index ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::insertImageSet( ::sal_Int32 i_index, const Sequence< ::rtl::OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // sanity checks
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this, true );
+
+ // actaul insertion
+ m_pData->aImageSets.insert( m_pData->aImageSets.begin() + i_index, i_imageURLs );
+
+ // listener notification
+ lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementInserted, i_index, i_imageURLs, *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::replaceImageSet( ::sal_Int32 i_index, const Sequence< ::rtl::OUString >& i_imageURLs ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // sanity checks
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this );
+
+ // actaul insertion
+ m_pData->aImageSets[ i_index ] = i_imageURLs;
+
+ // listener notification
+ lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementReplaced, i_index, i_imageURLs, *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::removeImageSet( ::sal_Int32 i_index ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // sanity checks
+ if ( GetBroadcastHelper().bDisposed || GetBroadcastHelper().bInDispose )
+ throw DisposedException();
+
+ lcl_checkIndex( *m_pData, i_index, *this );
+
+ // actual removal
+ ::std::vector< Sequence< ::rtl::OUString > >::iterator removalPos = m_pData->aImageSets.begin() + i_index;
+ Sequence< ::rtl::OUString > aRemovedElement( *removalPos );
+ m_pData->aImageSets.erase( removalPos );
+
+ // listener notification
+ lcl_notify( aGuard, BrdcstHelper, &XContainerListener::elementRemoved, i_index, aRemovedElement, *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::addContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ BrdcstHelper.addListener( XContainerListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL AnimatedImagesControlModel::removeContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ BrdcstHelper.removeListener( XContainerListener::static_type(), i_listener );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
new file mode 100644
index 000000000000..f037f10bbe31
--- /dev/null
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -0,0 +1,1860 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/controlmodelcontainerbase.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
+#include <vcl/wall.hxx>
+#include <vos/mutex.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 <toolkit/helper/tkresmgr.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.hxx>
+
+#include "tree/treecontrol.hxx"
+#include "grid/gridcontrol.hxx"
+#include <toolkit/controls/tabpagecontainer.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" ))
+
+//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;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// 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< ControlModelContainerBase::UnoControlModelHolder, bool >
+{
+private:
+ const ::rtl::OUString& m_rName;
+
+public:
+ FindControlModel( const ::rtl::OUString& _rName ) : m_rName( _rName ) { }
+
+ bool operator()( const ControlModelContainerBase::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< ControlModelContainerBase::UnoControlModelHolder, void >
+{
+private:
+ ControlModelContainerBase::UnoControlModelHolderList& m_rTargetList;
+
+public:
+ CloneControlModel( ControlModelContainerBase::UnoControlModelHolderList& _rTargetList )
+ :m_rTargetList( _rTargetList )
+ {
+ }
+
+ void operator()( const ControlModelContainerBase::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( ControlModelContainerBase::UnoControlModelHolder( xClone, _rSource.second ) );
+ }
+};
+
+// ----------------------------------------------------------------------------
+// functor for comparing a XControlModel with a given reference
+struct CompareControlModel : public ::std::unary_function< ControlModelContainerBase::UnoControlModelHolder, bool >
+{
+private:
+ Reference< XControlModel > m_xReference;
+public:
+ CompareControlModel( const Reference< XControlModel >& _rxReference ) : m_xReference( _rxReference ) { }
+
+ bool operator()( const ControlModelContainerBase::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 ControlModelContainerBase
+// ----------------------------------------------------
+ControlModelContainerBase::ControlModelContainerBase( const Reference< XMultiServiceFactory >& i_factory )
+ :ControlModelContainer_IBase( i_factory )
+ ,maContainerListeners( *this )
+ ,maChangeListeners ( GetMutex() )
+ ,mbGroupsUpToDate( sal_False )
+{
+}
+
+ControlModelContainerBase::ControlModelContainerBase( const ControlModelContainerBase& rModel )
+ : ControlModelContainer_IBase( rModel )
+ , maContainerListeners( *this )
+ , maChangeListeners ( GetMutex() )
+ , mbGroupsUpToDate( sal_False )
+{
+}
+
+ControlModelContainerBase::~ControlModelContainerBase()
+{
+ maModels.clear();
+ mbGroupsUpToDate = sal_False;
+}
+
+Any ControlModelContainerBase::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& ControlModelContainerBase::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+void SAL_CALL ControlModelContainerBase::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 > ControlModelContainerBase::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+void ControlModelContainerBase::Clone_Impl(ControlModelContainerBase& _rClone) const
+{
+ // clone all children
+ ::std::for_each(
+ maModels.begin(), maModels.end(),
+ CloneControlModel( _rClone.maModels )
+ );
+}
+UnoControlModel* ControlModelContainerBase::Clone() const
+{
+ // clone the container itself
+ ControlModelContainerBase* pClone = new ControlModelContainerBase( *this );
+ Clone_Impl(*pClone);
+
+ return pClone;
+}
+
+ControlModelContainerBase::UnoControlModelHolderList::iterator ControlModelContainerBase::ImplFindElement( const ::rtl::OUString& rName )
+{
+ return ::std::find_if( maModels.begin(), maModels.end(), FindControlModel( rName ) );
+}
+
+// ::XMultiServiceFactory
+Reference< XInterface > ControlModelContainerBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw(Exception, RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ OGeometryControlModel_Base* pNewModel = NULL;
+
+ const Reference< XMultiServiceFactory > xFactory( maContext.getLegacyServiceFactory() );
+ if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlEditModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlEditModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFormattedFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFormattedFieldModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFileControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFileControlModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlButtonModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlImageControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlImageControlModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRadioButtonModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRadioButtonModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCheckBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCheckBoxModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedHyperlinkModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedHyperlinkModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlFixedTextModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedTextModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlGroupBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlGroupBoxModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlListBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlListBoxModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlComboBoxModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlComboBoxModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlDateFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlDateFieldModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlTimeFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTimeFieldModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlNumericFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlNumericFieldModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlCurrencyFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlCurrencyFieldModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlPatternFieldModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlPatternFieldModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlProgressBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlProgressBarModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlScrollBarModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlScrollBarModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlFixedLineModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlFixedLineModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName2_UnoControlRoadmapModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlRoadmapModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_TreeControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoTreeModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_GridControlModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoGridModel >( xFactory );
+ else if ( aServiceSpecifier.compareToAscii( szServiceName_UnoControlTabPageContainerModel ) == 0 )
+ pNewModel = new OGeometryControlModel< UnoControlTabPageContainerModel >( xFactory );
+
+ if ( !pNewModel )
+ {
+ if ( xFactory.is() )
+ {
+ Reference< XInterface > xObject = xFactory->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 > ControlModelContainerBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& /* Arguments */ ) throw(Exception, RuntimeException)
+{
+ return createInstance( ServiceSpecifier );
+}
+
+Sequence< ::rtl::OUString > ControlModelContainerBase::getAvailableServiceNames() throw(RuntimeException)
+{
+ static Sequence< ::rtl::OUString >* pNamesSeq = NULL;
+ if ( !pNamesSeq )
+ {
+ pNamesSeq = new Sequence< ::rtl::OUString >( 23 );
+ ::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[21] = ::rtl::OUString::createFromAscii( szServiceName_GridControlModel );
+ pNames[22] = ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainerModel );
+
+ }
+ return *pNamesSeq;
+}
+
+// XContainer
+void ControlModelContainerBase::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void ControlModelContainerBase::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// XElementAcces
+Type ControlModelContainerBase::getElementType() throw(RuntimeException)
+{
+ Type aType = getCppuType( ( Reference< XControlModel>* ) NULL );
+ return aType;
+}
+
+sal_Bool ControlModelContainerBase::hasElements() throw(RuntimeException)
+{
+ return !maModels.empty();
+}
+
+// XNameContainer, XNameReplace, XNameAccess
+void ControlModelContainerBase::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 ControlModelContainerBase::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 > ControlModelContainerBase::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 ControlModelContainerBase::hasByName( const ::rtl::OUString& aName ) throw(RuntimeException)
+{
+ return maModels.end() != ImplFindElement( aName );
+}
+
+void ControlModelContainerBase::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 ) && ImplHasProperty(BASEPROPERTY_DIALOGSOURCEURL) )
+ {
+ 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 ControlModelContainerBase::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 ControlModelContainerBase::getGroupControl( ) throw (RuntimeException)
+{
+ return sal_True;
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::setGroupControl( sal_Bool ) throw (RuntimeException)
+{
+ DBG_ERROR( "UnoControlDialogModel::setGroupControl: explicit grouping not supported" );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::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 ControlModelContainerBase::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 ControlModelContainerBase::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" );
+}
+
+////----- XInitialization -------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::initialize (const Sequence<Any>& rArguments) throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nPageId = -1;
+ if ( rArguments.getLength() == 1 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ }
+ else
+ m_nTabPageId = -1;
+}
+::sal_Int16 SAL_CALL ControlModelContainerBase::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_nTabPageId;
+}
+::sal_Bool SAL_CALL ControlModelContainerBase::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_bEnabled;
+}
+void SAL_CALL ControlModelContainerBase::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_bEnabled = _enabled;
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getTitle() throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ ::rtl::OUString sTitle;
+ xThis->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)) >>= sTitle;
+ return sTitle;
+ //return m_sTitle;
+}
+void SAL_CALL ControlModelContainerBase::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),makeAny(_title));
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_sImageURL;
+}
+void SAL_CALL ControlModelContainerBase::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_sImageURL = _imageurl;
+}
+::rtl::OUString SAL_CALL ControlModelContainerBase::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+{
+ return m_sTooltip;
+}
+void SAL_CALL ControlModelContainerBase::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_sTooltip = _tooltip;
+}
+
+// ----------------------------------------------------------------------------
+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 ControlModelContainerBase::getGroupCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ implUpdateGroupStructure();
+
+ return maGroups.size();
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::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 ControlModelContainerBase::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 ControlModelContainerBase::addChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.addInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void SAL_CALL ControlModelContainerBase::removeChangesListener( const Reference< XChangesListener >& _rxListener ) throw (RuntimeException)
+{
+ maChangeListeners.removeInterface( _rxListener );
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::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 ControlModelContainerBase::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 ControlModelContainerBase::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 ControlModelContainerBase::disposing( const EventObject& /*rEvent*/ ) throw (RuntimeException)
+{
+}
+
+// ----------------------------------------------------------------------------
+void ControlModelContainerBase::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 ControlModelContainerBase::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 DialogContainerControl
+// ----------------------------------------------------
+ControlContainerBase::ControlContainerBase( const Reference< XMultiServiceFactory >& i_factory )
+ :ContainerControl_IBase( i_factory )
+ ,mbSizeModified(false)
+ ,mbPosModified(false)
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+ mxListener = new ResourceListener( Reference< util::XModifyListener >(
+ static_cast< OWeakObject* >( this ), UNO_QUERY ));
+}
+
+ControlContainerBase::~ControlContainerBase()
+{
+}
+
+void ControlContainerBase::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+}
+
+void ControlContainerBase::ImplInsertControl( Reference< XControlModel >& rxModel, const ::rtl::OUString& rName )
+{
+ Reference< XPropertySet > xP( rxModel, UNO_QUERY );
+
+ ::rtl::OUString aDefCtrl;
+ xP->getPropertyValue( GetPropertyName( BASEPROPERTY_DEFAULTCONTROL ) ) >>= aDefCtrl;
+ Reference < XControl > xCtrl;
+ maContext.createComponent( aDefCtrl, xCtrl );
+
+ 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 ControlContainerBase::ImplRemoveControl( Reference< XControlModel >& rxModel )
+{
+ Sequence< Reference< XControl > > aControls = getControls();
+ Reference< XControl > xCtrl = StdTabController::FindControl( aControls, rxModel );
+ if ( xCtrl.is() )
+ {
+ removeControl( xCtrl );
+ try
+ {
+ Reference< XComponent > const xControlComp( xCtrl, UNO_QUERY_THROW );
+ xControlComp->dispose();
+ }
+ catch( Exception const & )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+void ControlContainerBase::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;
+ MapMode aMode( MAP_APPFONT );
+ OutputDevice*pOutDev = Application::GetDefaultDevice();
+ if ( pOutDev )
+ {
+ ::Size aTmp( nX, nY );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
+ nX = aTmp.Width();
+ nY = aTmp.Height();
+ aTmp = ::Size( nWidth, nHeight );
+ aTmp = pOutDev->LogicToPixel( aTmp, aMode );
+ 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 ControlContainerBase::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ // 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 ControlContainerBase::disposing(
+ const EventObject& Source )
+throw(RuntimeException)
+{
+ UnoControlContainer::disposing( Source );
+}
+
+sal_Bool ControlContainerBase::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 ControlContainerBase::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 ControlContainerBase::elementInserted( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ ::rtl::OUString aName;
+
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementInserted: illegal element!" );
+ try
+ {
+ ImplInsertControl( xModel, aName );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+void ControlContainerBase::elementRemoved( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.Element >>= xModel;
+ ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementRemoved: illegal element!" );
+ try
+ {
+ ImplRemoveControl( xModel );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+void ControlContainerBase::elementReplaced( const ContainerEvent& Event ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ Reference< XControlModel > xModel;
+ Event.ReplacedElement >>= xModel;
+ try
+ {
+ OSL_ENSURE( xModel.is(), "UnoDialogControl::elementReplaced: invalid ReplacedElement!" );
+ if ( xModel.is() )
+ ImplRemoveControl( xModel );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ ::rtl::OUString aName;
+ Event.Accessor >>= aName;
+ Event.Element >>= xModel;
+ ENSURE_OR_RETURN_VOID( xModel.is(), "UnoDialogControl::elementReplaced: invalid new element!" );
+ try
+ {
+ ImplInsertControl( xModel, aName );
+ }
+ catch ( const RuntimeException& e ) { throw; }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+}
+
+// XPropertiesChangeListener
+void ControlContainerBase::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;
+ }
+ }
+ }
+
+ UnoControlContainer::ImplModelPropertiesChanged( rEvents );
+}
+
+void ControlContainerBase::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 ControlContainerBase::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 ControlContainerBase::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();
+}
+void lcl_ApplyResolverToNestedContainees( const Reference< resource::XStringResourceResolver >& xStringResourceResolver, const Reference< XControlContainer >& xContainer )
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+
+ Any xNewStringResourceResolver; xNewStringResourceResolver <<= xStringResourceResolver;
+
+ Sequence< rtl::OUString > aPropNames(1);
+ aPropNames[0] = aPropName;
+
+ const Sequence< Reference< awt::XControl > > aSeq = xContainer->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& )
+ {
+ }
+
+ uno::Reference< XControlContainer > xNestedContainer( xControl, uno::UNO_QUERY );
+ if ( xNestedContainer.is() )
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, xNestedContainer );
+
+ }
+
+}
+void ControlContainerBase::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 ControlContainerBase::ImplUpdateResourceResolver()
+{
+ rtl::OUString aPropName( PROPERTY_RESOURCERESOLVER );
+ Reference< resource::XStringResourceResolver > xStringResourceResolver;
+
+ ImplGetPropertyValue( aPropName ) >>= xStringResourceResolver;
+ if ( !xStringResourceResolver.is() )
+ return;
+
+ lcl_ApplyResolverToNestedContainees( xStringResourceResolver, this );
+
+ // 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 );
+ }
+}
+
+
+uno::Reference< graphic::XGraphic > ControlContainerBase::Impl_getGraphicFromURL_nothrow( const ::rtl::OUString& _rURL )
+{
+ uno::Reference< graphic::XGraphic > xGraphic;
+ if ( !_rURL.getLength() )
+ return xGraphic;
+
+ try
+ {
+ uno::Reference< graphic::XGraphicProvider > xProvider;
+ if ( maContext.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;
+}
+//// ----------------------------------------------------
+//// 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 baseLocation;
+ ::rtl::OUString url;
+
+ rbase >>= baseLocation;
+ rUrl >>= url;
+
+ ::rtl::OUString absoluteURL( url );
+ if ( url.getLength() > 0 )
+ {
+ INetURLObject urlObj(baseLocation);
+ urlObj.removeSegment();
+ baseLocation = urlObj.GetMainURL( INetURLObject::NO_DECODE );
+
+ const INetURLObject protocolCheck( url );
+ const INetProtocol protocol = protocolCheck.GetProtocol();
+ if ( protocol == INET_PROT_NOT_VALID )
+ {
+ ::rtl::OUString testAbsoluteURL;
+ if ( ::osl::FileBase::E_None == ::osl::FileBase::getAbsoluteFileURL( baseLocation, url, testAbsoluteURL ) )
+ absoluteURL = testAbsoluteURL;
+ }
+ }
+
+ return absoluteURL;
+}
+
diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx
new file mode 100644
index 000000000000..8f400ff1945c
--- /dev/null
+++ b/toolkit/source/controls/dialogcontrol.cxx
@@ -0,0 +1,503 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_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/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/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.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;
+
+#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 );
+
+// ----------------------------------------------------
+// class UnoControlDialogModel
+// ----------------------------------------------------
+UnoControlDialogModel::UnoControlDialogModel( const Reference< XMultiServiceFactory >& i_factory )
+ :ControlModelContainerBase( i_factory )
+{
+ 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 )
+ : ControlModelContainerBase( rModel )
+{
+}
+
+UnoControlDialogModel::~UnoControlDialogModel()
+{
+}
+
+UnoControlModel* UnoControlDialogModel::Clone() const
+{
+ // clone the container itself
+ UnoControlDialogModel* pClone = new UnoControlDialogModel( *this );
+
+ Clone_Impl(*pClone);
+
+ return pClone;
+}
+
+
+::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;
+}
+
+// XMultiPropertySet
+Reference< XPropertySetInfo > UnoControlDialogModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+// ============================================================================
+// = class UnoDialogControl
+// ============================================================================
+
+UnoDialogControl::UnoDialogControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :ControlContainerBase( i_factory )
+ ,maTopWindowListeners( *this )
+ ,mbWindowListener(false)
+{
+ maComponentInfos.nWidth = 300;
+ maComponentInfos.nHeight = 450;
+ }
+
+UnoDialogControl::~UnoDialogControl()
+{
+}
+
+::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)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XTopWindow*, this ) );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XDialog*, this ) );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::queryInterface( rType, SAL_STATIC_CAST( awt::XWindowListener*, this ) );
+ return (aRet.hasValue() ? aRet : ControlContainerBase::queryAggregation( rType ));
+}
+
+ //lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoDialogControl)
+ getCppuType( ( uno::Reference< awt::XTopWindow>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XDialog>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XWindowListener>* ) NULL ),
+ ControlContainerBase::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoDialogControl::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ maTopWindowListeners.disposeAndClear( aEvt );
+ ControlContainerBase::dispose();
+}
+
+void SAL_CALL UnoDialogControl::disposing(
+ const EventObject& Source )
+throw(RuntimeException)
+{
+ ControlContainerBase::disposing( Source );
+}
+
+sal_Bool UnoDialogControl::setModel( const Reference< XControlModel >& rxModel ) throw(RuntimeException)
+{
+ // #Can we move all the Resource stuff to the ControlContainerBase ?
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ sal_Bool bRet = ControlContainerBase::setModel( rxModel );
+ ImplStartListingForResourceEvents();
+ return bRet;
+}
+
+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 = ControlContainerBase::Impl_getGraphicFromURL_nothrow( absoluteUrl );
+ ImplSetPropertyValue( PROPERTY_GRAPHIC, uno::makeAny( xGraphic ), sal_True );
+ }
+}
+
+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;
+}
+
+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;
+ }
+ }
+}
+
+// XModifyListener
+void SAL_CALL UnoDialogControl::modified(
+ const lang::EventObject& /*rEvent*/ )
+throw (RuntimeException)
+{
+ ImplUpdateResourceResolver();
+}
+
+void UnoDialogControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent >& rEvents ) throw(RuntimeException)
+{
+ 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( GetPropertyName( BASEPROPERTY_IMAGEURL ) ) >>= aImageURL ) &&
+ ( aImageURL.getLength() > 0 ))
+ {
+ ::rtl::OUString absoluteUrl =
+ getPhysicalLocation( ImplGetPropertyValue( GetPropertyName( BASEPROPERTY_DIALOGSOURCEURL )),
+ uno::makeAny(aImageURL));
+
+ xGraphic = Impl_getGraphicFromURL_nothrow( absoluteUrl );
+ }
+ ImplSetPropertyValue( GetPropertyName( BASEPROPERTY_GRAPHIC), uno::makeAny( xGraphic ), sal_True );
+ break;
+ }
+ }
+ ControlContainerBase::ImplModelPropertiesChanged(rEvents);
+}
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..fb2d0f720c2e
--- /dev/null
+++ b/toolkit/source/controls/formattedcontrol.cxx
@@ -0,0 +1,470 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ ,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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
+ {
+ }
+
+ // -------------------------------------------------------------------
+ ::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, sal_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..0195ddff09a2
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -0,0 +1,392 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include "defaultgridcolumnmodel.hxx"
+#include "gridcolumn.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/sequence.hxx>
+#include <comphelper/componentguard.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+
+//......................................................................................................................
+namespace toolkit
+//......................................................................................................................
+{
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::awt::grid::XGridColumn;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::container::XContainerListener;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::util::XCloneable;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= DefaultGridColumnModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridColumnModel::DefaultGridColumnModel( const Reference< XMultiServiceFactory >& i_factory )
+ :DefaultGridColumnModel_Base( m_aMutex )
+ ,m_aContext( i_factory )
+ ,m_aContainerListeners( m_aMutex )
+ ,m_aColumns()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridColumnModel::DefaultGridColumnModel( DefaultGridColumnModel const & i_copySource )
+ :cppu::BaseMutex()
+ ,DefaultGridColumnModel_Base( m_aMutex )
+ ,m_aContext( i_copySource.m_aContext )
+ ,m_aContainerListeners( m_aMutex )
+ ,m_aColumns()
+ {
+ Columns aColumns;
+ aColumns.reserve( i_copySource.m_aColumns.size() );
+ try
+ {
+ for ( Columns::const_iterator col = i_copySource.m_aColumns.begin();
+ col != i_copySource.m_aColumns.end();
+ ++col
+ )
+ {
+ Reference< XCloneable > const xCloneable( *col, UNO_QUERY_THROW );
+ Reference< XGridColumn > const xClone( xCloneable->createClone(), UNO_QUERY_THROW );
+
+ GridColumn* const pGridColumn = GridColumn::getImplementation( xClone );
+ if ( pGridColumn == NULL )
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid clone source implementation" ) ), *this );
+ // that's indeed a RuntimeException, not an IllegalArgumentException or some such:
+ // a DefaultGridColumnModel implementation whose columns are not GridColumn implementations
+ // is borked.
+ pGridColumn->setIndex( col - i_copySource.m_aColumns.begin() );
+
+ aColumns.push_back( xClone );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ if ( aColumns.size() == i_copySource.m_aColumns.size() )
+ m_aColumns.swap( aColumns );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridColumnModel::~DefaultGridColumnModel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridColumnModel::getColumnCount() throw (RuntimeException)
+ {
+ return m_aColumns.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::createColumn( ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return new GridColumn();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridColumnModel::addColumn( const Reference< XGridColumn > & i_column ) throw (RuntimeException, IllegalArgumentException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ GridColumn* const pGridColumn = GridColumn::getImplementation( i_column );
+ if ( pGridColumn == NULL )
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "invalid column implementation" ) ), *this, 1 );
+
+ m_aColumns.push_back( i_column );
+ sal_Int32 index = m_aColumns.size() - 1;
+ pGridColumn->setIndex( index );
+
+ // fire insertion notifications
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= index;
+ aEvent.Element <<= i_column;
+
+ aGuard.clear();
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvent );
+
+ return index;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::removeColumn( ::sal_Int32 i_columnIndex ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ if ( ( i_columnIndex < 0 ) || ( size_t( i_columnIndex ) >= m_aColumns.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ Columns::iterator const pos = m_aColumns.begin() + i_columnIndex;
+ Reference< XGridColumn > const xColumn( *pos );
+ m_aColumns.erase( pos );
+
+ // update indexes of all subsequent columns
+ sal_Int32 columnIndex( i_columnIndex );
+ for ( Columns::iterator updatePos = m_aColumns.begin() + columnIndex;
+ updatePos != m_aColumns.end();
+ ++updatePos, ++columnIndex
+ )
+ {
+ GridColumn* pColumnImpl = GridColumn::getImplementation( *updatePos );
+ ENSURE_OR_CONTINUE( pColumnImpl, "DefaultGridColumnModel::removeColumn: invalid column implementation!" );
+ pColumnImpl->setIndex( columnIndex );
+ }
+
+ // fire removal notifications
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= i_columnIndex;
+ aEvent.Element <<= xColumn;
+
+ aGuard.clear();
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvent );
+
+ // dispose the removed column
+ try
+ {
+ Reference< XComponent > const xColComp( xColumn, UNO_QUERY_THROW );
+ xColComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< Reference< XGridColumn > > SAL_CALL DefaultGridColumnModel::getColumns() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return ::comphelper::containerToSequence( m_aColumns );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XGridColumn > SAL_CALL DefaultGridColumnModel::getColumn(::sal_Int32 index) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ if ( index >=0 && index < ((sal_Int32)m_aColumns.size()))
+ return m_aColumns[index];
+
+ throw IndexOutOfBoundsException();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::setDefaultColumns(sal_Int32 rowElements) throw (RuntimeException)
+ {
+ ::std::vector< ContainerEvent > aRemovedColumns;
+ ::std::vector< ContainerEvent > aInsertedColumns;
+
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ // remove existing columns
+ while ( !m_aColumns.empty() )
+ {
+ const size_t lastColIndex = m_aColumns.size() - 1;
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= sal_Int32( lastColIndex );
+ aEvent.Element <<= m_aColumns[ lastColIndex ];
+ aRemovedColumns.push_back( aEvent );
+
+ m_aColumns.erase( m_aColumns.begin() + lastColIndex );
+ }
+
+ // add new columns
+ for ( sal_Int32 i=0; i<rowElements; ++i )
+ {
+ ::rtl::Reference< GridColumn > const pGridColumn = new GridColumn();
+ Reference< XGridColumn > const xColumn( pGridColumn.get() );
+ ::rtl::OUStringBuffer colTitle;
+ colTitle.appendAscii( "Column " );
+ colTitle.append( i + 1 );
+ pGridColumn->setTitle( colTitle.makeStringAndClear() );
+ pGridColumn->setColumnWidth( 80 /* APPFONT */ );
+ pGridColumn->setFlexibility( 1 );
+ pGridColumn->setResizeable( sal_True );
+ pGridColumn->setDataColumnIndex( i );
+
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Accessor <<= i;
+ aEvent.Element <<= xColumn;
+ aInsertedColumns.push_back( aEvent );
+
+ m_aColumns.push_back( xColumn );
+ pGridColumn->setIndex( i );
+ }
+ }
+
+ // fire removal notifications
+ for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
+ event != aRemovedColumns.end();
+ ++event
+ )
+ {
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, *event );
+ }
+
+ // fire insertion notifications
+ for ( ::std::vector< ContainerEvent >::const_iterator event = aInsertedColumns.begin();
+ event != aInsertedColumns.end();
+ ++event
+ )
+ {
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, *event );
+ }
+
+ // dispose removed columns
+ for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
+ event != aRemovedColumns.end();
+ ++event
+ )
+ {
+ try
+ {
+ const Reference< XComponent > xColComp( event->Element, UNO_QUERY_THROW );
+ xColComp->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DefaultGridColumnModel::getImplementationName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.DefaultGridColumnModel" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
+ for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
+ if ( aServiceNames[i] == i_serviceName )
+ return sal_True;
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) );
+ const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::addContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ if ( i_listener.is() )
+ m_aContainerListeners.addInterface( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::removeContainerListener( const Reference< XContainerListener >& i_listener ) throw (RuntimeException)
+ {
+ if ( i_listener.is() )
+ m_aContainerListeners.removeInterface( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridColumnModel::disposing()
+ {
+ DefaultGridColumnModel_Base::disposing();
+
+ EventObject aEvent( *this );
+ m_aContainerListeners.disposeAndClear( aEvent );
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+
+ // remove, dispose and clear columns
+ while ( !m_aColumns.empty() )
+ {
+ try
+ {
+ const Reference< XComponent > xColComponent( m_aColumns[ 0 ], UNO_QUERY_THROW );
+ xColComponent->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+
+ m_aColumns.erase( m_aColumns.begin() );
+ }
+
+ Columns aEmpty;
+ m_aColumns.swap( aEmpty );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL DefaultGridColumnModel::createClone( ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return new DefaultGridColumnModel( *this );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+//----------------------------------------------------------------------------------------------------------------------
+::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 >& _rFactory)
+{
+ return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::DefaultGridColumnModel( _rFactory ) );
+}
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
new file mode 100644
index 000000000000..da0ef20e3287
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.hxx
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#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 <com/sun/star/style/VerticalAlignment.hpp>
+#include <com/sun/star/util/Color.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <vector>
+
+namespace comphelper
+{
+ class ComponentGuard;
+}
+
+namespace toolkit
+{
+
+//enum broadcast_type { column_added, column_removed, column_changed};
+
+typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::awt::grid::XGridColumnModel
+ , ::com::sun::star::lang::XServiceInfo
+ > DefaultGridColumnModel_Base;
+
+class DefaultGridColumnModel :public ::cppu::BaseMutex
+ ,public DefaultGridColumnModel_Base
+{
+public:
+ DefaultGridColumnModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ DefaultGridColumnModel( DefaultGridColumnModel const & i_copySource );
+ virtual ~DefaultGridColumnModel();
+
+ // XGridColumnModel
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > SAL_CALL createColumn( ) 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, ::com::sun::star::lang::IllegalArgumentException);
+ virtual void SAL_CALL removeColumn( ::sal_Int32 i_columnIndex ) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException);
+ 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::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultColumns(sal_Int32 rowElements) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+private:
+ typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumn > > Columns;
+
+ ::comphelper::ComponentContext m_aContext;
+ ::cppu::OInterfaceContainerHelper m_aContainerListeners;
+ Columns m_aColumns;
+};
+
+}
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
new file mode 100644
index 000000000000..4ef99d749ba1
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -0,0 +1,439 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/stlunosequence.hxx>
+#include <comphelper/componentguard.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <tools/diagnose_ex.h>
+#include <rtl/ref.hxx>
+
+#include <algorithm>
+
+//......................................................................................................................
+namespace toolkit
+//......................................................................................................................
+{
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::util::XCloneable;
+ /** === end UNO using === **/
+
+ using ::comphelper::stl_begin;
+ using ::comphelper::stl_end;
+
+ //==================================================================================================================
+ //= DefaultGridDataModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::DefaultGridDataModel()
+ :DefaultGridDataModel_Base( m_aMutex )
+ ,m_aRowHeaders()
+ ,m_nColumnCount(0)
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::DefaultGridDataModel( DefaultGridDataModel const & i_copySource )
+ :cppu::BaseMutex()
+ ,DefaultGridDataModel_Base( m_aMutex )
+ ,m_aData( i_copySource.m_aData )
+ ,m_aRowHeaders( i_copySource.m_aRowHeaders )
+ ,m_nColumnCount( i_copySource.m_nColumnCount )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::~DefaultGridDataModel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DefaultGridDataModel::broadcast( GridDataEvent const & i_event,
+ void ( SAL_CALL XGridDataListener::*i_listenerMethod )( GridDataEvent const & ), ::comphelper::ComponentGuard & i_instanceLock )
+ {
+ ::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( XGridDataListener::static_type() );
+ if ( !pListeners )
+ return;
+
+ i_instanceLock.clear();
+ pListeners->notifyEach( i_listenerMethod, i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridDataModel::getRowCount() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_aData.size();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL DefaultGridDataModel::getColumnCount() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nColumnCount;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::CellData const & DefaultGridDataModel::impl_getCellData_throw( sal_Int32 const i_column, sal_Int32 const i_row ) const
+ {
+ if ( ( i_row < 0 ) || ( size_t( i_row ) > m_aData.size() )
+ || ( i_column < 0 ) || ( i_column > m_nColumnCount )
+ )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< DefaultGridDataModel* >( this ) );
+
+ RowData const & rRow( m_aData[ i_row ] );
+ if ( size_t( i_column ) < rRow.size() )
+ return rRow[ i_column ];
+
+ static CellData s_aEmpty;
+ return s_aEmpty;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::RowData& DefaultGridDataModel::impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount )
+ {
+ OSL_ENSURE( i_requiredColumnCount <= size_t( m_nColumnCount ), "DefaultGridDataModel::impl_getRowDataAccess_throw: invalid column count!" );
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ RowData& rRowData( m_aData[ i_rowIndex ] );
+ if ( rRowData.size() < i_requiredColumnCount )
+ rRowData.resize( i_requiredColumnCount );
+ return rRowData;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ DefaultGridDataModel::CellData& DefaultGridDataModel::impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex )
+ {
+ if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= m_nColumnCount ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ RowData& rRowData( impl_getRowDataAccess_throw( i_rowIndex, size_t( i_columnIndex + 1 ) ) );
+ return rRowData[ i_columnIndex ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL DefaultGridDataModel::getCellData( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return impl_getCellData_throw( i_column, i_row ).first;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL DefaultGridDataModel::getCellToolTip( ::sal_Int32 i_column, ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return impl_getCellData_throw( i_column, i_row ).second;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL DefaultGridDataModel::getRowHeading( ::sal_Int32 i_row ) throw (RuntimeException, IndexOutOfBoundsException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ if ( ( i_row < 0 ) || ( size_t( i_row ) >= m_aRowHeaders.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ return m_aRowHeaders[ i_row ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ sal_Int32 const columnCount = i_data.getLength();
+
+ // store header name
+ m_aRowHeaders.push_back( i_heading );
+
+ // store row m_aData
+ impl_addRow( i_data );
+
+ // update column count
+ if ( columnCount > m_nColumnCount )
+ m_nColumnCount = columnCount;
+
+ sal_Int32 const rowIndex = sal_Int32( m_aData.size() - 1 );
+ broadcast(
+ GridDataEvent( *this, -1, -1, rowIndex, rowIndex ),
+ &XGridDataListener::rowsInserted,
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void DefaultGridDataModel::impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount )
+ {
+ OSL_PRECOND( ( i_assumedColCount <= 0 ) || ( i_assumedColCount >= i_rowData.getLength() ),
+ "DefaultGridDataModel::impl_addRow: invalid column count!" );
+
+ RowData newRow( i_assumedColCount > 0 ? i_assumedColCount : i_rowData.getLength() );
+ RowData::iterator cellData = newRow.begin();
+ for ( const Any* pData = stl_begin( i_rowData ); pData != stl_end( i_rowData ); ++pData, ++cellData )
+ cellData->first = *pData;
+
+ m_aData.push_back( newRow );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException)
+ {
+ if ( i_headings.getLength() != i_data.getLength() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, -1 );
+
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ sal_Int32 const rowCount = i_headings.getLength();
+ if ( rowCount == 0 )
+ return;
+
+ // determine max col count in the new data
+ sal_Int32 maxColCount = 0;
+ for ( sal_Int32 row=0; row<rowCount; ++row )
+ if ( i_data[row].getLength() > maxColCount )
+ maxColCount = i_data[row].getLength();
+
+ if ( maxColCount < m_nColumnCount )
+ maxColCount = m_nColumnCount;
+
+ for ( sal_Int32 row=0; row<rowCount; ++row )
+ {
+ m_aRowHeaders.push_back( i_headings[row] );
+ impl_addRow( i_data[row], maxColCount );
+ }
+
+ if ( maxColCount > m_nColumnCount )
+ m_nColumnCount = maxColCount;
+
+ sal_Int32 const firstRow = sal_Int32( m_aData.size() - rowCount );
+ sal_Int32 const lastRow = sal_Int32( m_aData.size() - 1 );
+ broadcast(
+ GridDataEvent( *this, -1, -1, firstRow, lastRow ),
+ &XGridDataListener::rowsInserted,
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ m_aRowHeaders.erase( m_aRowHeaders.begin() + i_rowIndex );
+ m_aData.erase( m_aData.begin() + i_rowIndex );
+
+ broadcast(
+ GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::rowsRemoved,
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::removeAllRows( ) throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ m_aRowHeaders.clear();
+ m_aData.clear();
+
+ broadcast(
+ GridDataEvent( *this, -1, -1, -1, -1 ),
+ &XGridDataListener::rowsRemoved,
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).first = i_value;
+
+ broadcast(
+ GridDataEvent( *this, i_columnIndex, i_columnIndex, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::dataChanged,
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aData.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ if ( i_columnIndexes.getLength() != i_values.getLength() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+
+ sal_Int32 const columnCount = i_columnIndexes.getLength();
+ if ( columnCount == 0 )
+ return;
+
+ for ( sal_Int32 col = 0; col < columnCount; ++col )
+ {
+ if ( ( i_columnIndexes[col] < 0 ) || ( i_columnIndexes[col] > m_nColumnCount ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+ }
+
+ RowData& rDataRow = m_aData[ i_rowIndex ];
+ for ( sal_Int32 col = 0; col < columnCount; ++col )
+ {
+ sal_Int32 const columnIndex = i_columnIndexes[ col ];
+ if ( size_t( columnIndex ) >= rDataRow.size() )
+ rDataRow.resize( columnIndex + 1 );
+
+ rDataRow[ columnIndex ].first = i_values[ col ];
+ }
+
+ sal_Int32 const firstAffectedColumn = *::std::min_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
+ sal_Int32 const lastAffectedColumn = *::std::max_element( stl_begin( i_columnIndexes ), stl_end( i_columnIndexes ) );
+ broadcast(
+ GridDataEvent( *this, firstAffectedColumn, lastAffectedColumn, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::dataChanged,
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ if ( ( i_rowIndex < 0 ) || ( size_t( i_rowIndex ) >= m_aRowHeaders.size() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ m_aRowHeaders[ i_rowIndex ] = i_heading;
+
+ broadcast(
+ GridDataEvent( *this, -1, -1, i_rowIndex, i_rowIndex ),
+ &XGridDataListener::rowHeadingChanged,
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ impl_getCellDataAccess_throw( i_columnIndex, i_rowIndex ).second = i_value;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+
+ RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount );
+ for ( RowData::iterator cell = rRowData.begin(); cell != rRowData.end(); ++cell )
+ cell->second = i_value;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::addGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.addListener( XGridDataListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::removeGridDataListener( const Reference< grid::XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.removeListener( XGridDataListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL DefaultGridDataModel::disposing()
+ {
+ ::com::sun::star::lang::EventObject aEvent;
+ aEvent.Source.set( *this );
+ rBHelper.aLC.disposeAndClear( aEvent );
+
+ ::osl::MutexGuard aGuard( m_aMutex );
+ GridData aEmptyData;
+ m_aData.swap( aEmptyData );
+
+ ::std::vector< Any > aEmptyRowHeaders;
+ m_aRowHeaders.swap( aEmptyRowHeaders );
+
+ m_nColumnCount = 0;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL DefaultGridDataModel::getImplementationName( ) throw (RuntimeException)
+ {
+ static const ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "toolkit.DefaultGridDataModel" ) );
+ return aImplName;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException)
+ {
+ return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ static const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_DefaultGridDataModel ) );
+ static const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL DefaultGridDataModel::createClone( ) throw (RuntimeException)
+ {
+ return new DefaultGridDataModel( *this );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+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..bf4b6cc3355e
--- /dev/null
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/awt/grid/XMutableGridDataModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+#include <vector>
+
+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 comphelper
+{
+ class ComponentGuard;
+}
+
+namespace toolkit
+{
+
+enum broadcast_type { row_added, row_removed, data_changed};
+
+typedef ::cppu::WeakComponentImplHelper2 < XMutableGridDataModel
+ , XServiceInfo
+ > DefaultGridDataModel_Base;
+
+class DefaultGridDataModel :public ::cppu::BaseMutex
+ ,public DefaultGridDataModel_Base
+{
+public:
+ DefaultGridDataModel();
+ DefaultGridDataModel( DefaultGridDataModel const & i_copySource );
+ virtual ~DefaultGridDataModel();
+
+ // XMutableGridDataModel
+ virtual void SAL_CALL addRow( const Any& i_heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowData( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& ColumnIndexes, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowHeading( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Heading ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellToolTip( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowToolTip( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XGridDataModel
+ virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::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:
+ typedef ::std::pair< Any, Any > CellData;
+ typedef ::std::vector< CellData > RowData;
+ typedef ::std::vector< RowData > GridData;
+
+ void broadcast(
+ GridDataEvent const & i_event,
+ void ( SAL_CALL ::com::sun::star::awt::grid::XGridDataListener::*i_listenerMethod )( ::com::sun::star::awt::grid::GridDataEvent const & ),
+ ::comphelper::ComponentGuard & i_instanceLock
+ );
+
+ void impl_addRow( Sequence< Any > const & i_rowData, sal_Int32 const i_assumedColCount = -1 );
+
+ CellData const & impl_getCellData_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex ) const;
+ CellData& impl_getCellDataAccess_throw( sal_Int32 const i_columnIndex, sal_Int32 const i_rowIndex );
+ RowData& impl_getRowDataAccess_throw( sal_Int32 const i_rowIndex, size_t const i_requiredColumnCount );
+
+ GridData m_aData;
+ ::std::vector< ::com::sun::star::uno::Any > m_aRowHeaders;
+ sal_Int32 m_nColumnCount;
+};
+
+}
diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx
new file mode 100644
index 000000000000..c1216d53f328
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcolumn.cxx
@@ -0,0 +1,329 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "gridcolumn.hxx"
+
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <toolkit/helper/servicenames.hxx>
+
+namespace toolkit
+{
+ 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;
+ using namespace ::com::sun::star::util;
+ using namespace ::com::sun::star::style;
+
+ //==================================================================================================================
+ //= DefaultGridColumnModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn::GridColumn()
+ :GridColumn_Base( m_aMutex )
+ ,m_aIdentifier()
+ ,m_nIndex(-1)
+ ,m_nDataColumnIndex(-1)
+ ,m_nColumnWidth(4)
+ ,m_nMaxWidth(0)
+ ,m_nMinWidth(0)
+ ,m_nFlexibility(1)
+ ,m_bResizeable(true)
+ ,m_eHorizontalAlign( HorizontalAlignment_LEFT )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn::GridColumn( GridColumn const & i_copySource )
+ :cppu::BaseMutex()
+ ,GridColumn_Base( m_aMutex )
+ ,m_aIdentifier( i_copySource.m_aIdentifier )
+ ,m_nIndex( -1 )
+ ,m_nDataColumnIndex( i_copySource.m_nDataColumnIndex )
+ ,m_nColumnWidth( i_copySource.m_nColumnWidth )
+ ,m_nMaxWidth( i_copySource.m_nMaxWidth )
+ ,m_nMinWidth( i_copySource.m_nMinWidth )
+ ,m_nFlexibility( i_copySource.m_nFlexibility )
+ ,m_bResizeable( i_copySource.m_bResizeable )
+ ,m_sTitle( i_copySource.m_sTitle )
+ ,m_sHelpText( i_copySource.m_sHelpText )
+ ,m_eHorizontalAlign( i_copySource.m_eHorizontalAlign )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn::~GridColumn()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void GridColumn::broadcast_changed( sal_Char const * const i_asciiAttributeName, Any i_oldValue, Any i_newValue,
+ ::comphelper::ComponentGuard& i_Guard )
+ {
+ Reference< XInterface > const xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ GridColumnEvent const aEvent(
+ xSource, ::rtl::OUString::createFromAscii( i_asciiAttributeName ),
+ i_oldValue, i_newValue, m_nIndex
+ );
+
+ ::cppu::OInterfaceContainerHelper* pIter = rBHelper.getContainer( XGridColumnListener::static_type() );
+
+ i_Guard.clear();
+ if( pIter )
+ pIter->notifyEach( &XGridColumnListener::columnChanged, aEvent );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::com::sun::star::uno::Any SAL_CALL GridColumn::getIdentifier() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_aIdentifier;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setIdentifier(const ::com::sun::star::uno::Any & value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ m_aIdentifier = value;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getColumnWidth() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nColumnWidth;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setColumnWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_nColumnWidth, value, "ColumnWidth" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getMaxWidth() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nMaxWidth;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setMaxWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_nMaxWidth, value, "MaxWidth" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getMinWidth() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nMinWidth;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setMinWidth(::sal_Int32 value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_nMinWidth, value, "MinWidth" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL GridColumn::getTitle() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_sTitle;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setTitle(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_sTitle, value, "Title" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL GridColumn::getHelpText() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_sHelpText;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setHelpText( const ::rtl::OUString & value ) throw (RuntimeException)
+ {
+ impl_set( m_sHelpText, value, "HelpText" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL GridColumn::getResizeable() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_bResizeable;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setResizeable(sal_Bool value) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_bResizeable, value, "Resizeable" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getFlexibility() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nFlexibility;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setFlexibility( ::sal_Int32 i_value ) throw (IllegalArgumentException, RuntimeException)
+ {
+ if ( i_value < 0 )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+ impl_set( m_nFlexibility, i_value, "Flexibility" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ HorizontalAlignment SAL_CALL GridColumn::getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_eHorizontalAlign;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setHorizontalAlign(HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException)
+ {
+ impl_set( m_eHorizontalAlign, align, "HorizontalAlign" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::addGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+ {
+ rBHelper.addListener( XGridColumnListener::static_type(), xListener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::removeGridColumnListener( const Reference< XGridColumnListener >& xListener ) throw (RuntimeException)
+ {
+ rBHelper.removeListener( XGridColumnListener::static_type(), xListener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::disposing()
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_aIdentifier.clear();
+ m_sTitle = m_sHelpText = ::rtl::OUString();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getIndex() throw (RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nIndex;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void GridColumn::setIndex( sal_Int32 const i_index )
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ m_nIndex = i_index;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL GridColumn::getDataColumnIndex() throw(RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ return m_nDataColumnIndex;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridColumn::setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(RuntimeException)
+ {
+ impl_set( m_nDataColumnIndex, i_dataColumnIndex, "DataColumnIndex" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL GridColumn::getImplementationName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.GridColumn" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Bool SAL_CALL GridColumn::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
+ {
+ const Sequence< ::rtl::OUString > aServiceNames( getSupportedServiceNames() );
+ for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
+ if ( aServiceNames[i] == i_serviceName )
+ return sal_True;
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ const ::rtl::OUString aServiceName( ::rtl::OUString::createFromAscii( szServiceName_GridColumn ) );
+ const Sequence< ::rtl::OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL GridColumn::createClone( ) throw (RuntimeException)
+ {
+ return new GridColumn( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ sal_Int64 SAL_CALL GridColumn::getSomething( const Sequence< sal_Int8 >& i_identifier ) throw(RuntimeException)
+ {
+ if ( ( i_identifier.getLength() == 16 ) && ( i_identifier == getUnoTunnelId() ) )
+ return ::sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >( this ) );
+ return 0;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< sal_Int8 > GridColumn::getUnoTunnelId() throw()
+ {
+ static ::cppu::OImplementationId const aId;
+ return aId.getImplementationId();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ GridColumn* GridColumn::getImplementation( const Reference< XInterface >& i_component )
+ {
+ Reference< XUnoTunnel > const xTunnel( i_component, UNO_QUERY );
+ if ( xTunnel.is() )
+ return reinterpret_cast< GridColumn* >( ::sal::static_int_cast< sal_IntPtr >( xTunnel->getSomething( getUnoTunnelId() ) ) );
+ return NULL;
+ }
+}
+
+::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 >& )
+{
+ return *( 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..b1be836a3862
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcolumn.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+
+#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 <com/sun/star/style/HorizontalAlignment.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <comphelper/componentguard.hxx>
+#include <rtl/ref.hxx>
+#include <toolkit/helper/mutexandbroadcasthelper.hxx>
+
+#include <vector>
+
+namespace toolkit
+{
+
+typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XGridColumn
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XUnoTunnel
+ > GridColumn_Base;
+class GridColumn :public ::cppu::BaseMutex
+ ,public GridColumn_Base
+{
+public:
+ GridColumn();
+ GridColumn( GridColumn const & i_copySource );
+ virtual ~GridColumn();
+
+ // ::com::sun::star::awt::grid::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 ::sal_Int32 SAL_CALL getMaxWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMaxWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMinWidth() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMinWidth(::sal_Int32 the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getResizeable() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setResizeable(::sal_Bool the_value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getFlexibility() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFlexibility( ::sal_Int32 _flexibility ) throw (::com::sun::star::lang::IllegalArgumentException, ::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);
+ virtual ::rtl::OUString SAL_CALL getHelpText() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHelpText(const ::rtl::OUString & value) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getIndex() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getDataColumnIndex() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDataColumnIndex( ::sal_Int32 i_dataColumnIndex ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::style::HorizontalAlignment SAL_CALL getHorizontalAlign() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setHorizontalAlign(::com::sun::star::style::HorizontalAlignment align) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridColumnListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridColumnListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XCloneable (base of XGridColumn)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XUnoTunnel and friends
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& i_identifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelId() throw();
+ static GridColumn* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_component );
+
+ // attribute access
+ void setIndex( sal_Int32 const i_index );
+
+private:
+ void broadcast_changed(
+ sal_Char const * const i_asciiAttributeName,
+ ::com::sun::star::uno::Any i_oldValue,
+ ::com::sun::star::uno::Any i_newValue,
+ ::comphelper::ComponentGuard& i_Guard
+ );
+
+ template< class TYPE >
+ void impl_set( TYPE & io_attribute, TYPE const & i_newValue, sal_Char const * i_attributeName )
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ if ( io_attribute == i_newValue )
+ return;
+
+ TYPE const aOldValue( io_attribute );
+ io_attribute = i_newValue;
+ broadcast_changed( i_attributeName, ::com::sun::star::uno::makeAny( aOldValue ), ::com::sun::star::uno::makeAny( io_attribute ), aGuard );
+ }
+
+ ::com::sun::star::uno::Any m_aIdentifier;
+ sal_Int32 m_nIndex;
+ sal_Int32 m_nDataColumnIndex;
+ sal_Int32 m_nColumnWidth;
+ sal_Int32 m_nMaxWidth;
+ sal_Int32 m_nMinWidth;
+ sal_Int32 m_nFlexibility;
+ sal_Bool m_bResizeable;
+ ::rtl::OUString m_sTitle;
+ ::rtl::OUString m_sHelpText;
+ ::com::sun::star::style::HorizontalAlignment m_eHorizontalAlign;
+};
+
+}
diff --git a/toolkit/source/controls/grid/gridcontrol.cxx b/toolkit/source/controls/grid/gridcontrol.cxx
new file mode 100644
index 000000000000..acda52753a60
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcontrol.cxx
@@ -0,0 +1,453 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_toolkit.hxx"
+
+#include "gridcontrol.hxx"
+#include "grideventforwarder.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/XMutableGridDataModel.hpp>
+#include <com/sun/star/awt/grid/DefaultGridDataModel.hpp>
+#include <com/sun/star/awt/grid/SortableGridDataModel.hpp>
+#include <com/sun/star/awt/grid/XGridColumnModel.hpp>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/color.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;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::view;
+
+namespace toolkit
+{
+//======================================================================================================================
+//= UnoGridModel
+//======================================================================================================================
+namespace
+{
+ Reference< XGridDataModel > lcl_getDefaultDataModel_throw( ::comphelper::ComponentContext const & i_context )
+ {
+ Reference< XMutableGridDataModel > const xDelegatorModel( DefaultGridDataModel::create( i_context.getUNOContext() ), UNO_QUERY_THROW );
+ Reference< XGridDataModel > const xDataModel( SortableGridDataModel::create( i_context.getUNOContext(), xDelegatorModel ), UNO_QUERY_THROW );
+ return xDataModel;
+ }
+
+ Reference< XGridColumnModel > lcl_getDefaultColumnModel_throw( ::comphelper::ComponentContext const & i_context )
+ {
+ Reference< XGridColumnModel > const xColumnModel( i_context.createComponent( "com.sun.star.awt.grid.DefaultGridColumnModel" ), UNO_QUERY_THROW );
+ return xColumnModel;
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+UnoGridModel::UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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_TABSTOP );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SHOWROWHEADER );
+ ImplRegisterProperty( BASEPROPERTY_ROW_HEADER_WIDTH );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SHOWCOLUMNHEADER );
+ ImplRegisterProperty( BASEPROPERTY_COLUMN_HEADER_HEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_ROW_HEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_GRID_DATAMODEL, makeAny( lcl_getDefaultDataModel_throw( maContext ) ) );
+ ImplRegisterProperty( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( lcl_getDefaultColumnModel_throw( maContext ) ) );
+ ImplRegisterProperty( BASEPROPERTY_GRID_SELECTIONMODE );
+ ImplRegisterProperty( BASEPROPERTY_FONTRELIEF );
+ ImplRegisterProperty( BASEPROPERTY_FONTEMPHASISMARK );
+ ImplRegisterProperty( BASEPROPERTY_FONTDESCRIPTOR );
+ ImplRegisterProperty( BASEPROPERTY_TEXTCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_TEXTLINECOLOR );
+ ImplRegisterProperty( BASEPROPERTY_USE_GRID_LINES );
+ ImplRegisterProperty( BASEPROPERTY_GRID_LINE_COLOR );
+ ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_BACKGROUND );
+ ImplRegisterProperty( BASEPROPERTY_GRID_HEADER_TEXT_COLOR );
+ ImplRegisterProperty( BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS );
+ ImplRegisterProperty( BASEPROPERTY_VERTICALALIGN );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+UnoGridModel::UnoGridModel( const UnoGridModel& rModel )
+ :UnoControlModel( rModel )
+{
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ Reference< XGridDataModel > xDataModel;
+ // clone the data model
+ const Reference< XFastPropertySet > xCloneSource( &const_cast< UnoGridModel& >( rModel ) );
+ try
+ {
+ const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ), UNO_QUERY_THROW );
+ xDataModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ if ( !xDataModel.is() )
+ xDataModel = lcl_getDefaultDataModel_throw( maContext );
+ UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_DATAMODEL, makeAny( xDataModel ) );
+ // do *not* use setFastPropertyValue here: The UnoControlModel ctor did a simple copy of all property values,
+ // so before this call here, we share our data model with the own of the clone source. setFastPropertyValue,
+ // then, disposes the old data model - which means the data model which in fact belongs to the clone source.
+ // so, call the UnoControlModel's impl-method for setting the value.
+
+ // clone the column model
+ Reference< XGridColumnModel > xColumnModel;
+ try
+ {
+ const Reference< XCloneable > xCloneable( xCloneSource->getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ), UNO_QUERY_THROW );
+ xColumnModel.set( xCloneable->createClone(), UNO_QUERY_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ if ( !xColumnModel.is() )
+ xColumnModel = lcl_getDefaultColumnModel_throw( maContext );
+ UnoControlModel::setFastPropertyValue_NoBroadcast( BASEPROPERTY_GRID_COLUMNMODEL, makeAny( xColumnModel ) );
+ // same comment as above: do not use our own setPropertyValue here.
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+UnoControlModel* UnoGridModel::Clone() const
+{
+ return new UnoGridModel( *this );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ void lcl_dispose_nothrow( const Any& i_component )
+ {
+ try
+ {
+ const Reference< XComponent > xComponent( i_component, UNO_QUERY_THROW );
+ xComponent->dispose();
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridModel::dispose( ) throw(RuntimeException)
+{
+ lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_COLUMNMODEL ) );
+ lcl_dispose_nothrow( getFastPropertyValue( BASEPROPERTY_GRID_DATAMODEL ) );
+
+ UnoControlModel::dispose();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception)
+{
+ Any aOldSubModel;
+ if ( ( nHandle == BASEPROPERTY_GRID_COLUMNMODEL ) || ( nHandle == BASEPROPERTY_GRID_DATAMODEL ) )
+ {
+ aOldSubModel = getFastPropertyValue( nHandle );
+ if ( aOldSubModel == rValue )
+ {
+ OSL_ENSURE( false, "UnoGridModel::setFastPropertyValue_NoBroadcast: setting the same value, again!" );
+ // shouldn't this have been caught by convertFastPropertyValue?
+ aOldSubModel.clear();
+ }
+ }
+
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ if ( aOldSubModel.hasValue() )
+ lcl_dispose_nothrow( aOldSubModel );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+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) );
+ case BASEPROPERTY_GRID_SHOWROWHEADER:
+ case BASEPROPERTY_USE_GRID_LINES:
+ return uno::makeAny( (sal_Bool)sal_False );
+ case BASEPROPERTY_ROW_HEADER_WIDTH:
+ return uno::makeAny( sal_Int32( 10 ) );
+ case BASEPROPERTY_GRID_SHOWCOLUMNHEADER:
+ return uno::makeAny( (sal_Bool)sal_True );
+ case BASEPROPERTY_COLUMN_HEADER_HEIGHT:
+ case BASEPROPERTY_ROW_HEIGHT:
+ case BASEPROPERTY_GRID_HEADER_BACKGROUND:
+ case BASEPROPERTY_GRID_HEADER_TEXT_COLOR:
+ case BASEPROPERTY_GRID_LINE_COLOR:
+ case BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS:
+ return Any();
+ 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;
+}
+
+
+//======================================================================================================================
+//= UnoGridControl
+//======================================================================================================================
+UnoGridControl::UnoGridControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoGridControl_Base( i_factory )
+ ,mSelectionMode(SelectionType(1))
+ ,m_aSelectionListeners( *this )
+ ,m_pEventForwarder( new GridEventForwarder( *this ) )
+{
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+UnoGridControl::~UnoGridControl()
+{
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+OUString UnoGridControl::GetComponentServiceName()
+{
+ return OUString::createFromAscii( "Grid" );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::dispose( ) throw(RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aSelectionListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ const Reference< XGridControl > xGrid( getPeer(), UNO_QUERY_THROW );
+ xGrid->addSelectionListener(&m_aSelectionListeners);
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ void lcl_setEventForwarding( const Reference< XControlModel >& i_gridControlModel, const ::boost::scoped_ptr< GridEventForwarder >& i_listener,
+ bool const i_add )
+ {
+ const Reference< XPropertySet > xModelProps( i_gridControlModel, UNO_QUERY );
+ if ( !xModelProps.is() )
+ return;
+
+ try
+ {
+ Reference< XContainer > const xColModel(
+ xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnModel" ) ) ),
+ UNO_QUERY_THROW );
+ if ( i_add )
+ xColModel->addContainerListener( i_listener.get() );
+ else
+ xColModel->removeContainerListener( i_listener.get() );
+
+ Reference< XGridDataModel > const xDataModel(
+ xModelProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GridDataModel" ) ) ),
+ UNO_QUERY_THROW
+ );
+ Reference< XMutableGridDataModel > const xMutableDataModel( xDataModel, UNO_QUERY );
+ if ( xMutableDataModel.is() )
+ {
+ if ( i_add )
+ xMutableDataModel->addGridDataListener( i_listener.get() );
+ else
+ xMutableDataModel->removeGridDataListener( i_listener.get() );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+sal_Bool SAL_CALL UnoGridControl::setModel( const Reference< XControlModel >& i_model ) throw(RuntimeException)
+{
+ lcl_setEventForwarding( getModel(), m_pEventForwarder, false );
+ if ( !UnoGridControl_Base::setModel( i_model ) )
+ return sal_False;
+ lcl_setEventForwarding( getModel(), m_pEventForwarder, true );
+ return sal_True;
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 UnoGridControl::getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getRowAtPoint( x, y );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 UnoGridControl::getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getColumnAtPoint( x, y );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL UnoGridControl::getCurrentColumn( ) throw (RuntimeException)
+{
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getCurrentColumn();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL UnoGridControl::getCurrentRow( ) throw (RuntimeException)
+{
+ Reference< XGridControl > const xGrid ( getPeer(), UNO_QUERY_THROW );
+ return xGrid->getCurrentRow();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectRow( i_rowIndex );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::selectAllRows() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->selectAllRows();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectRow( i_rowIndex );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoGridControl::deselectAllRows() throw (::com::sun::star::uno::RuntimeException)
+{
+ Reference< XGridControl >( getPeer(), UNO_QUERY_THROW )->deselectAllRows();
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+::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::addSelectionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridSelectionListener > & listener) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_aSelectionListeners.addInterface( 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)
+{
+ m_aSelectionListeners.removeInterface( listener );
+}
+
+}//namespace toolkit
+
+Reference< XInterface > SAL_CALL GridControl_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridControl( i_factory ) );
+}
+
+Reference< XInterface > SAL_CALL GridControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoGridModel( i_factory ) );
+}
diff --git a/toolkit/source/controls/grid/gridcontrol.hxx b/toolkit/source/controls/grid/gridcontrol.hxx
new file mode 100644
index 000000000000..61d9f8fc0232
--- /dev/null
+++ b/toolkit/source/controls/grid/gridcontrol.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#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/unocontrolbase.hxx>
+#include <toolkit/controls/unocontrolmodel.hxx>
+#include <toolkit/helper/servicenames.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
+#include <toolkit/helper/listenermultiplexer.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace toolkit
+{
+
+class GridEventForwarder;
+
+// ===================================================================
+// = UnoGridModel
+// ===================================================================
+class UnoGridModel : public UnoControlModel
+{
+protected:
+ ::com::sun::star::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const;
+ ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+public:
+ UnoGridModel( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ UnoGridModel( const UnoGridModel& rModel );
+
+ UnoControlModel* Clone() const;
+
+ // ::com::sun::star::lang::XComponent
+ void SAL_CALL dispose( ) 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::io::XPersistObject
+ ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException);
+
+ // OPropertySetHelper
+ void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw (::com::sun::star::uno::Exception);
+
+ // XServiceInfo
+ DECLIMPL_SERVICEINFO_DERIVED( UnoGridModel, UnoControlModel, szServiceName_GridControlModel )
+};
+
+
+// ===================================================================
+// = UnoGridControl
+// ===================================================================
+typedef ::cppu::ImplInheritanceHelper1 < UnoControlBase
+ , ::com::sun::star::awt::grid::XGridControl
+ > UnoGridControl_Base;
+class UnoGridControl : public UnoGridControl_Base
+{
+public:
+ UnoGridControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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);
+ sal_Bool SAL_CALL setModel( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxModel ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XGridControl
+ virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getCurrentRow( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::awt::grid::XGridSelection
+ virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllRows() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAllRows() 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 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;
+
+protected:
+ ~UnoGridControl();
+
+private:
+ ::com::sun::star::view::SelectionType mSelectionMode;
+ SelectionListenerMultiplexer m_aSelectionListeners;
+ ::boost::scoped_ptr< GridEventForwarder > m_pEventForwarder;
+};
+
+} // toolkit
+
+#endif // _TOOLKIT_TREE_CONTROL_HXX
diff --git a/toolkit/source/controls/grid/grideventforwarder.cxx b/toolkit/source/controls/grid/grideventforwarder.cxx
new file mode 100755
index 000000000000..c3760b8315a3
--- /dev/null
+++ b/toolkit/source/controls/grid/grideventforwarder.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "precompiled_toolkit.hxx"
+
+#include "grideventforwarder.hxx"
+#include "gridcontrol.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::awt::grid::GridDataEvent;
+ using ::com::sun::star::container::ContainerEvent;
+ using ::com::sun::star::lang::EventObject;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= GridEventForwarder
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ GridEventForwarder::GridEventForwarder( UnoGridControl& i_parent )
+ :m_parent( i_parent )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ GridEventForwarder::~GridEventForwarder()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::acquire() throw()
+ {
+ m_parent.acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::release() throw()
+ {
+ m_parent.release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->rowsInserted( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->rowsRemoved( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->dataChanged( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XGridDataListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->rowHeadingChanged( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::elementInserted( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->elementInserted( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::elementRemoved( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->elementRemoved( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::elementReplaced( const ContainerEvent& i_event ) throw (RuntimeException)
+ {
+ Reference< XContainerListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->elementReplaced( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL GridEventForwarder::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ Reference< XEventListener > xPeer( m_parent.getPeer(), UNO_QUERY );
+ if ( xPeer.is() )
+ xPeer->disposing( i_event );
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
diff --git a/toolkit/source/controls/grid/grideventforwarder.hxx b/toolkit/source/controls/grid/grideventforwarder.hxx
new file mode 100755
index 000000000000..5a8b03f57037
--- /dev/null
+++ b/toolkit/source/controls/grid/grideventforwarder.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_GRIDEVENTFORWARDER_HXX
+#define TOOLKIT_GRIDEVENTFORWARDER_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+#include <com/sun/star/awt/grid/XGridColumnListener.hpp>
+#include <com/sun/star/container/XContainerListener.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase2.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ class UnoGridControl;
+
+ //==================================================================================================================
+ //= GridEventForwarder
+ //==================================================================================================================
+ typedef ::cppu::ImplHelper2 < ::com::sun::star::awt::grid::XGridDataListener
+ , ::com::sun::star::container::XContainerListener
+ > GridEventForwarder_Base;
+
+ class GridEventForwarder : public GridEventForwarder_Base
+ {
+ public:
+ GridEventForwarder( UnoGridControl& i_parent );
+ virtual ~GridEventForwarder();
+
+ public:
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XGridDataListener
+ virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ UnoGridControl& m_parent;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_GRIDEVENTFORWARDER_HXX
diff --git a/toolkit/source/controls/grid/initguard.hxx b/toolkit/source/controls/grid/initguard.hxx
new file mode 100755
index 000000000000..b2dddd2e5987
--- /dev/null
+++ b/toolkit/source/controls/grid/initguard.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 SVTOOLS_INITGUARD_HXX
+#define SVTOOLS_INITGUARD_HXX
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/NotInitializedException.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentguard.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= InitGuard
+ //==================================================================================================================
+ template < class IMPL >
+ class InitGuard : public ::comphelper::ComponentGuard
+ {
+ public:
+ InitGuard( IMPL& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
+ :comphelper::ComponentGuard( i_component, i_broadcastHelper )
+ {
+ if ( !i_component.isInitialized() )
+ throw ::com::sun::star::lang::NotInitializedException( ::rtl::OUString(), *&i_component );
+ }
+
+ ~InitGuard()
+ {
+ }
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // SVTOOLS_INITGUARD_HXX
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
new file mode 100755
index 000000000000..77a2ffa1637b
--- /dev/null
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
@@ -0,0 +1,877 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 "sortablegriddatamodel.hxx"
+#include "toolkit/helper/servicenames.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/i18n/XCollator.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/anycompare.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <tools/diagnose_ex.h>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+
+#include <set>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::TypeClass;
+ using ::com::sun::star::uno::TypeClass_VOID;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::lang::IndexOutOfBoundsException;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::awt::grid::XGridDataListener;
+ using ::com::sun::star::beans::Pair;
+ using ::com::sun::star::util::XCloneable;
+ using ::com::sun::star::i18n::XCollator;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::awt::grid::GridDataEvent;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::ucb::AlreadyInitializedException;
+ /** === end UNO using === **/
+
+#ifdef DBG_UTIL
+ const char* SortableGridDataModel_checkInvariants( const void* _pInstance )
+ {
+ return static_cast< const SortableGridDataModel* >( _pInstance )->checkInvariants();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ const char* SortableGridDataModel::checkInvariants() const
+ {
+ if ( m_publicToPrivateRowIndex.size() != m_privateToPublicRowIndex.size() )
+ return "inconsistent index maps";
+
+ if ( m_delegator.is() )
+ {
+ if ( m_publicToPrivateRowIndex.size() != size_t( m_delegator->getRowCount() ) )
+ return "wrong cached row count";
+ }
+ else
+ {
+ if ( !m_publicToPrivateRowIndex.empty() )
+ return "disposed or not initialized, but having a non-empty map";
+ }
+
+ for ( size_t publicIndex=0; publicIndex<m_publicToPrivateRowIndex.size(); ++publicIndex )
+ {
+ ::sal_Int32 const privateIndex = m_publicToPrivateRowIndex[ publicIndex ];
+ if ( ( privateIndex < 0 ) || ( size_t( privateIndex ) >= m_privateToPublicRowIndex.size() ) )
+ return "invalid cached private index";
+
+ if ( m_privateToPublicRowIndex[ privateIndex ] != sal_Int32( publicIndex ) )
+ return "index map traversal not commutavive";
+ }
+
+ if ( impl_isSorted_nothrow() && m_publicToPrivateRowIndex.empty() )
+ return "sorted, but no row index translation tables";
+
+ if ( !impl_isSorted_nothrow() && !m_publicToPrivateRowIndex.empty() )
+ return "unsorted, but have index translation tables";
+
+ return NULL;
+ }
+#endif
+
+#define DBG_CHECK_ME() \
+ DBG_CHKTHIS( SortableGridDataModel, SortableGridDataModel_checkInvariants )
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ template< class STLCONTAINER >
+ static void lcl_clear( STLCONTAINER& i_container )
+ {
+ STLCONTAINER empty;
+ empty.swap( i_container );
+ }
+ }
+
+ //==================================================================================================================
+ //= SortableGridDataModel
+ //==================================================================================================================
+ DBG_NAME( SortableGridDataModel )
+ //------------------------------------------------------------------------------------------------------------------
+ SortableGridDataModel::SortableGridDataModel( Reference< XMultiServiceFactory > const & i_factory )
+ :SortableGridDataModel_Base( m_aMutex )
+ ,SortableGridDataModel_PrivateBase()
+ ,m_context( i_factory )
+ ,m_isInitialized( false )
+ ,m_delegator()
+ ,m_collator()
+ ,m_currentSortColumn( -1 )
+ ,m_sortAscending( true )
+ ,m_publicToPrivateRowIndex()
+ ,m_privateToPublicRowIndex()
+ {
+ DBG_CTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SortableGridDataModel::SortableGridDataModel( SortableGridDataModel const & i_copySource )
+ :cppu::BaseMutex()
+ ,SortableGridDataModel_Base( m_aMutex )
+ ,SortableGridDataModel_PrivateBase()
+ ,m_context( i_copySource.m_context )
+ ,m_isInitialized( true )
+ ,m_delegator()
+ ,m_collator( i_copySource.m_collator )
+ ,m_currentSortColumn( i_copySource.m_currentSortColumn )
+ ,m_sortAscending( i_copySource.m_sortAscending )
+ ,m_publicToPrivateRowIndex( i_copySource.m_publicToPrivateRowIndex )
+ ,m_privateToPublicRowIndex( i_copySource.m_privateToPublicRowIndex )
+ {
+ DBG_CTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
+
+ ENSURE_OR_THROW( i_copySource.m_delegator.is(),
+ "not expected to be called for a disposed copy source!" );
+ m_delegator.set( i_copySource.m_delegator->createClone(), UNO_QUERY_THROW );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SortableGridDataModel::~SortableGridDataModel()
+ {
+ if ( !rBHelper.bDisposed )
+ {
+ acquire();
+ dispose();
+ }
+
+ DBG_DTOR( SortableGridDataModel, SortableGridDataModel_checkInvariants );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::queryInterface( const Type& aType ) throw (RuntimeException)
+ {
+ Any aReturn( SortableGridDataModel_Base::queryInterface( aType ) );
+ if ( !aReturn.hasValue() )
+ aReturn = SortableGridDataModel_PrivateBase::queryInterface( aType );
+ return aReturn;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::acquire( ) throw ()
+ {
+ SortableGridDataModel_Base::acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::release( ) throw ()
+ {
+ SortableGridDataModel_Base::release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< Type > SAL_CALL SortableGridDataModel::getTypes( ) throw (RuntimeException)
+ {
+ return SortableGridDataModel_Base::getTypes();
+ // don't expose the types got via SortableGridDataModel_PrivateBase - they're private, after all
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::sal_Int8 > SAL_CALL SortableGridDataModel::getImplementationId( ) throw (RuntimeException)
+ {
+ static ::cppu::OImplementationId aId;
+ return aId.getImplementationId();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ Reference< XCollator > lcl_loadDefaultCollator_throw( ::comphelper::ComponentContext const & i_context )
+ {
+ Reference< XCollator > const xCollator( i_context.createComponent( "com.sun.star.i18n.Collator" ), UNO_QUERY_THROW );
+ xCollator->loadDefaultCollator( Application::GetSettings().GetLocale(), 0 );
+ return xCollator;
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::initialize( const Sequence< Any >& i_arguments ) throw (Exception, RuntimeException)
+ {
+ ::comphelper::ComponentGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ if ( m_delegator.is() )
+ throw AlreadyInitializedException( ::rtl::OUString(), *this );
+
+ Reference< XMutableGridDataModel > xDelegator;
+ Reference< XCollator > xCollator;
+ switch ( i_arguments.getLength() )
+ {
+ case 1: // SortableGridDataModel.create( XMutableGridDataModel )
+ xDelegator.set( i_arguments[0], UNO_QUERY );
+ xCollator = lcl_loadDefaultCollator_throw( m_context );
+ break;
+
+ case 2: // SortableGridDataModel.createWithCollator( XMutableGridDataModel, XCollator )
+ xDelegator.set( i_arguments[0], UNO_QUERY );
+ xCollator.set( i_arguments[1], UNO_QUERY );
+ if ( !xCollator.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 2 );
+ break;
+ }
+ if ( !xDelegator.is() )
+ throw IllegalArgumentException( ::rtl::OUString(), *this, 1 );
+
+ m_delegator = xDelegator;
+ m_collator = xCollator;
+
+ m_delegator->addGridDataListener( this );
+
+ m_isInitialized = true;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ GridDataEvent SortableGridDataModel::impl_createPublicEvent( GridDataEvent const & i_originalEvent ) const
+ {
+ GridDataEvent aEvent( i_originalEvent );
+ aEvent.Source = *const_cast< SortableGridDataModel* >( this );
+ aEvent.FirstRow = impl_getPublicRowIndex_nothrow( aEvent.FirstRow );
+ aEvent.LastRow = impl_getPublicRowIndex_nothrow( aEvent.LastRow );
+ return aEvent;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SortableGridDataModel::impl_broadcast( void ( SAL_CALL XGridDataListener::*i_listenerMethod )( const GridDataEvent & ),
+ GridDataEvent const & i_publicEvent, MethodGuard& i_instanceLock )
+ {
+ ::cppu::OInterfaceContainerHelper* pListeners = rBHelper.getContainer( XGridDataListener::static_type() );
+ if ( pListeners == NULL )
+ return;
+
+ i_instanceLock.clear();
+ pListeners->notifyEach( i_listenerMethod, i_publicEvent );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::rowsInserted( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ // if the data is not sorted, broadcast the event unchanged
+ if ( !impl_isSorted_nothrow() )
+ {
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard );
+ return;
+ }
+
+ bool needReIndex = false;
+ if ( i_event.FirstRow > i_event.LastRow )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - invalid row indexes!" );
+ needReIndex = true;
+ }
+ else if ( size_t( i_event.FirstRow ) > m_privateToPublicRowIndex.size() )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsInserted: invalid event - too large row index!" );
+ needReIndex = true;
+ }
+
+ if ( needReIndex )
+ {
+ impl_rebuildIndexesAndNotify( aGuard );
+ return;
+ }
+
+ // we do not insert the new rows into the sort order - if somebody adds rows while we're sorted, s/he has
+ // to resort. Instead, we simply append the rows, no matter where they were inserted in the delegator data
+ // model.
+ sal_Int32 const nPublicFirstRow = sal_Int32( m_privateToPublicRowIndex.size() );
+ sal_Int32 nPublicLastRow = nPublicFirstRow;
+ for ( sal_Int32 newRow = i_event.FirstRow; newRow <= i_event.LastRow; ++newRow, ++nPublicLastRow )
+ {
+ m_privateToPublicRowIndex.push_back( nPublicLastRow );
+ m_publicToPrivateRowIndex.push_back( nPublicLastRow );
+ }
+
+ // broadcast the event
+ GridDataEvent const aEvent( *this, -1, -1, nPublicFirstRow, nPublicLastRow );
+ impl_broadcast( &XGridDataListener::rowsInserted, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ void lcl_decrementValuesGreaterThan( ::std::vector< ::sal_Int32 > & io_indexMap, sal_Int32 const i_threshold )
+ {
+ for ( ::std::vector< ::sal_Int32 >::iterator loop = io_indexMap.begin();
+ loop != io_indexMap.end();
+ ++loop
+ )
+ {
+ if ( *loop >= i_threshold )
+ --*loop;
+ }
+ }
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SortableGridDataModel::impl_rebuildIndexesAndNotify( MethodGuard& i_instanceLock )
+ {
+ OSL_PRECOND( impl_isSorted_nothrow(), "SortableGridDataModel::impl_rebuildIndexesAndNotify: illegal call!" );
+
+ // clear the indexes
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+
+ // broadcast an artificial event, saying that all rows have been removed
+ GridDataEvent const aRemovalEvent( *this, -1, -1, -1, -1 );
+ impl_broadcast( &XGridDataListener::rowsRemoved, aRemovalEvent, i_instanceLock );
+ i_instanceLock.reset();
+
+ // rebuild the index
+ impl_reIndex_nothrow( m_currentSortColumn, m_sortAscending );
+
+ // broadcast an artificial event, saying that n rows have been added
+ GridDataEvent const aAdditionEvent( *this, -1, -1, 0, m_delegator->getRowCount() - 1 );
+ impl_broadcast( &XGridDataListener::rowsInserted, aAdditionEvent, i_instanceLock );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::rowsRemoved( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ // if the data is not sorted, broadcast the event unchanged
+ if ( !impl_isSorted_nothrow() )
+ {
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
+ return;
+ }
+
+ // if all rows have been removed, also simply multiplex to own listeners
+ if ( i_event.FirstRow < 0 )
+ {
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+ GridDataEvent aEvent( i_event );
+ aEvent.Source = *this;
+ impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
+ return;
+ }
+
+ bool needReIndex = false;
+ if ( i_event.FirstRow != i_event.LastRow )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsRemoved: missing implementation - removal of multiple rows!" );
+ needReIndex = true;
+ }
+ else if ( size_t( i_event.FirstRow ) >= m_privateToPublicRowIndex.size() )
+ {
+ OSL_ENSURE( false, "SortableGridDataModel::rowsRemoved: inconsistent/wrong data!" );
+ needReIndex = true;
+ }
+
+ if ( needReIndex )
+ {
+ impl_rebuildIndexesAndNotify( aGuard );
+ return;
+ }
+
+ // build public event version
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+
+ // remove the entries from the index maps
+ sal_Int32 const privateIndex = i_event.FirstRow;
+ sal_Int32 const publicIndex = aEvent.FirstRow;
+
+ m_publicToPrivateRowIndex.erase( m_publicToPrivateRowIndex.begin() + publicIndex );
+ m_privateToPublicRowIndex.erase( m_privateToPublicRowIndex.begin() + privateIndex );
+
+ // adjust remaining entries in the index maps
+ lcl_decrementValuesGreaterThan( m_publicToPrivateRowIndex, privateIndex );
+ lcl_decrementValuesGreaterThan( m_privateToPublicRowIndex, publicIndex );
+
+ // broadcast the event
+ impl_broadcast( &XGridDataListener::rowsRemoved, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::dataChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::dataChanged, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::rowHeadingChanged( const GridDataEvent& i_event ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ GridDataEvent const aEvent( impl_createPublicEvent( i_event ) );
+ impl_broadcast( &XGridDataListener::rowHeadingChanged, aEvent, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::disposing( const EventObject& i_event ) throw (RuntimeException)
+ {
+ // not interested in
+ OSL_UNUSED( i_event );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ namespace
+ {
+ class CellDataLessComparison : public ::std::binary_function< sal_Int32, sal_Int32, bool >
+ {
+ public:
+ CellDataLessComparison(
+ ::std::vector< Any > const & i_data,
+ ::comphelper::IKeyPredicateLess& i_predicate,
+ sal_Bool const i_sortAscending
+ )
+ :m_data( i_data )
+ ,m_predicate( i_predicate )
+ ,m_sortAscending( i_sortAscending )
+ {
+ }
+
+ bool operator()( sal_Int32 const i_lhs, sal_Int32 const i_rhs ) const
+ {
+ Any const & lhs = m_data[ i_lhs ];
+ Any const & rhs = m_data[ i_rhs ];
+ // <VOID/> is less than everything else
+ if ( !lhs.hasValue() )
+ return m_sortAscending;
+ if ( !rhs.hasValue() )
+ return !m_sortAscending;
+
+ // actually compare
+ if ( m_sortAscending )
+ return m_predicate.isLess( lhs, rhs );
+ else
+ return m_predicate.isLess( rhs, lhs );
+ }
+
+ private:
+ ::std::vector< Any > const & m_data;
+ ::comphelper::IKeyPredicateLess const & m_predicate;
+ sal_Bool const m_sortAscending;
+ };
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SortableGridDataModel::impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending )
+ {
+ ::sal_Int32 const rowCount( getRowCount() );
+ ::std::vector< ::sal_Int32 > aPublicToPrivate( rowCount );
+
+ try
+ {
+ // build an unsorted translation table, and retrieve the unsorted data
+ ::std::vector< Any > aColumnData( rowCount );
+ Type dataType;
+ for ( ::sal_Int32 rowIndex = 0; rowIndex < rowCount; ++rowIndex )
+ {
+ aColumnData[ rowIndex ] = m_delegator->getCellData( i_columnIndex, rowIndex );
+ aPublicToPrivate[ rowIndex ] = rowIndex;
+
+ // determine the data types we assume for the complete column
+ if ( ( dataType.getTypeClass() == TypeClass_VOID ) && aColumnData[ rowIndex ].hasValue() )
+ dataType = aColumnData[ rowIndex ].getValueType();
+ }
+
+ // get predicate object
+ ::std::auto_ptr< ::comphelper::IKeyPredicateLess > const pPredicate( ::comphelper::getStandardLessPredicate( dataType, m_collator ) );
+ ENSURE_OR_RETURN_VOID( pPredicate.get(), "SortableGridDataModel::impl_reIndex_nothrow: no sortable data found!" );
+
+ // then sort
+ CellDataLessComparison const aComparator( aColumnData, *pPredicate, i_sortAscending );
+ ::std::sort( aPublicToPrivate.begin(), aPublicToPrivate.end(), aComparator );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ return;
+ }
+
+ // also build the "private to public" mapping
+ ::std::vector< sal_Int32 > aPrivateToPublic( aPublicToPrivate.size() );
+ for ( size_t i=0; i<aPublicToPrivate.size(); ++i )
+ aPrivateToPublic[ aPublicToPrivate[i] ] = i;
+
+ m_publicToPrivateRowIndex.swap( aPublicToPrivate );
+ m_privateToPublicRowIndex.swap( aPrivateToPublic );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::sortByColumn( ::sal_Int32 i_columnIndex, ::sal_Bool i_sortAscending ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ if ( ( i_columnIndex < 0 ) || ( i_columnIndex >= getColumnCount() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *this );
+
+ impl_reIndex_nothrow( i_columnIndex, i_sortAscending );
+
+ m_currentSortColumn = i_columnIndex;
+ m_sortAscending = i_sortAscending;
+
+ impl_broadcast(
+ &XGridDataListener::dataChanged,
+ GridDataEvent( *this, -1, -1, -1, -1 ),
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeColumnSort( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+
+ m_currentSortColumn = -1;
+ m_sortAscending = sal_True;
+
+ impl_broadcast(
+ &XGridDataListener::dataChanged,
+ GridDataEvent( *this, -1, -1, -1, -1 ),
+ aGuard
+ );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Pair< ::sal_Int32, ::sal_Bool > SAL_CALL SortableGridDataModel::getCurrentSortOrder( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ return Pair< ::sal_Int32, ::sal_Bool >( m_currentSortColumn, m_sortAscending );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::addRow( const Any& i_heading, const Sequence< Any >& i_data ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->addRow( i_heading, i_data );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::addRows( const Sequence< Any >& i_headings, const Sequence< Sequence< Any > >& i_data ) throw (IllegalArgumentException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->addRows( i_headings, i_data );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeRow( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->removeRow( rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeAllRows( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->removeAllRows();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateCellData( i_columnIndex, rowIndex, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateRowData( const Sequence< ::sal_Int32 >& i_columnIndexes, ::sal_Int32 i_rowIndex, const Sequence< Any >& i_values ) throw (IndexOutOfBoundsException, IllegalArgumentException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateRowData( i_columnIndexes, rowIndex, i_values );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateRowHeading( ::sal_Int32 i_rowIndex, const Any& i_heading ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateRowHeading( rowIndex, i_heading );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateCellToolTip( i_columnIndex, rowIndex, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::updateRowToolTip( ::sal_Int32 i_rowIndex, const Any& i_value ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ delegator->updateRowToolTip( rowIndex, i_value );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::addGridDataListener( const Reference< XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.addListener( XGridDataListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::removeGridDataListener( const Reference< XGridDataListener >& i_listener ) throw (RuntimeException)
+ {
+ rBHelper.removeListener( XGridDataListener::static_type(), i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL SortableGridDataModel::getRowCount() throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getRowCount();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SAL_CALL SortableGridDataModel::getColumnCount() throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getColumnCount();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::getCellData( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getCellData( i_columnIndex, rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::getCellToolTip( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getCellToolTip( i_columnIndex, rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Any SAL_CALL SortableGridDataModel::getRowHeading( ::sal_Int32 i_rowIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ ::sal_Int32 const rowIndex = impl_getPrivateRowIndex_throw( i_rowIndex );
+
+ Reference< XMutableGridDataModel > const delegator( m_delegator );
+ aGuard.clear();
+ return delegator->getRowHeading( rowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL SortableGridDataModel::disposing()
+ {
+ m_currentSortColumn = -1;
+
+ Reference< XComponent > const delegatorComponent( m_delegator.get() );
+ m_delegator->removeGridDataListener( this );
+ m_delegator.clear();
+ delegatorComponent->dispose();
+
+ Reference< XComponent > const collatorComponent( m_collator, UNO_QUERY );
+ m_collator.clear();
+ if ( collatorComponent.is() )
+ collatorComponent->dispose();
+
+ lcl_clear( m_publicToPrivateRowIndex );
+ lcl_clear( m_privateToPublicRowIndex );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XCloneable > SAL_CALL SortableGridDataModel::createClone( ) throw (RuntimeException)
+ {
+ MethodGuard aGuard( *this, rBHelper );
+ DBG_CHECK_ME();
+
+ return new SortableGridDataModel( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL SortableGridDataModel::getImplementationName( ) throw (RuntimeException)
+ {
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.comp.toolkit.SortableGridDataModel" ) );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL SortableGridDataModel::supportsService( const ::rtl::OUString& i_serviceName ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > const aServiceNames( getSupportedServiceNames() );
+ for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i )
+ if ( aServiceNames[i] == i_serviceName )
+ return sal_True;
+ return sal_False;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL SortableGridDataModel::getSupportedServiceNames( ) throw (RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(1);
+ aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SortableGridDataModel );
+ return aServiceNames;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SortableGridDataModel::impl_getPrivateRowIndex_throw( ::sal_Int32 const i_publicRowIndex ) const
+ {
+ if ( ( i_publicRowIndex < 0 ) || ( i_publicRowIndex >= m_delegator->getRowCount() ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), *const_cast< SortableGridDataModel* >( this ) );
+
+ if ( !impl_isSorted_nothrow() )
+ // no need to translate anything
+ return i_publicRowIndex;
+
+ ENSURE_OR_RETURN( size_t( i_publicRowIndex ) < m_publicToPrivateRowIndex.size(),
+ "SortableGridDataModel::impl_getPrivateRowIndex_throw: inconsistency!", i_publicRowIndex );
+ // obviously the translation table contains too few elements - it should have exactly |getRowCount()|
+ // elements
+
+ return m_publicToPrivateRowIndex[ i_publicRowIndex ];
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Int32 SortableGridDataModel::impl_getPublicRowIndex_nothrow( ::sal_Int32 const i_privateRowIndex ) const
+ {
+ if ( !impl_isSorted_nothrow() )
+ // no need to translate anything
+ return i_privateRowIndex;
+
+ if ( i_privateRowIndex < 0 )
+ return i_privateRowIndex;
+
+ ENSURE_OR_RETURN( size_t( i_privateRowIndex ) < m_privateToPublicRowIndex.size(),
+ "SortableGridDataModel::impl_getPublicRowIndex_nothrow: invalid index!", i_privateRowIndex );
+
+ return m_privateToPublicRowIndex[ i_privateRowIndex ];
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+{
+ return *( new ::toolkit::SortableGridDataModel( i_factory ) );
+}
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.hxx b/toolkit/source/controls/grid/sortablegriddatamodel.hxx
new file mode 100755
index 000000000000..50f08d3a7113
--- /dev/null
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#ifndef TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
+#define TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
+
+#include "initguard.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/awt/grid/XSortableMutableGridDataModel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+#include <com/sun/star/awt/grid/XGridDataListener.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/componentcontext.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ class SortableGridDataModel;
+ typedef InitGuard< SortableGridDataModel > MethodGuard;
+
+ //==================================================================================================================
+ //= SortableGridDataModel
+ //==================================================================================================================
+ typedef ::cppu::WeakComponentImplHelper3 < ::com::sun::star::awt::grid::XSortableMutableGridDataModel
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XInitialization
+ > SortableGridDataModel_Base;
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::awt::grid::XGridDataListener
+ > SortableGridDataModel_PrivateBase;
+ class SortableGridDataModel :public ::cppu::BaseMutex
+ ,public SortableGridDataModel_Base
+ ,public SortableGridDataModel_PrivateBase
+ {
+ public:
+ SortableGridDataModel( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > const & i_factory );
+ SortableGridDataModel( SortableGridDataModel const & i_copySource );
+
+ bool isInitialized() const { return m_isInitialized; }
+
+#ifdef DBG_UTIL
+ const char* checkInvariants() const;
+#endif
+
+ protected:
+ ~SortableGridDataModel();
+
+ public:
+ // XSortableGridData
+ virtual void SAL_CALL sortByColumn( ::sal_Int32 ColumnIndex, ::sal_Bool SortAscending ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeColumnSort( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Pair< ::sal_Int32, ::sal_Bool > SAL_CALL getCurrentSortOrder( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XMutableGridDataModel
+ virtual void SAL_CALL addRow( const ::com::sun::star::uno::Any& Heading, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Data ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRows( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Headings, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& Data ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRow( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAllRows( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellData( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowData( const ::com::sun::star::uno::Sequence< ::sal_Int32 >& ColumnIndexes, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowHeading( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Heading ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateCellToolTip( ::sal_Int32 ColumnIndex, ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL updateRowToolTip( ::sal_Int32 RowIndex, const ::com::sun::star::uno::Any& Value ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeGridDataListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XGridDataListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XGridDataModel
+ virtual ::sal_Int32 SAL_CALL getRowCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getColumnCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellData( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getCellToolTip( ::sal_Int32 Column, ::sal_Int32 Row ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getRowHeading( ::sal_Int32 RowIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XCloneable
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XInitialization
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // XGridDataListener
+ virtual void SAL_CALL rowsInserted( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowsRemoved( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dataChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowHeadingChanged( const ::com::sun::star::awt::grid::GridDataEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& i_event ) 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);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ /** translates the given public index into one to be passed to our delegator
+ @throws ::com::sun::star::lang::IndexOutOfBoundsException
+ if the given index does not denote a valid row
+ */
+ ::sal_Int32 impl_getPrivateRowIndex_throw( ::sal_Int32 const i_publicRowIndex ) const;
+
+ /** translates the given private row index to a public one
+ */
+ ::sal_Int32 impl_getPublicRowIndex_nothrow( ::sal_Int32 const i_privateRowIndex ) const;
+
+ inline bool impl_isSorted_nothrow() const
+ {
+ return m_currentSortColumn >= 0;
+ }
+
+ /** rebuilds the index translation structure.
+
+ Neither <member>m_currentSortColumn</member> nor <member>m_sortAscending</member> are touched by this method.
+ Also, the given column index is not checked, this is the responsibility of the caller.
+ */
+ void impl_reIndex_nothrow( ::sal_Int32 const i_columnIndex, sal_Bool const i_sortAscending );
+
+ /** translates the given event, obtained from our delegator, to a version which can be broadcasted to our own
+ clients.
+ */
+ ::com::sun::star::awt::grid::GridDataEvent
+ impl_createPublicEvent( ::com::sun::star::awt::grid::GridDataEvent const & i_originalEvent ) const;
+
+ /** broadcasts the given event to our registered XGridDataListeners
+ */
+ void impl_broadcast(
+ void ( SAL_CALL ::com::sun::star::awt::grid::XGridDataListener::*i_listenerMethod )( const ::com::sun::star::awt::grid::GridDataEvent & ),
+ ::com::sun::star::awt::grid::GridDataEvent const & i_publicEvent,
+ MethodGuard& i_instanceLock
+ );
+
+ /** rebuilds our indexes, notifying row removal and row addition events
+
+ First, a rowsRemoved event is notified to our registered listeners. Then, the index translation tables are
+ rebuilt, and a rowsInserted event is notified.
+
+ Only to be called when we're sorted.
+ */
+ void impl_rebuildIndexesAndNotify( MethodGuard& i_instanceLock );
+
+ private:
+ ::comphelper::ComponentContext m_context;
+ bool m_isInitialized;
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::grid::XMutableGridDataModel > m_delegator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_collator;
+ ::sal_Int32 m_currentSortColumn;
+ ::sal_Bool m_sortAscending;
+ ::std::vector< ::sal_Int32 > m_publicToPrivateRowIndex;
+ ::std::vector< ::sal_Int32 > m_privateToPublicRowIndex;
+ };
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
+
+#endif // TOOLKIT_SORTABLEGRIDDATAMODEL_HXX
diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx
new file mode 100644
index 000000000000..875f05e2f80d
--- /dev/null
+++ b/toolkit/source/controls/roadmapcontrol.cxx
@@ -0,0 +1,503 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_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_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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlRoadmapModel_Base( i_factory )
+ ,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_GRAPHIC );
+ 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 = UnoControlRoadmapModel_Base::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 );
+ }
+
+ // ===================================================================
+ // = UnoRoadmapControl
+ // ===================================================================
+ // -------------------------------------------------------------------
+ UnoRoadmapControl::UnoRoadmapControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlRoadmap_Base( i_factory )
+ ,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 )
+ {
+
+
+ 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 );
+
+ return bReturn;
+ }
+
+
+ // -------------------------------------------------------------------
+ ::rtl::OUString UnoRoadmapControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "Roadmap" );
+ }
+
+
+
+ void UnoRoadmapControl::dispose() throw(RuntimeException)
+ {
+ EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+ }
+
+
+
+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/spinningprogress.cxx b/toolkit/source/controls/spinningprogress.cxx
new file mode 100755
index 000000000000..cb02274e3997
--- /dev/null
+++ b/toolkit/source/controls/spinningprogress.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#include "precompiled_toolkit.hxx"
+
+#include "toolkit/controls/spinningprogress.hxx"
+#include "toolkit/helper/servicenames.hxx"
+#include "toolkit/helper/unopropertyarrayhelper.hxx"
+
+/** === begin UNO includes === **/
+/** === end UNO includes === **/
+
+#include <rtl/ustrbuf.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/throbber.hxx>
+
+//......................................................................................................................
+namespace toolkit
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::beans::XPropertySetInfo;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= SpinningProgressControlModel
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ SpinningProgressControlModel::SpinningProgressControlModel( Reference< XMultiServiceFactory > const & i_factory )
+ :SpinningProgressControlModel_Base( i_factory )
+ {
+ // default image sets
+ osl_incrementInterlockedCount( &m_refCount );
+ {
+ try
+ {
+ Throbber::ImageSet aImageSets[] =
+ {
+ Throbber::IMAGES_16_PX, Throbber::IMAGES_32_PX, Throbber::IMAGES_64_PX
+ };
+ for ( size_t i=0; i < sizeof( aImageSets ) / sizeof( aImageSets[0] ); ++i )
+ {
+ const ::std::vector< ::rtl::OUString > aDefaultURLs( Throbber::getDefaultImageURLs( aImageSets[i] ) );
+ const Sequence< ::rtl::OUString > aImageURLs( &aDefaultURLs[0], aDefaultURLs.size() );
+ insertImageSet( i, aImageURLs );
+ }
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SpinningProgressControlModel::SpinningProgressControlModel( const SpinningProgressControlModel& i_copySource )
+ :SpinningProgressControlModel_Base( i_copySource )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SpinningProgressControlModel::~SpinningProgressControlModel()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UnoControlModel* SpinningProgressControlModel::Clone() const
+ {
+ return new SpinningProgressControlModel( *this );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XPropertySetInfo > SAL_CALL SpinningProgressControlModel::getPropertySetInfo( ) throw(RuntimeException)
+ {
+ static Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL SpinningProgressControlModel::getServiceName() throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL SpinningProgressControlModel::getImplementationName( ) throw(RuntimeException)
+ {
+ return ::rtl::OUString::createFromAscii( "org.openoffice.comp.toolkit.SpinningProgressControlModel" );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL SpinningProgressControlModel::getSupportedServiceNames() throw(RuntimeException)
+ {
+ Sequence< ::rtl::OUString > aServiceNames(3);
+ aServiceNames[0] = ::rtl::OUString::createFromAscii( szServiceName_SpinningProgressControlModel );
+ aServiceNames[1] = ::rtl::OUString::createFromAscii( szServiceName_AnimatedImagesControlModel );
+ aServiceNames[2] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.UnoControlModel" );
+ return aServiceNames;
+ }
+
+//......................................................................................................................
+} // namespace toolkit
+//......................................................................................................................
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/tabpagecontainer.cxx b/toolkit/source/controls/tabpagecontainer.cxx
new file mode 100644
index 000000000000..808feca02e8a
--- /dev/null
+++ b/toolkit/source/controls/tabpagecontainer.cxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/tabpagecontainer.hxx>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <comphelper/processfactory.hxx>
+#include <osl/diagnose.h>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <tools/diagnose_ex.h>
+
+using ::rtl::OUString;
+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::container;
+using namespace ::com::sun::star::view;
+
+#define WRONG_TYPE_EXCEPTION "Type must be ::com::sun::star::awt::tab::XTabPageModel!"
+// ----------------------------------------------------
+// class UnoControlTabPageContainerModel
+// ----------------------------------------------------
+UnoControlTabPageContainerModel::UnoControlTabPageContainerModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlTabPageContainerModel_Base( i_factory )
+ ,maContainerListeners( *this )
+{
+ 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 UnoControlTabPageContainerModel::getServiceName() throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainerModel );
+}
+
+uno::Any UnoControlTabPageContainerModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ switch(nPropId)
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ return uno::makeAny( ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageContainer ) );
+ case BASEPROPERTY_BORDER:
+ return uno::makeAny((sal_Int16) 0); // No Border
+ default:
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+}
+
+::cppu::IPropertyArrayHelper& UnoControlTabPageContainerModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ com::sun::star::uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+Reference< ::com::sun::star::beans::XPropertySetInfo > UnoControlTabPageContainerModel::getPropertySetInfo( ) throw(RuntimeException)
+{
+ static Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+void SAL_CALL UnoControlTabPageContainerModel::insertByIndex( ::sal_Int32 nIndex, const com::sun::star::uno::Any& aElement) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, uno::RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ uno::Reference < ::awt::tab::XTabPageModel > xTabPageModel;
+ if(aElement >>= xTabPageModel)
+ {
+ if ( sal_Int32( m_aTabPageVector.size()) ==nIndex )
+ m_aTabPageVector.push_back( xTabPageModel );
+ else if ( sal_Int32( m_aTabPageVector.size()) > nIndex )
+ {
+ std::vector< uno::Reference< ::awt::tab::XTabPageModel > >::iterator aIter = m_aTabPageVector.begin();
+ aIter += nIndex;
+ m_aTabPageVector.insert( aIter, xTabPageModel );
+ }
+ else
+ throw IndexOutOfBoundsException( ::rtl::OUString(), (OWeakObject *)this );
+ ContainerEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.Element <<= aElement;
+ aEvent.Accessor <<= ::rtl::OUString::valueOf(nIndex);
+ maContainerListeners.elementInserted( aEvent );
+ }
+ else
+ throw IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )),
+ (OWeakObject *)this, 2 );
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL UnoControlTabPageContainerModel::removeByIndex( ::sal_Int32 /*Index*/ ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+// XIndexReplace
+void SAL_CALL UnoControlTabPageContainerModel::replaceByIndex( ::sal_Int32 /*Index*/, const uno::Any& /*Element*/ ) throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+}
+// -----------------------------------------------------------------------------
+// XIndexAccess
+::sal_Int32 SAL_CALL UnoControlTabPageContainerModel::getCount( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return sal_Int32( m_aTabPageVector.size());
+}
+// -----------------------------------------------------------------------------
+uno::Any SAL_CALL UnoControlTabPageContainerModel::getByIndex( ::sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ if ( nIndex < 0 || nIndex > sal_Int32(m_aTabPageVector.size()) )
+ throw lang::IndexOutOfBoundsException();
+ return uno::makeAny(m_aTabPageVector[nIndex]);
+}
+// -----------------------------------------------------------------------------
+// XElementAccess
+uno::Type SAL_CALL UnoControlTabPageContainerModel::getElementType( ) throw (uno::RuntimeException)
+{
+ return ::getCppuType(static_cast< Reference< com::sun::star::awt::XControlModel>* >(NULL));
+}
+// -----------------------------------------------------------------------------
+::sal_Bool SAL_CALL UnoControlTabPageContainerModel::hasElements( ) throw (uno::RuntimeException)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
+ return !m_aTabPageVector.empty();
+}
+// XContainer
+void UnoControlTabPageContainerModel::addContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.addInterface( l );
+}
+
+void UnoControlTabPageContainerModel::removeContainerListener( const Reference< XContainerListener >& l ) throw(RuntimeException)
+{
+ maContainerListeners.removeInterface( l );
+}
+
+// ----------------------------------------------------
+// class UnoControlTabPageContainer
+// ----------------------------------------------------
+UnoControlTabPageContainer::UnoControlTabPageContainer( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlTabPageContainer_Base( i_factory )
+ ,m_aTabPageListeners( *this )
+{
+}
+
+OUString UnoControlTabPageContainer::GetComponentServiceName()
+{
+ return OUString::createFromAscii( "TabPageContainer" );
+}
+
+void SAL_CALL UnoControlTabPageContainer::dispose( ) throw(RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ m_aTabPageListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+
+void UnoControlTabPageContainer::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::createPeer( rxToolkit, rParentPeer );
+
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ if ( m_aTabPageListeners.getLength() )
+ xTPContainer->addTabPageListener(&m_aTabPageListeners);
+}
+
+// -------------------------------------------------------------------
+// XTabPageContainer
+
+::sal_Int16 SAL_CALL UnoControlTabPageContainer::getActiveTabPageID() throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getActiveTabPageID();
+}
+void SAL_CALL UnoControlTabPageContainer::setActiveTabPageID( ::sal_Int16 _activetabpageid ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ xTPContainer->setActiveTabPageID(_activetabpageid);
+}
+::sal_Int32 SAL_CALL UnoControlTabPageContainer::getTabPageCount( ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPageCount();
+}
+::sal_Bool SAL_CALL UnoControlTabPageContainer::isTabPageActive( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->isTabPageActive(tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPage( ::sal_Int16 tabPageIndex ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPage(tabPageIndex);
+}
+Reference< ::com::sun::star::awt::tab::XTabPage > SAL_CALL UnoControlTabPageContainer::getTabPageByID( ::sal_Int16 tabPageID ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ Reference< XTabPageContainer > xTPContainer( getPeer(), UNO_QUERY_THROW );
+ return xTPContainer->getTabPageByID(tabPageID);
+}
+void SAL_CALL UnoControlTabPageContainer::addTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ m_aTabPageListeners.addInterface( listener );
+ if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
+ xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
+ }
+}
+void SAL_CALL UnoControlTabPageContainer::removeTabPageListener( const Reference< ::com::sun::star::awt::tab::XTabPageContainerListener >& listener ) throw (RuntimeException)
+{
+ if( getPeer().is() && m_aTabPageListeners.getLength() == 1 )
+ {
+ uno::Reference < awt::tab::XTabPageContainer > xTabPageContainer( getPeer(), uno::UNO_QUERY );
+ xTabPageContainer->addTabPageListener( &m_aTabPageListeners );
+ }
+ m_aTabPageListeners.removeInterface( listener );
+}
+
+void UnoControlTabPageContainer::updateFromModel()
+{
+ UnoControlTabPageContainer_Base::updateFromModel();
+ Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xContainerListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
+
+ ContainerEvent aEvent;
+ aEvent.Source = getModel();
+ Sequence< Reference< XControl > > aControls = getControls();
+ const Reference< XControl >* pCtrls = aControls.getConstArray();
+ const Reference< XControl >* pCtrlsEnd = pCtrls + aControls.getLength();
+
+ for ( ; pCtrls < pCtrlsEnd; ++pCtrls )
+ {
+ aEvent.Element <<= *pCtrls;
+ xContainerListener->elementInserted( aEvent );
+ }
+}
+void SAL_CALL UnoControlTabPageContainer::addControl( const ::rtl::OUString& Name, const Reference< ::com::sun::star::awt::XControl >& Control ) throw (RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ControlContainerBase::addControl(Name,Control);
+ Reference< XContainerListener > xContainerListener( getPeer(), UNO_QUERY );
+ ContainerEvent aEvent;
+ aEvent.Source = getModel();
+ aEvent.Element <<= Control;
+ xContainerListener->elementInserted( aEvent );
+}
+
diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx
new file mode 100644
index 000000000000..f498fefd761b
--- /dev/null
+++ b/toolkit/source/controls/tabpagemodel.cxx
@@ -0,0 +1,396 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// 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/tabpagemodel.hxx>
+#include <toolkit/helper/property.hxx>
+#include <toolkit/helper/unopropertyarrayhelper.hxx>
+#include <toolkit/controls/stdtabcontroller.hxx>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/WindowAttribute.hpp>
+#include <com/sun/star/awt/UnoControlDialogModelProvider.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/sequence.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/outdev.hxx>
+
+#include <toolkit/helper/vclunohelper.hxx>
+#include <unotools/ucbstreamhelper.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/image.hxx>
+#include <toolkit/controls/geometrycontrolmodel.hxx>
+
+#include <map>
+#include <algorithm>
+#include <functional>
+#include "tools/urlobj.hxx"
+#include "osl/file.hxx"
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+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;
+
+////HELPER
+::rtl::OUString getPhysicalLocation( const ::com::sun::star::uno::Any& rbase, const ::com::sun::star::uno::Any& rUrl );
+
+// ----------------------------------------------------
+// class TabPageModel
+// ----------------------------------------------------
+
+//TabPageModel::TabPageModel()
+//{
+//}
+//TabPageModel::TabPageModel( uno::Reference< uno::XComponentContext > const & xCompContext)
+//{
+// (void) xCompContext;
+//}
+//
+//TabPageModel::~TabPageModel()
+//{
+//}
+//
+//////----- XInitialization -------------------------------------------------------------------
+//void SAL_CALL TabPageModel::initialize (const Sequence<Any>& rArguments)
+//{
+// sal_Int16 nPageId;
+// if ( rArguments.getLength() == 1 )
+// {
+// if ( !( rArguments[ 0 ] >>= nPageId ))
+// throw lang::IllegalArgumentException();
+// m_nTabPageId = nPageId;
+// }
+// else
+// m_nTabPageId = -1;
+//}
+//::sal_Int16 SAL_CALL TabPageModel::getTabPageID() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_nTabPageId;
+//}
+//::sal_Bool SAL_CALL TabPageModel::getEnabled() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_bEnabled;
+//}
+//void SAL_CALL TabPageModel::setEnabled( ::sal_Bool _enabled ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_bEnabled = _enabled;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getTitle() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sTitle;
+//}
+//void SAL_CALL TabPageModel::setTitle( const ::rtl::OUString& _title ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sTitle = _title;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getImageURL() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sImageURL;
+//}
+//void SAL_CALL TabPageModel::setImageURL( const ::rtl::OUString& _imageurl ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sImageURL = _imageurl;
+//}
+//::rtl::OUString SAL_CALL TabPageModel::getTooltip() throw (::com::sun::star::uno::RuntimeException)
+//{
+// return m_sTooltip;
+//}
+//void SAL_CALL TabPageModel::setTooltip( const ::rtl::OUString& _tooltip ) throw (::com::sun::star::uno::RuntimeException)
+//{
+// m_sTooltip = _tooltip;
+//}
+
+// ----------------------------------------------------
+// class UnoControlTabPageModel
+// ----------------------------------------------------
+UnoControlTabPageModel::UnoControlTabPageModel( Reference< XMultiServiceFactory > const & i_factory )
+ :ControlModelContainerBase( i_factory )
+{
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_TITLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ ImplRegisterProperty( BASEPROPERTY_IMAGEURL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLED );
+}
+
+::rtl::OUString UnoControlTabPageModel::getServiceName( ) throw(RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPageModel );
+}
+
+Any UnoControlTabPageModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ Any aAny;
+
+ switch ( nPropId )
+ {
+ case BASEPROPERTY_DEFAULTCONTROL:
+ aAny <<= ::rtl::OUString::createFromAscii( szServiceName_UnoControlTabPage );
+ break;
+ default:
+ aAny = UnoControlModel::ImplGetDefaultValue( nPropId );
+ }
+
+ return aAny;
+}
+
+::cppu::IPropertyArrayHelper& UnoControlTabPageModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+// beans::XMultiPropertySet
+uno::Reference< beans::XPropertySetInfo > UnoControlTabPageModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+////----- XInitialization -------------------------------------------------------------------
+void SAL_CALL UnoControlTabPageModel::initialize (const Sequence<Any>& rArguments)
+ throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
+{
+ sal_Int16 nPageId = -1;
+ if ( rArguments.getLength() == 1 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ }
+ else if ( rArguments.getLength() == 2 )
+ {
+ if ( !( rArguments[ 0 ] >>= nPageId ))
+ throw lang::IllegalArgumentException();
+ m_nTabPageId = nPageId;
+ ::rtl::OUString sURL;
+ if ( !( rArguments[ 1 ] >>= sURL ))
+ throw lang::IllegalArgumentException();
+ Reference<container::XNameContainer > xDialogModel = awt::UnoControlDialogModelProvider::create( maContext.getUNOContext(),sURL);
+ if ( xDialogModel.is() )
+ {
+ Sequence< ::rtl::OUString> aNames = xDialogModel->getElementNames();
+ const ::rtl::OUString* pIter = aNames.getConstArray();
+ const ::rtl::OUString* pEnd = pIter + aNames.getLength();
+ for(;pIter != pEnd;++pIter)
+ {
+ try
+ {
+ Any aElement(xDialogModel->getByName(*pIter));
+ xDialogModel->removeByName(*pIter);
+ insertByName(*pIter,aElement);
+ }
+ catch(const Exception& ex)
+ {
+ (void)ex;
+ }
+ }
+ Reference<XPropertySet> xDialogProp(xDialogModel,UNO_QUERY);
+ if ( xDialogProp.is() )
+ {
+ static const ::rtl::OUString s_sResourceResolver(RTL_CONSTASCII_USTRINGPARAM("ResourceResolver"));
+ Reference<XPropertySet> xThis(*this,UNO_QUERY);
+ xThis->setPropertyValue(s_sResourceResolver,xDialogProp->getPropertyValue(s_sResourceResolver));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_TITLE),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_TITLE)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_IMAGEURL)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPTEXT)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_ENABLED)));
+ xThis->setPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL),xDialogProp->getPropertyValue(GetPropertyName(BASEPROPERTY_HELPURL)));
+ }
+ }
+ }
+ else
+ m_nTabPageId = -1;
+}
+//===== Service ===============================================================
+::rtl::OUString UnoControlTabPageModel_getImplementationName (void) throw(RuntimeException)
+{
+ return rtl::OUString::createFromAscii("com.sun.star.awt.tab.UnoControlTabPageModel");
+}
+
+Sequence<rtl::OUString> SAL_CALL UnoControlTabPageModel_getSupportedServiceNames (void)
+ throw (RuntimeException)
+{
+ static const ::rtl::OUString sServiceName(
+ ::rtl::OUString::createFromAscii("com.sun.star.awt.tab.UnoControlTabPageModel"));
+ return Sequence<rtl::OUString>(&sServiceName, 1);
+}
+//=============================================================================
+// = class UnoControlTabPage
+// ============================================================================
+
+UnoControlTabPage::UnoControlTabPage( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlTabPage_Base( i_factory )
+ ,m_bWindowListener(false)
+{
+ maComponentInfos.nWidth = 280;
+ maComponentInfos.nHeight = 400;
+}
+UnoControlTabPage::~UnoControlTabPage()
+{
+}
+
+::rtl::OUString UnoControlTabPage::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "TabPageModel" );
+}
+
+void UnoControlTabPage::dispose() throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >( this );
+ ControlContainerBase::dispose();
+}
+
+void SAL_CALL UnoControlTabPage::disposing( const EventObject& Source )throw(RuntimeException)
+{
+ ControlContainerBase::disposing( Source );
+}
+
+void UnoControlTabPage::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException)
+{
+ vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ ImplUpdateResourceResolver();
+
+ UnoControlContainer::createPeer( rxToolkit, rParentPeer );
+
+ Reference < tab::XTabPage > xTabPage( getPeer(), UNO_QUERY );
+ if ( xTabPage.is() )
+ {
+ if ( !m_bWindowListener )
+ {
+ Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY );
+ addWindowListener( xWL );
+ m_bWindowListener = true;
+ }
+ }
+}
+
+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 UnoControlTabPage::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 UnoControlTabPage::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 UnoControlTabPage::windowShown( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
+
+void SAL_CALL UnoControlTabPage::windowHidden( const ::com::sun::star::lang::EventObject& e )
+throw (::com::sun::star::uno::RuntimeException)
+{
+ (void)e;
+}
diff --git a/toolkit/source/controls/tkscrollbar.cxx b/toolkit/source/controls/tkscrollbar.cxx
new file mode 100644
index 000000000000..f75183186610
--- /dev/null
+++ b/toolkit/source/controls/tkscrollbar.cxx
@@ -0,0 +1,296 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ {
+ 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( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,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..90f56d5ad4bd
--- /dev/null
+++ b/toolkit/source/controls/tksimpleanimation.cxx
@@ -0,0 +1,191 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ {
+ 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() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControlModel );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoSimpleAnimationControlModel );
+ return aServices;
+ }
+
+ //====================================================================
+ //= UnoSimpleAnimationControl
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoSimpleAnimationControl::UnoSimpleAnimationControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoSimpleAnimationControl_Base( i_factory )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ::rtl::OUString UnoSimpleAnimationControl::GetComponentServiceName()
+ {
+ return ::rtl::OUString::createFromAscii( "SimpleAnimation" );
+ }
+
+ //--------------------------------------------------------------------
+ ::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( UnoSimpleAnimationControl_Base::getSupportedServiceNames() );
+ aServices.realloc( aServices.getLength() + 1 );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoSimpleAnimationControl );
+ return aServices;
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSimpleAnimationControl::start() throw ( uno::RuntimeException )
+ {
+ uno::Reference< XSimpleAnimation > xAnimation;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xAnimation.set( getPeer(), uno::UNO_QUERY );
+ }
+ if ( xAnimation.is() )
+ xAnimation->start();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL UnoSimpleAnimationControl::stop() throw ( uno::RuntimeException )
+ {
+ uno::Reference< XSimpleAnimation > xAnimation;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xAnimation.set( 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 )
+ {
+ uno::Reference< XSimpleAnimation > xAnimation;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xAnimation.set( 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..9396aea43290
--- /dev/null
+++ b/toolkit/source/controls/tkspinbutton.cxx
@@ -0,0 +1,352 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ {
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,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..8a1927a732cb
--- /dev/null
+++ b/toolkit/source/controls/tkthrobber.cxx
@@ -0,0 +1,201 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+ {
+ ImplRegisterProperty( BASEPROPERTY_BORDER );
+ ImplRegisterProperty( BASEPROPERTY_BORDERCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_BACKGROUNDCOLOR );
+ ImplRegisterProperty( BASEPROPERTY_DEFAULTCONTROL );
+ ImplRegisterProperty( BASEPROPERTY_ENABLEVISIBLE );
+ ImplRegisterProperty( BASEPROPERTY_HELPTEXT );
+ ImplRegisterProperty( BASEPROPERTY_HELPURL );
+ }
+
+ //--------------------------------------------------------------------
+ ::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 ) );
+ case BASEPROPERTY_BORDER:
+ return uno::makeAny( (sal_Int16) 0 );
+ 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() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControlModel );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_UnoThrobberControlModel );
+ return aServices;
+ }
+
+ //====================================================================
+ //= UnoThrobberControl
+ //====================================================================
+ //--------------------------------------------------------------------
+ UnoThrobberControl::UnoThrobberControl( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ ::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() + 2 );
+ aServices[ aServices.getLength() - 2 ] = ::rtl::OUString::createFromAscii( szServiceName_UnoThrobberControl );
+ aServices[ aServices.getLength() - 1 ] = ::rtl::OUString::createFromAscii( szServiceName2_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/treecontrol.cxx b/toolkit/source/controls/tree/treecontrol.cxx
new file mode 100644
index 000000000000..d2c66c64b41a
--- /dev/null
+++ b/toolkit/source/controls/tree/treecontrol.cxx
@@ -0,0 +1,513 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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_TABSTOP );
+ 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_ROW_HEIGHT );
+ ImplRegisterProperty( BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING );
+ ImplRegisterProperty( BASEPROPERTY_HIDEINACTIVESELECTION );
+}
+
+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_ROW_HEIGHT:
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+: UnoTreeControl_Base( i_factory )
+, 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);
+}
+
+// -------------------------------------------------------------------
+
+awt::Rectangle SAL_CALL UnoTreeControl::getNodeRect( const Reference< XTreeNode >& Node ) throw (IllegalArgumentException, RuntimeException)
+{
+ return Reference< XTreeControl >( getPeer(), UNO_QUERY_THROW )->getNodeRect( Node );
+}
+
+// -------------------------------------------------------------------
+
+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 >& i_factory )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeControl( i_factory ) );
+}
+
+Reference< XInterface > SAL_CALL TreeControlModel_CreateInstance( const Reference< XMultiServiceFactory >& i_factory )
+{
+ return Reference < XInterface >( ( ::cppu::OWeakObject* ) new ::toolkit::UnoTreeModel( i_factory ) );
+}
+
+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..ff5ddb4e348c
--- /dev/null
+++ b/toolkit/source/controls/tree/treecontrol.hxx
@@ -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.
+ *
+ ************************************************************************/
+
+#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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ 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
+// ===================================================================
+typedef ::cppu::ImplInheritanceHelper1< UnoControlBase, ::com::sun::star::awt::tree::XTreeControl > UnoTreeControl_Base;
+class UnoTreeControl : public UnoTreeControl_Base
+{
+public:
+ UnoTreeControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory );
+ ::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 ::com::sun::star::awt::Rectangle SAL_CALL getNodeRect( 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 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..7fbac44035c6
--- /dev/null
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -0,0 +1,1621 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <comphelper/processfactory.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()
+ :maContext( ::comphelper::getProcessServiceFactory() )
+ ,maDisposeListeners( *this )
+ ,maWindowListeners( *this )
+ ,maFocusListeners( *this )
+ ,maKeyListeners( *this )
+ ,maMouseListeners( *this )
+ ,maMouseMotionListeners( *this )
+ ,maPaintListeners( *this )
+ ,maModeChangeListeners( GetMutex() )
+ ,mpData( new UnoControl_Data )
+{
+ DBG_CTOR( UnoControl, NULL );
+ OSL_ENSURE( false, "UnoControl::UnoControl: not implemented. Well, not really." );
+ // just implemented to let the various FooImplInheritanceHelper compile, you should use the
+ // version taking a service factory
+}
+
+UnoControl::UnoControl( const Reference< XMultiServiceFactory >& i_factory )
+ : maContext( i_factory )
+ , 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())
+ {
+ 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() + aSNL.getLength();
+ 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( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Point SAL_CALL UnoControl::convertPointToLogic( const awt::Point& i_Point, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertPointToLogic( i_Point, i_TargetUnit );
+ return awt::Point( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Point SAL_CALL UnoControl::convertPointToPixel( const awt::Point& i_Point, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertPointToPixel( i_Point, i_SourceUnit );
+ return awt::Point( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Size SAL_CALL UnoControl::convertSizeToLogic( const awt::Size& i_Size, ::sal_Int16 i_TargetUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertSizeToLogic( i_Size, i_TargetUnit );
+ return awt::Size( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+awt::Size SAL_CALL UnoControl::convertSizeToPixel( const awt::Size& i_Size, ::sal_Int16 i_SourceUnit ) throw (IllegalArgumentException, RuntimeException)
+{
+ Reference< XUnitConversion > xPeerConversion;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerConversion = xPeerConversion.query( getPeer() );
+ }
+ if ( xPeerConversion.is() )
+ return xPeerConversion->convertSizeToPixel( i_Size, i_SourceUnit );
+ return awt::Size( );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+uno::Reference< awt::XStyleSettings > SAL_CALL UnoControl::getStyleSettings() throw (RuntimeException)
+{
+ Reference< awt::XStyleSettingsSupplier > xPeerSupplier;
+ {
+ ::osl::MutexGuard aGuard( GetMutex() );
+ xPeerSupplier = xPeerSupplier.query( getPeer() );
+ }
+ if ( xPeerSupplier.is() )
+ return xPeerSupplier->getStyleSettings();
+ return NULL;
+}
diff --git a/toolkit/source/controls/unocontrolbase.cxx b/toolkit/source/controls/unocontrolbase.cxx
new file mode 100644
index 000000000000..4dc1412ba661
--- /dev/null
+++ b/toolkit/source/controls/unocontrolbase.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 <com/sun/star/awt/XLayoutConstrains.hpp>
+#include <com/sun/star/awt/XTextLayoutConstrains.hpp>
+
+#include <toolkit/controls/unocontrolbase.hxx>
+#include <toolkit/helper/property.hxx>
+#include <comphelper/processfactory.hxx>
+
+#include <tools/debug.hxx>
+
+// ----------------------------------------------------
+// class UnoControlBase
+// ----------------------------------------------------
+
+UnoControlBase::UnoControlBase()
+ :UnoControl( ::comphelper::getProcessServiceFactory() )
+{
+ OSL_ENSURE( false, "UnoControlBase::UnoControlBase: not implemented. Well, not really." );
+ // just implemented to let the various FooImplInheritanceHelper compile, you should use the
+ // version taking a service factory
+}
+
+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..bdbdc9aae7f1
--- /dev/null
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -0,0 +1,838 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlContainer_Base( i_factory )
+ ,maCListeners( *this )
+{
+ mpControls = new UnoControlHolderList;
+}
+
+UnoControlContainer::UnoControlContainer( const uno::Reference< lang::XMultiServiceFactory >& i_factory, const uno::Reference< awt::XWindowPeer >& xP )
+ :UnoControlContainer_Base( i_factory )
+ ,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 );
+ OSL_ENSURE(xC.is(),"Peer isn't valid. Please check!");
+
+ 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..66948ce095d1
--- /dev/null
+++ b/toolkit/source/controls/unocontrolcontainermodel.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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..7a2742abae57
--- /dev/null
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -0,0 +1,1480 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 <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 <comphelper/extract.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()
+ :UnoControlModel_Base()
+ ,MutexAndBroadcastHelper()
+ ,OPropertySetHelper( BrdcstHelper )
+ ,maDisposeListeners( *this )
+ ,maContext( ::comphelper::getProcessServiceFactory() )
+{
+ OSL_ENSURE( false, "UnoControlModel::UnoControlModel: not implemented. Well, not really." );
+ // just implemented to let the various FooImplInheritanceHelper compile, you should use the
+ // version taking a service factory
+ mpData = new ImplPropertyTable;
+}
+
+UnoControlModel::UnoControlModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel_Base()
+ ,MutexAndBroadcastHelper()
+ ,OPropertySetHelper( BrdcstHelper )
+ ,maDisposeListeners( *this )
+ ,maContext( i_factory )
+{
+ // 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 )
+ : UnoControlModel_Base()
+ , MutexAndBroadcastHelper()
+ , OPropertySetHelper( BrdcstHelper )
+ , maDisposeListeners( *this )
+ , maContext( rModel.maContext )
+{
+ 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;
+}
+
+::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_ITEM_SEPARATOR_POS:
+ 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_MULTISELECTION_SIMPLEMODE:
+ 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( maContext.getLegacyServiceFactory(), 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)
+{
+ Any aRet = UnoControlModel_Base::queryAggregation( rType );
+ if ( !aRet.hasValue() )
+ aRet = ::cppu::OPropertySetHelper::queryInterface( rType );
+ return aRet;
+}
+
+// ::com::sun::star::lang::XUnoTunnel
+IMPL_XUNOTUNNEL( UnoControlModel )
+
+// XInterface
+IMPLEMENT_FORWARD_REFCOUNT( UnoControlModel, UnoControlModel_Base )
+
+// ::com::sun::star::lang::XTypeProvider
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( UnoControlModel, UnoControlModel_Base, ::cppu::OPropertySetHelper )
+
+
+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 );
+
+ BrdcstHelper.aLC.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
+ {
+ sal_Bool bConverted = sal_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)
+{
+ // Fehlt: Die gefakten Einzelproperties des FontDescriptors...
+
+ ImplControlProperty* pProp = mpData->Get( nPropId );
+ ENSURE_OR_RETURN_VOID( pProp, "UnoControlModel::setFastPropertyValue_NoBroadcast: invalid property id!" );
+
+ 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!" );
+ pProp->SetValue( rValue );
+}
+
+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..210fc08a2680
--- /dev/null
+++ b/toolkit/source/controls/unocontrols.cxx
@@ -0,0 +1,4396 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/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>
+#include <functional>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::uno::Reference;
+using namespace ::toolkit;
+
+#define IMPL_SERVICEINFO_DERIVED( ImplName, BaseClass, ServiceName ) \
+ ::rtl::OUString SAL_CALL ImplName::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii( "stardiv.Toolkit." #ImplName ); } \
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ImplName::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; \
+ } \
+
+
+
+// ----------------------------------------------------
+// class UnoControlEditModel
+// ----------------------------------------------------
+UnoControlEditModel::UnoControlEditModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,maTextListeners( *this )
+ ,mnMaxTextLen( 0 )
+ ,mbSetTextInPeer( sal_False )
+ ,mbSetMaxTextLenInPeer( sal_False )
+ ,mbHasTextProperty( sal_False )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+ mnMaxTextLen = 0;
+ mbSetMaxTextLenInPeer = sal_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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoEditControl( i_factory )
+{
+}
+
+::rtl::OUString UnoFileControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "filecontrol" );
+}
+
+// ----------------------------------------------------
+// class GraphicControlModel
+// ----------------------------------------------------
+uno::Any GraphicControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const
+{
+ if ( nPropId == BASEPROPERTY_GRAPHIC )
+ return uno::makeAny( uno::Reference< graphic::XGraphic >() );
+
+ return UnoControlModel::ImplGetDefaultValue( nPropId );
+}
+ uno::Reference< graphic::XGraphic > GraphicControlModel::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
+ mxGrfObj = graphic::GraphicObject::createWithId( maContext.getUNOContext(), sID );
+ }
+ else // linked
+ mxGrfObj = NULL; // release the GraphicObject
+
+ if ( !_rURL.getLength() )
+ return xGraphic;
+
+ try
+ {
+ uno::Reference< graphic::XGraphicProvider > xProvider;
+ if ( maContext.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 GraphicControlModel::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 );
+ setDependentFastPropertyValue( BASEPROPERTY_GRAPHIC, uno::makeAny( getGraphicFromURL_nothrow( sImageURL ) ) );
+ mbAdjustingGraphic = false;
+ }
+ break;
+
+ case BASEPROPERTY_GRAPHIC:
+ if ( !mbAdjustingGraphic && ImplHasProperty( BASEPROPERTY_IMAGEURL ) )
+ {
+ mbAdjustingGraphic = true;
+ setDependentFastPropertyValue( 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 );
+ setDependentFastPropertyValue( 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 );
+ setDependentFastPropertyValue( BASEPROPERTY_IMAGEALIGN, uno::makeAny( getCompatibleImageAlign( translateImagePosition( nUNOValue ) ) ) );
+ mbAdjustingImagePosition = false;
+ }
+ break;
+ }
+ }
+ catch( const ::com::sun::star::uno::Exception& )
+ {
+ OSL_ENSURE( sal_False, "GraphicControlModel::setFastPropertyValue_NoBroadcast: caught an exception while aligning the ImagePosition/ImageAlign properties!" );
+ mbAdjustingImagePosition = sal_False;
+ }
+}
+
+// ----------------------------------------------------
+// class UnoControlButtonModel
+// ----------------------------------------------------
+UnoControlButtonModel::UnoControlButtonModel( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
+{
+ 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 GraphicControlModel::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( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoButtonControl_Base( i_factory )
+ ,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 );
+ UnoControlBase::dispose();
+}
+
+void UnoButtonControl::createPeer( const uno::Reference< awt::XToolkit > & rxToolkit, const uno::Reference< awt::XWindowPeer > & rParentPeer ) throw(uno::RuntimeException)
+{
+ UnoControlBase::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)
+{
+ UnoControlBase::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( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
+ ,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 GraphicControlModel::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)
+{
+ GraphicControlModel::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 );
+ setDependentFastPropertyValue( 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 );
+ setDependentFastPropertyValue( 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoImageControlControl_Base( i_factory )
+ ,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( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
+{
+ 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 GraphicControlModel::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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoRadioButtonControl_Base( i_factory )
+ ,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 );
+ UnoControlBase::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)
+{
+ UnoControlBase::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( const Reference< XMultiServiceFactory >& i_factory )
+ :GraphicControlModel( i_factory )
+{
+ 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 GraphicControlModel::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( const uno::Reference< lang::XMultiServiceFactory >& i_factory )
+ :UnoCheckBoxControl_Base( i_factory )
+ ,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 );
+ UnoControlBase::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)
+{
+ UnoControlBase::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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+ ,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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+{
+ 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;
+}
+
+// =====================================================================================================================
+// = UnoControlListBoxModel_Data
+// =====================================================================================================================
+struct ListItem
+{
+ ::rtl::OUString ItemText;
+ ::rtl::OUString ItemImageURL;
+ Any ItemData;
+
+ ListItem()
+ :ItemText()
+ ,ItemImageURL()
+ ,ItemData()
+ {
+ }
+
+ ListItem( const ::rtl::OUString& i_rItemText )
+ :ItemText( i_rItemText )
+ ,ItemImageURL()
+ ,ItemData()
+ {
+ }
+};
+
+typedef beans::Pair< ::rtl::OUString, ::rtl::OUString > UnoListItem;
+
+struct StripItemData : public ::std::unary_function< ListItem, UnoListItem >
+{
+ UnoListItem operator()( const ListItem& i_rItem )
+ {
+ return UnoListItem( i_rItem.ItemText, i_rItem.ItemImageURL );
+ }
+};
+
+struct UnoControlListBoxModel_Data
+{
+ UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl )
+ :m_bSettingLegacyProperty( false )
+ ,m_rAntiImpl( i_rAntiImpl )
+ ,m_aListItems()
+ {
+ }
+
+ sal_Int32 getItemCount() const { return sal_Int32( m_aListItems.size() ); }
+
+ const ListItem& getItem( const sal_Int32 i_nIndex ) const
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ return m_aListItems[ i_nIndex ];
+ }
+
+ ListItem& getItem( const sal_Int32 i_nIndex )
+ {
+ return const_cast< ListItem& >( static_cast< const UnoControlListBoxModel_Data* >( this )->getItem( i_nIndex ) );
+ }
+
+ ListItem& insertItem( const sal_Int32 i_nIndex )
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex > sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ return *m_aListItems.insert( m_aListItems.begin() + i_nIndex, ListItem() );
+ }
+
+ Sequence< UnoListItem > getAllItems() const
+ {
+ Sequence< UnoListItem > aItems( sal_Int32( m_aListItems.size() ) );
+ ::std::transform( m_aListItems.begin(), m_aListItems.end(), aItems.getArray(), StripItemData() );
+ return aItems;
+ }
+
+ void copyItems( const UnoControlListBoxModel_Data& i_copySource )
+ {
+ m_aListItems = i_copySource.m_aListItems;
+ }
+
+ void setAllItems( const ::std::vector< ListItem >& i_rItems )
+ {
+ m_aListItems = i_rItems;
+ }
+
+ void removeItem( const sal_Int32 i_nIndex )
+ {
+ if ( ( i_nIndex < 0 ) || ( i_nIndex >= sal_Int32( m_aListItems.size() ) ) )
+ throw IndexOutOfBoundsException( ::rtl::OUString(), m_rAntiImpl );
+ m_aListItems.erase( m_aListItems.begin() + i_nIndex );
+ }
+
+ void removeAllItems()
+ {
+ ::std::vector< ListItem > aEmpty;
+ m_aListItems.swap( aEmpty );
+ }
+
+public:
+ bool m_bSettingLegacyProperty;
+
+private:
+ UnoControlListBoxModel& m_rAntiImpl;
+ ::std::vector< ListItem > m_aListItems;
+};
+
+// =====================================================================================================================
+// = UnoControlListBoxModel
+// =====================================================================================================================
+// ---------------------------------------------------------------------------------------------------------------------
+UnoControlListBoxModel::UnoControlListBoxModel( const Reference< XMultiServiceFactory >& i_factory, ConstructorMode const i_mode )
+ :UnoControlListBoxModel_Base( i_factory )
+ ,m_pData( new UnoControlListBoxModel_Data( *this ) )
+ ,m_aItemListListeners( GetMutex() )
+{
+ if ( i_mode == ConstructDefault )
+ {
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXListBox );
+ }
+}
+// ---------------------------------------------------------------------------------------------------------------------
+UnoControlListBoxModel::UnoControlListBoxModel( const UnoControlListBoxModel& i_rSource )
+ :UnoControlListBoxModel_Base( i_rSource )
+ ,m_pData( new UnoControlListBoxModel_Data( *this ) )
+ ,m_aItemListListeners( GetMutex() )
+{
+ m_pData->copyItems( *i_rSource.m_pData );
+}
+UnoControlListBoxModel::~UnoControlListBoxModel()
+{
+}
+IMPL_SERVICEINFO_DERIVED( UnoControlListBoxModel, UnoControlModel, szServiceName2_UnoControlListBoxModel )
+// ---------------------------------------------------------------------------------------------------------------------
+::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;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+namespace
+{
+ struct CreateListItem : public ::std::unary_function< ::rtl::OUString, ListItem >
+ {
+ ListItem operator()( const ::rtl::OUString& i_rItemText )
+ {
+ return ListItem( i_rItemText );
+ }
+ };
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
+{
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ if ( nHandle == BASEPROPERTY_STRINGITEMLIST )
+ {
+ // reset selection
+ uno::Sequence<sal_Int16> aSeq;
+ uno::Any aAny;
+ aAny <<= aSeq;
+ setDependentFastPropertyValue( BASEPROPERTY_SELECTEDITEMS, aAny );
+
+ if ( !m_pData->m_bSettingLegacyProperty )
+ {
+ // synchronize the legacy StringItemList property with our list items
+ Sequence< ::rtl::OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ ::std::vector< ListItem > aItems( aStringItemList.getLength() );
+ ::std::transform(
+ aStringItemList.getConstArray(),
+ aStringItemList.getConstArray() + aStringItemList.getLength(),
+ aItems.begin(),
+ CreateListItem()
+ );
+ m_pData->setAllItems( aItems );
+
+ // since an XItemListListener does not have a "all items modified" or some such method,
+ // we simulate this by notifying removal of all items, followed by insertion of all new
+ // items
+ lang::EventObject aEvent;
+ aEvent.Source = *this;
+ m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
+ // TODO: OPropertySetHelper calls into this method with the mutex locked ...
+ // which is wrong for the above notifications ...
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+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 );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::sal_Int32 SAL_CALL UnoControlListBoxModel::getItemCount() throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return m_pData->getItemCount();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItem( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleInsert( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+
+ impl_handleInsert( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::insertItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->insertItem( i_nPosition ) );
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleInsert( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeItem( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ m_pData->removeItem( i_nPosition );
+
+ impl_handleRemove( i_nPosition, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeAllItems( ) throw (::com::sun::star::uno::RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ m_pData->removeAllItems();
+
+ impl_handleRemove( -1, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemText( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+
+ impl_handleModify( i_nPosition, i_rItemText, ::boost::optional< ::rtl::OUString >(), aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleModify( i_nPosition, ::boost::optional< ::rtl::OUString >(), i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemTextAndImage( ::sal_Int32 i_nPosition, const ::rtl::OUString& i_rItemText, const ::rtl::OUString& i_rItemImageURL ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ // SYNCHRONIZED ----->
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemText = i_rItemText;
+ rItem.ItemImageURL = i_rItemImageURL;
+
+ impl_handleModify( i_nPosition, i_rItemText, i_rItemImageURL, aGuard );
+ // <----- SYNCHRONIZED
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::setItemData( ::sal_Int32 i_nPosition, const Any& i_rDataValue ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ rItem.ItemData = i_rDataValue;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemText( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemText;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL UnoControlListBoxModel::getItemImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemImageURL;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+beans::Pair< ::rtl::OUString, ::rtl::OUString > SAL_CALL UnoControlListBoxModel::getItemTextAndImage( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return beans::Pair< ::rtl::OUString, ::rtl::OUString >( rItem.ItemText, rItem.ItemImageURL );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Any SAL_CALL UnoControlListBoxModel::getItemData( ::sal_Int32 i_nPosition ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ ::osl::ClearableMutexGuard aGuard( GetMutex() );
+ const ListItem& rItem( m_pData->getItem( i_nPosition ) );
+ return rItem.ItemData;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+Sequence< beans::Pair< ::rtl::OUString, ::rtl::OUString > > SAL_CALL UnoControlListBoxModel::getAllItems( ) throw (RuntimeException)
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+ return m_pData->getAllItems();
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::addItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
+{
+ if ( i_Listener.is() )
+ m_aItemListListeners.addInterface( i_Listener );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void SAL_CALL UnoControlListBoxModel::removeItemListListener( const uno::Reference< awt::XItemListListener >& i_Listener ) throw (uno::RuntimeException)
+{
+ if ( i_Listener.is() )
+ m_aItemListListeners.removeInterface( i_Listener );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_getStringItemList( ::std::vector< ::rtl::OUString >& o_rStringItems ) const
+{
+ Sequence< ::rtl::OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ o_rStringItems.resize( size_t( aStringItemList.getLength() ) );
+ ::std::copy(
+ aStringItemList.getConstArray(),
+ aStringItemList.getConstArray() + aStringItemList.getLength(),
+ o_rStringItems.begin()
+ );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_setStringItemList_nolck( const ::std::vector< ::rtl::OUString >& i_rStringItems )
+{
+ Sequence< ::rtl::OUString > aStringItems( i_rStringItems.size() );
+ ::std::copy(
+ i_rStringItems.begin(),
+ i_rStringItems.end(),
+ aStringItems.getArray()
+ );
+ m_pData->m_bSettingLegacyProperty = true;
+ try
+ {
+ setFastPropertyValue( BASEPROPERTY_STRINGITEMLIST, uno::makeAny( aStringItems ) );
+ }
+ catch( const Exception& )
+ {
+ m_pData->m_bSettingLegacyProperty = false;
+ throw;
+ }
+ m_pData->m_bSettingLegacyProperty = false;
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleInsert( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ OSL_ENSURE( size_t( i_nItemPosition ) <= aStringItems.size(), "UnoControlListBoxModel::impl_handleInsert" );
+ if ( size_t( i_nItemPosition ) <= aStringItems.size() )
+ {
+ const ::rtl::OUString sItemText( !!i_rItemText ? *i_rItemText : ::rtl::OUString() );
+ aStringItems.insert( aStringItems.begin() + i_nItemPosition, sItemText );
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+
+ // notify ItemListListeners
+ impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemInserted );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleRemove( const sal_Int32 i_nItemPosition, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ const bool bAllItems = ( i_nItemPosition < 0 );
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ if ( !bAllItems )
+ {
+ OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleRemove" );
+ if ( size_t( i_nItemPosition ) < aStringItems.size() )
+ {
+ aStringItems.erase( aStringItems.begin() + i_nItemPosition );
+ }
+ }
+ else
+ {
+ aStringItems.resize(0);
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+
+ // notify ItemListListeners
+ if ( bAllItems )
+ {
+ EventObject aEvent( *this );
+ m_aItemListListeners.notifyEach( &XItemListListener::allItemsRemoved, aEvent );
+ }
+ else
+ {
+ impl_notifyItemListEvent_nolck( i_nItemPosition, ::boost::optional< ::rtl::OUString >(), ::boost::optional< ::rtl::OUString >(),
+ &XItemListListener::listItemRemoved );
+ }
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_handleModify( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL, ::osl::ClearableMutexGuard& i_rClearBeforeNotify )
+{
+ // SYNCHRONIZED ----->
+ if ( !!i_rItemText )
+ {
+ // sync with legacy StringItemList property
+ ::std::vector< ::rtl::OUString > aStringItems;
+ impl_getStringItemList( aStringItems );
+ OSL_ENSURE( size_t( i_nItemPosition ) < aStringItems.size(), "UnoControlListBoxModel::impl_handleModify" );
+ if ( size_t( i_nItemPosition ) < aStringItems.size() )
+ {
+ aStringItems[ i_nItemPosition] = *i_rItemText;
+ }
+
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ impl_setStringItemList_nolck( aStringItems );
+ }
+ else
+ {
+ i_rClearBeforeNotify.clear();
+ // <----- SYNCHRONIZED
+ }
+
+ // notify ItemListListeners
+ impl_notifyItemListEvent_nolck( i_nItemPosition, i_rItemText, i_rItemImageURL, &XItemListListener::listItemModified );
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+void UnoControlListBoxModel::impl_notifyItemListEvent_nolck( const sal_Int32 i_nItemPosition, const ::boost::optional< ::rtl::OUString >& i_rItemText,
+ const ::boost::optional< ::rtl::OUString >& i_rItemImageURL,
+ void ( SAL_CALL XItemListListener::*NotificationMethod )( const ItemListEvent& ) )
+{
+ ItemListEvent aEvent;
+ aEvent.Source = *this;
+ aEvent.ItemPosition = i_nItemPosition;
+ if ( !!i_rItemText )
+ {
+ aEvent.ItemText.IsPresent = sal_True;
+ aEvent.ItemText.Value = *i_rItemText;
+ }
+ if ( !!i_rItemImageURL )
+ {
+ aEvent.ItemImageURL.IsPresent = sal_True;
+ aEvent.ItemImageURL.Value = *i_rItemImageURL;
+ }
+
+ m_aItemListListeners.notifyEach( NotificationMethod, aEvent );
+}
+
+// ----------------------------------------------------
+// class UnoListBoxControl
+// ----------------------------------------------------
+UnoListBoxControl::UnoListBoxControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoListBoxControl_Base( i_factory )
+ ,maActionListeners( *this )
+ ,maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+
+::rtl::OUString UnoListBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "listbox" );
+}
+IMPL_SERVICEINFO_DERIVED( UnoListBoxControl, UnoControlBase, szServiceName2_UnoControlListBox )
+
+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::updateFromModel()
+{
+ UnoControlBase::updateFromModel();
+
+ Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoListBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
+
+ EventObject aEvent( getModel() );
+ xItemListListener->itemListChanged( aEvent );
+
+ // notify the change of the SelectedItems property, again. While our base class, in updateFromModel,
+ // already did this, our peer(s) can only legitimately set the selection after they have the string
+ // item list, which we just notified with the itemListChanged call.
+ const ::rtl::OUString sSelectedItemsPropName( GetPropertyName( BASEPROPERTY_SELECTEDITEMS ) );
+ ImplSetPeerProperty( sSelectedItemsPropName, ImplGetPropertyValue( sSelectedItemsPropName ) );
+}
+
+void UnoListBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
+ if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
+ // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
+ // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
+ // will be forwarded to the peer, which will update itself accordingly.
+ return;
+
+ UnoControl::ImplSetPeerProperty( rPropName, rVal );
+}
+
+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 );
+}
+
+sal_Bool SAL_CALL UnoListBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
+ OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoListBoxControl::setModel: illegal old model!" );
+ const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
+ OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoListBoxControl::setModel: illegal new model!" );
+
+ if ( !UnoListBoxControl_Base::setModel( i_rModel ) )
+ return sal_False;
+
+ if ( xOldItems.is() )
+ xOldItems->removeItemListListener( this );
+ if ( xNewItems.is() )
+ xNewItems->addItemListListener( this );
+
+ return sal_True;
+}
+
+void SAL_CALL UnoListBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemInserted: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemInserted( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::listItemModified: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemModified( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::allItemsRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->allItemsRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoListBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoListBoxControl::itemListChanged: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->itemListChanged( i_rEvent );
+}
+ActionListenerMultiplexer& UnoListBoxControl::getActionListeners()
+{
+ return maActionListeners;
+}
+ItemListenerMultiplexer& UnoListBoxControl::getItemListeners()
+{
+ return maItemListeners;
+}
+// ----------------------------------------------------
+// class UnoControlComboBoxModel
+// ----------------------------------------------------
+UnoControlComboBoxModel::UnoControlComboBoxModel( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlListBoxModel( i_factory, ConstructWithoutProperties )
+{
+ UNO_CONTROL_MODEL_REGISTER_PROPERTIES( VCLXComboBox );
+}
+
+IMPL_SERVICEINFO_DERIVED( UnoControlComboBoxModel, UnoControlModel, szServiceName2_UnoControlComboBoxModel )
+
+uno::Reference< beans::XPropertySetInfo > UnoControlComboBoxModel::getPropertySetInfo( ) throw(uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+// ---------------------------------------------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& UnoControlComboBoxModel::getInfoHelper()
+{
+ static UnoPropertyArrayHelper* pHelper = NULL;
+ if ( !pHelper )
+ {
+ uno::Sequence<sal_Int32> aIDs = ImplGetPropertyIds();
+ pHelper = new UnoPropertyArrayHelper( aIDs );
+ }
+ return *pHelper;
+}
+
+
+::rtl::OUString UnoControlComboBoxModel::getServiceName() throw(::com::sun::star::uno::RuntimeException)
+{
+ return ::rtl::OUString::createFromAscii( szServiceName_UnoControlComboBoxModel );
+}
+void SAL_CALL UnoControlComboBoxModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const uno::Any& rValue ) throw (uno::Exception)
+{
+ UnoControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
+
+ if ( nHandle == BASEPROPERTY_STRINGITEMLIST && !m_pData->m_bSettingLegacyProperty)
+ {
+ // synchronize the legacy StringItemList property with our list items
+ Sequence< ::rtl::OUString > aStringItemList;
+ Any aPropValue;
+ getFastPropertyValue( aPropValue, BASEPROPERTY_STRINGITEMLIST );
+ OSL_VERIFY( aPropValue >>= aStringItemList );
+
+ ::std::vector< ListItem > aItems( aStringItemList.getLength() );
+ ::std::transform(
+ aStringItemList.getConstArray(),
+ aStringItemList.getConstArray() + aStringItemList.getLength(),
+ aItems.begin(),
+ CreateListItem()
+ );
+ m_pData->setAllItems( aItems );
+
+ // since an XItemListListener does not have a "all items modified" or some such method,
+ // we simulate this by notifying removal of all items, followed by insertion of all new
+ // items
+ lang::EventObject aEvent;
+ aEvent.Source = *this;
+ m_aItemListListeners.notifyEach( &XItemListListener::itemListChanged, aEvent );
+ // TODO: OPropertySetHelper calls into this method with the mutex locked ...
+ // which is wrong for the above notifications ...
+ }
+}
+
+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 );
+}
+
+// ----------------------------------------------------
+// class UnoComboBoxControl
+// ----------------------------------------------------
+UnoComboBoxControl::UnoComboBoxControl( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoEditControl( i_factory )
+ ,maActionListeners( *this )
+ ,maItemListeners( *this )
+{
+ maComponentInfos.nWidth = 100;
+ maComponentInfos.nHeight = 12;
+}
+IMPL_SERVICEINFO_DERIVED( UnoComboBoxControl, UnoEditControl, szServiceName2_UnoControlComboBox )
+
+::rtl::OUString UnoComboBoxControl::GetComponentServiceName()
+{
+ return ::rtl::OUString::createFromAscii( "combobox" );
+}
+
+void UnoComboBoxControl::dispose() throw(uno::RuntimeException)
+{
+ lang::EventObject aEvt;
+ aEvt.Source = (::cppu::OWeakObject*)this;
+ maActionListeners.disposeAndClear( aEvt );
+ maItemListeners.disposeAndClear( aEvt );
+ UnoControl::dispose();
+}
+uno::Any UnoComboBoxControl::queryAggregation( const uno::Type & rType ) throw(uno::RuntimeException)
+{
+ uno::Any aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XComboBox*, this ) );
+ if ( !aRet.hasValue() )
+ {
+ aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XItemListener*, this ) );
+ if ( !aRet.hasValue() )
+ {
+ aRet = ::cppu::queryInterface( rType,
+ SAL_STATIC_CAST( awt::XItemListListener*, this ) );
+ }
+ }
+ return (aRet.hasValue() ? aRet : UnoEditControl::queryAggregation( rType ));
+}
+// lang::XTypeProvider
+IMPL_XTYPEPROVIDER_START( UnoComboBoxControl )
+ getCppuType( ( uno::Reference< awt::XComboBox>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XItemListener>* ) NULL ),
+ getCppuType( ( uno::Reference< awt::XItemListListener>* ) NULL ),
+ UnoEditControl::getTypes()
+IMPL_XTYPEPROVIDER_END
+
+void UnoComboBoxControl::updateFromModel()
+{
+ UnoEditControl::updateFromModel();
+
+ Reference< XItemListListener > xItemListListener( getPeer(), UNO_QUERY );
+ ENSURE_OR_RETURN_VOID( xItemListListener.is(), "UnoComboBoxControl::updateFromModel: a peer which is no ItemListListener?!" );
+
+ EventObject aEvent( getModel() );
+ xItemListListener->itemListChanged( aEvent );
+}
+void UnoComboBoxControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const uno::Any& rVal )
+{
+ if ( rPropName == GetPropertyName( BASEPROPERTY_STRINGITEMLIST ) )
+ // do not forward this to our peer. We are a XItemListListener at our model, and changes in the string item
+ // list (which is a legacy property) will, later, arrive as changes in the ItemList. Those latter changes
+ // will be forwarded to the peer, which will update itself accordingly.
+ return;
+
+ UnoEditControl::ImplSetPeerProperty( rPropName, rVal );
+}
+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::itemStateChanged( const awt::ItemEvent& rEvent ) throw(uno::RuntimeException)
+{
+ if ( maItemListeners.getLength() )
+ {
+ try
+ {
+ maItemListeners.itemStateChanged( rEvent );
+ }
+ catch( const Exception& e )
+ {
+#if OSL_DEBUG_LEVEL == 0
+ (void) e; // suppress warning
+#else
+ ::rtl::OString sMessage( "UnoComboBoxControl::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
+ }
+ }
+}
+sal_Bool SAL_CALL UnoComboBoxControl::setModel( const uno::Reference< awt::XControlModel >& i_rModel ) throw ( uno::RuntimeException )
+{
+ ::osl::MutexGuard aGuard( GetMutex() );
+
+ const Reference< XItemList > xOldItems( getModel(), UNO_QUERY );
+ OSL_ENSURE( xOldItems.is() || !getModel().is(), "UnoComboBoxControl::setModel: illegal old model!" );
+ const Reference< XItemList > xNewItems( i_rModel, UNO_QUERY );
+ OSL_ENSURE( xNewItems.is() || !i_rModel.is(), "UnoComboBoxControl::setModel: illegal new model!" );
+
+ if ( !UnoEditControl::setModel( i_rModel ) )
+ return sal_False;
+
+ if ( xOldItems.is() )
+ xOldItems->removeItemListListener( this );
+ if ( xNewItems.is() )
+ xNewItems->addItemListListener( this );
+
+ return sal_True;
+}
+
+void SAL_CALL UnoComboBoxControl::listItemInserted( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemInserted: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemInserted( i_rEvent );
+}
+
+void SAL_CALL UnoComboBoxControl::listItemRemoved( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoComboBoxControl::listItemModified( const awt::ItemListEvent& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::listItemModified: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->listItemModified( i_rEvent );
+}
+
+void SAL_CALL UnoComboBoxControl::allItemsRemoved( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::allItemsRemoved: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->allItemsRemoved( i_rEvent );
+}
+
+void SAL_CALL UnoComboBoxControl::itemListChanged( const lang::EventObject& i_rEvent ) throw (uno::RuntimeException)
+{
+ const Reference< XItemListListener > xPeerListener( getPeer(), UNO_QUERY );
+ OSL_ENSURE( xPeerListener.is() || !getPeer().is(), "UnoComboBoxControl::itemListChanged: invalid peer!" );
+ if ( xPeerListener.is() )
+ xPeerListener->itemListChanged( i_rEvent );
+}
+ActionListenerMultiplexer& UnoComboBoxControl::getActionListeners()
+{
+ return maActionListeners;
+}
+ItemListenerMultiplexer& UnoComboBoxControl::getItemListeners()
+{
+ return maItemListeners;
+}
+
+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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoEditControl( i_factory )
+ ,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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoSpinFieldControl( i_factory )
+{
+}
+
+::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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+{
+}
+
+::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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlModel( i_factory )
+{
+ 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( const Reference< XMultiServiceFactory >& i_factory )
+ :UnoControlBase( i_factory )
+{
+ 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..ed2fe978b169
--- /dev/null
+++ b/toolkit/source/helper/listenermultiplexer.cxx
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 )
+
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( SelectionListenerMultiplexer, ::com::sun::star::awt::grid::XGridSelectionListener, selectionChanged, ::com::sun::star::awt::grid::GridSelectionEvent )
+
+// ----------------------------------------------------
+// class SelectionListenerMultiplexer
+// ----------------------------------------------------
+IMPL_LISTENERMULTIPLEXER_BASEMETHODS( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener )
+IMPL_LISTENERMULTIPLEXER_LISTENERMETHOD( TabPageListenerMultiplexer, ::com::sun::star::awt::tab::XTabPageContainerListener, tabPageActivated, ::com::sun::star::awt::tab::TabPageActivatedEvent )
diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx
new file mode 100644
index 000000000000..a418b4a00b7b
--- /dev/null
+++ b/toolkit/source/helper/property.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.
+ *
+ ************************************************************************/
+
+// 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/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;
+using ::com::sun::star::graphic::XGraphic;
+
+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< 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_3 ( "ItemSeparatorPos", ITEM_SEPARATOR_POS, sal_Int16, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ 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 ( "MultiSelectionSimpleMode", MULTISELECTION_SIMPLEMODE, 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 ( "AutoRepeat", AUTO_REPEAT, sal_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_DEP_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", ROW_HEIGHT, 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 ( "RowHeaderWidth", ROW_HEADER_WIDTH, sal_Int32, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_2 ( "ShowColumnHeader", GRID_SHOWCOLUMNHEADER, sal_Bool, BOUND, MAYBEDEFAULT ),
+ DECL_PROP_3 ( "ColumnHeaderHeight", COLUMN_HEADER_HEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_1 ( "GridDataModel", GRID_DATAMODEL, Reference< ::com::sun::star::awt::grid::XGridDataModel >, BOUND ),
+ DECL_PROP_1 ( "ColumnModel", GRID_COLUMNMODEL, Reference< ::com::sun::star::awt::grid::XGridColumnModel >, BOUND ),
+ 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 ),
+ DECL_PROP_3 ( "HeaderBackgroundColor", GRID_HEADER_BACKGROUND, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "HeaderTextColor", GRID_HEADER_TEXT_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "GridLineColor", GRID_LINE_COLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_3 ( "RowBackgroundColors", GRID_ROW_BACKGROUND_COLORS, Sequence< sal_Int32 >, BOUND, MAYBEDEFAULT, MAYBEVOID ),
+ DECL_PROP_2 ( "UseGridLines", USE_GRID_LINES, sal_Bool, BOUND, MAYBEDEFAULT ),
+ };
+ 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..8a6b1d8de4b9
--- /dev/null
+++ b/toolkit/source/helper/registerservices.cxx
@@ -0,0 +1,334 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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/animatedimages.hxx>
+#include <toolkit/controls/spinningprogress.hxx>
+#include <toolkit/controls/dialogcontrol.hxx>
+#include <toolkit/controls/tabpagemodel.hxx>
+#include <toolkit/controls/tabpagecontainer.hxx>
+#include "toolkit/dllapi.h"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+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 >& i_factory ) \
+ { return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new ImplName( i_factory ) ); }
+
+::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 >& i_factory )
+{
+ return ::com::sun::star::uno::Reference < ::com::sun::star::uno::XInterface >( ( ::cppu::OWeakObject* ) new OGeometryControlModel<UnoControlDialogModel>( i_factory ) );
+}
+
+#define GET_FACTORY_WITH_IMPL_PREFIX( ClassName, ImplNamePrefix, ServiceName1, ServiceName2 ) \
+ pRet = tryCreateFactory( sImplementationName, ImplNamePrefix "." #ClassName, \
+ ServiceName1, ServiceName2, \
+ ClassName##_CreateInstance, xServiceFactory \
+ ); \
+ if ( pRet ) \
+ return pRet; \
+
+#define GET_FACTORY( ImplName, ServiceName1, ServiceName2 ) \
+ GET_FACTORY_WITH_IMPL_PREFIX( ImplName, "stardiv.Toolkit", ServiceName1, ServiceName2 )
+
+using namespace toolkit;
+
+IMPL_CREATEINSTANCE2( VCLXToolkit )
+IMPL_CREATEINSTANCE( StdTabController )
+IMPL_CREATEINSTANCE( StdTabControllerModel )
+IMPL_CREATEINSTANCE2( UnoButtonControl )
+IMPL_CREATEINSTANCE2( UnoCheckBoxControl )
+IMPL_CREATEINSTANCE2( UnoComboBoxControl )
+IMPL_CREATEINSTANCE2( UnoControlButtonModel )
+IMPL_CREATEINSTANCE2( UnoControlCheckBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlComboBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlContainer )
+IMPL_CREATEINSTANCE2( UnoControlContainerModel )
+IMPL_CREATEINSTANCE2( UnoControlCurrencyFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlDateFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlEditModel )
+IMPL_CREATEINSTANCE2( UnoControlFileControlModel )
+IMPL_CREATEINSTANCE2( UnoControlFixedHyperlinkModel )
+IMPL_CREATEINSTANCE2( UnoControlFixedTextModel )
+IMPL_CREATEINSTANCE2( UnoControlFormattedFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlGroupBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlImageControlModel )
+IMPL_CREATEINSTANCE2( UnoControlListBoxModel )
+IMPL_CREATEINSTANCE2( UnoControlNumericFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlPatternFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlRadioButtonModel )
+IMPL_CREATEINSTANCE2( UnoControlTimeFieldModel )
+IMPL_CREATEINSTANCE2( UnoControlProgressBarModel )
+IMPL_CREATEINSTANCE2( UnoControlScrollBarModel )
+IMPL_CREATEINSTANCE2( UnoSpinButtonModel )
+IMPL_CREATEINSTANCE2( UnoControlFixedLineModel )
+IMPL_CREATEINSTANCE2( UnoCurrencyFieldControl )
+IMPL_CREATEINSTANCE2( UnoDateFieldControl )
+IMPL_CREATEINSTANCE2( UnoDialogControl )
+IMPL_CREATEINSTANCE2( UnoEditControl )
+IMPL_CREATEINSTANCE2( UnoFileControl )
+IMPL_CREATEINSTANCE2( UnoFixedHyperlinkControl )
+IMPL_CREATEINSTANCE2( UnoFixedTextControl )
+IMPL_CREATEINSTANCE2( UnoFormattedFieldControl )
+IMPL_CREATEINSTANCE2( UnoGroupBoxControl )
+IMPL_CREATEINSTANCE2( UnoImageControlControl )
+IMPL_CREATEINSTANCE2( UnoListBoxControl )
+IMPL_CREATEINSTANCE2( UnoNumericFieldControl )
+IMPL_CREATEINSTANCE2( UnoPatternFieldControl )
+IMPL_CREATEINSTANCE2( UnoRadioButtonControl )
+IMPL_CREATEINSTANCE2( UnoTimeFieldControl )
+IMPL_CREATEINSTANCE2( UnoProgressBarControl )
+IMPL_CREATEINSTANCE2( UnoScrollBarControl )
+IMPL_CREATEINSTANCE2( UnoSpinButtonControl )
+IMPL_CREATEINSTANCE2( UnoFixedLineControl )
+IMPL_CREATEINSTANCE( VCLXMenuBar )
+IMPL_CREATEINSTANCE( VCLXPointer )
+IMPL_CREATEINSTANCE( VCLXPopupMenu )
+IMPL_CREATEINSTANCE( VCLXPrinterServer )
+IMPL_CREATEINSTANCE2( UnoRoadmapControl )
+IMPL_CREATEINSTANCE2( UnoControlRoadmapModel )
+IMPL_CREATEINSTANCE2( UnoSimpleAnimationControl )
+IMPL_CREATEINSTANCE2( UnoSimpleAnimationControlModel )
+IMPL_CREATEINSTANCE2( UnoThrobberControl )
+IMPL_CREATEINSTANCE2( UnoThrobberControlModel )
+IMPL_CREATEINSTANCE2( UnoControlTabPage )
+IMPL_CREATEINSTANCE2( UnoControlTabPageModel )
+IMPL_CREATEINSTANCE2( UnoControlTabPageContainer )
+IMPL_CREATEINSTANCE2( UnoControlTabPageContainerModel )
+IMPL_CREATEINSTANCE2( AnimatedImagesControl )
+IMPL_CREATEINSTANCE2( AnimatedImagesControlModel )
+IMPL_CREATEINSTANCE2( SpinningProgressControlModel )
+
+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 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SortableGridDataModel_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& );
+
+extern void * SAL_CALL comp_AsyncCallback_component_getFactory( const char * implName, 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 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 );
+
+ GET_FACTORY( VCLXToolkit, szServiceName_Toolkit, szServiceName2_Toolkit )
+ GET_FACTORY( VCLXPopupMenu, szServiceName_PopupMenu, szServiceName2_PopupMenu )
+ GET_FACTORY( VCLXMenuBar, szServiceName_MenuBar, szServiceName2_MenuBar )
+ GET_FACTORY( VCLXPointer, szServiceName_Pointer, szServiceName2_Pointer )
+ GET_FACTORY( UnoControlContainer, szServiceName_UnoControlContainer, szServiceName2_UnoControlContainer )
+ GET_FACTORY( UnoControlContainerModel, szServiceName_UnoControlContainerModel, szServiceName2_UnoControlContainerModel )
+ GET_FACTORY( StdTabController, szServiceName_TabController, szServiceName2_TabController )
+ GET_FACTORY( StdTabControllerModel, szServiceName_TabControllerModel, szServiceName2_TabControllerModel )
+ GET_FACTORY( UnoDialogControl, szServiceName_UnoControlDialog, szServiceName2_UnoControlDialog )
+ GET_FACTORY( UnoControlDialogModel, szServiceName_UnoControlDialogModel, szServiceName2_UnoControlDialogModel )
+ GET_FACTORY( UnoEditControl, szServiceName_UnoControlEdit, szServiceName2_UnoControlEdit )
+ GET_FACTORY( UnoControlEditModel, szServiceName_UnoControlEditModel, szServiceName2_UnoControlEditModel )
+ GET_FACTORY( UnoDateFieldControl, szServiceName_UnoControlDateField, szServiceName2_UnoControlDateField )
+ GET_FACTORY( UnoControlDateFieldModel, szServiceName_UnoControlDateFieldModel, szServiceName2_UnoControlDateFieldModel )
+ GET_FACTORY( UnoTimeFieldControl, szServiceName_UnoControlTimeField, szServiceName2_UnoControlTimeField )
+ GET_FACTORY( UnoControlTimeFieldModel, szServiceName_UnoControlTimeFieldModel, szServiceName2_UnoControlTimeFieldModel )
+ GET_FACTORY( UnoNumericFieldControl, szServiceName_UnoControlNumericField, szServiceName2_UnoControlNumericField )
+ GET_FACTORY( UnoControlNumericFieldModel, szServiceName_UnoControlNumericFieldModel, szServiceName2_UnoControlNumericFieldModel )
+ GET_FACTORY( UnoCurrencyFieldControl, szServiceName_UnoControlCurrencyField, szServiceName2_UnoControlCurrencyField )
+ GET_FACTORY( UnoControlCurrencyFieldModel, szServiceName_UnoControlCurrencyFieldModel, szServiceName2_UnoControlCurrencyFieldModel )
+ GET_FACTORY( UnoPatternFieldControl, szServiceName_UnoControlPatternField, szServiceName2_UnoControlPatternField )
+ GET_FACTORY( UnoControlPatternFieldModel, szServiceName_UnoControlPatternFieldModel, szServiceName2_UnoControlPatternFieldModel )
+ GET_FACTORY( UnoFormattedFieldControl, szServiceName_UnoControlFormattedField, szServiceName2_UnoControlFormattedField )
+ GET_FACTORY( UnoControlFormattedFieldModel, szServiceName_UnoControlFormattedFieldModel, szServiceName2_UnoControlFormattedFieldModel )
+ GET_FACTORY( UnoFileControl, szServiceName_UnoControlFileControl, szServiceName2_UnoControlFileControl )
+ GET_FACTORY( UnoControlFileControlModel, szServiceName_UnoControlFileControlModel, szServiceName2_UnoControlFileControlModel )
+ GET_FACTORY( UnoButtonControl, szServiceName_UnoControlButton, szServiceName2_UnoControlButton )
+ GET_FACTORY( UnoControlButtonModel, szServiceName_UnoControlButtonModel, szServiceName2_UnoControlButtonModel )
+ GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageButton, szServiceName2_UnoControlImageButton )
+ GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageButtonModel, szServiceName2_UnoControlImageButtonModel )
+ GET_FACTORY( UnoImageControlControl, szServiceName_UnoControlImageControl, szServiceName2_UnoControlImageControl )
+ GET_FACTORY( UnoControlImageControlModel, szServiceName_UnoControlImageControlModel, szServiceName2_UnoControlImageControlModel )
+ GET_FACTORY( UnoRadioButtonControl, szServiceName_UnoControlRadioButton, szServiceName2_UnoControlRadioButton )
+ GET_FACTORY( UnoControlRadioButtonModel, szServiceName_UnoControlRadioButtonModel, szServiceName2_UnoControlRadioButtonModel )
+ GET_FACTORY( UnoCheckBoxControl, szServiceName_UnoControlCheckBox, szServiceName2_UnoControlCheckBox )
+ GET_FACTORY( UnoControlCheckBoxModel, szServiceName_UnoControlCheckBoxModel, szServiceName2_UnoControlCheckBoxModel )
+ GET_FACTORY( UnoListBoxControl, szServiceName_UnoControlListBox, szServiceName2_UnoControlListBox )
+ GET_FACTORY( UnoControlListBoxModel, szServiceName_UnoControlListBoxModel, szServiceName2_UnoControlListBoxModel )
+ GET_FACTORY( UnoComboBoxControl, szServiceName_UnoControlComboBox, szServiceName2_UnoControlComboBox )
+ GET_FACTORY( UnoControlComboBoxModel, szServiceName_UnoControlComboBoxModel, szServiceName2_UnoControlComboBoxModel )
+ GET_FACTORY( UnoFixedTextControl, szServiceName_UnoControlFixedText, szServiceName2_UnoControlFixedText )
+ GET_FACTORY( UnoControlFixedTextModel, szServiceName_UnoControlFixedTextModel, szServiceName2_UnoControlFixedTextModel )
+ GET_FACTORY( UnoGroupBoxControl, szServiceName_UnoControlGroupBox, szServiceName2_UnoControlGroupBox )
+ GET_FACTORY( UnoControlGroupBoxModel, szServiceName_UnoControlGroupBoxModel, szServiceName2_UnoControlGroupBoxModel )
+ GET_FACTORY( UnoProgressBarControl, szServiceName_UnoControlProgressBar, szServiceName2_UnoControlProgressBar )
+ GET_FACTORY( UnoControlProgressBarModel, szServiceName_UnoControlProgressBarModel, szServiceName2_UnoControlProgressBarModel )
+ GET_FACTORY( UnoScrollBarControl, szServiceName_UnoControlScrollBar, szServiceName2_UnoControlScrollBar )
+ GET_FACTORY( UnoControlScrollBarModel, szServiceName_UnoControlScrollBarModel, szServiceName2_UnoControlScrollBarModel )
+ GET_FACTORY( UnoFixedLineControl, szServiceName_UnoControlFixedLine, szServiceName2_UnoControlFixedLine )
+ GET_FACTORY( UnoControlFixedLineModel, szServiceName_UnoControlFixedLineModel, szServiceName2_UnoControlFixedLineModel )
+ GET_FACTORY( VCLXPrinterServer, szServiceName_PrinterServer, szServiceName2_PrinterServer )
+ GET_FACTORY( UnoRoadmapControl, szServiceName_UnoControlRoadmap, szServiceName2_UnoControlRoadmap )
+ GET_FACTORY( UnoControlRoadmapModel, szServiceName_UnoControlRoadmapModel, szServiceName2_UnoControlRoadmapModel )
+ GET_FACTORY( UnoSpinButtonModel, szServiceName_UnoSpinButtonModel, NULL )
+ GET_FACTORY( UnoSpinButtonControl, szServiceName_UnoSpinButtonControl, NULL )
+ GET_FACTORY( TreeControl, szServiceName_TreeControl, NULL )
+ GET_FACTORY( TreeControlModel, szServiceName_TreeControlModel, NULL )
+ GET_FACTORY( MutableTreeDataModel, szServiceName_MutableTreeDataModel, NULL )
+ GET_FACTORY( UnoSimpleAnimationControlModel, szServiceName_UnoSimpleAnimationControlModel, szServiceName2_UnoSimpleAnimationControlModel )
+ GET_FACTORY( UnoSimpleAnimationControl, szServiceName_UnoSimpleAnimationControl, szServiceName2_UnoSimpleAnimationControl )
+ GET_FACTORY( UnoThrobberControlModel, szServiceName_UnoThrobberControlModel, szServiceName2_UnoThrobberControlModel )
+ GET_FACTORY( UnoThrobberControl, szServiceName_UnoThrobberControl, szServiceName2_UnoThrobberControl )
+ GET_FACTORY( UnoFixedHyperlinkControl, szServiceName_UnoControlFixedHyperlink, NULL )
+ GET_FACTORY( UnoControlFixedHyperlinkModel, szServiceName_UnoControlFixedHyperlinkModel, NULL )
+ GET_FACTORY( GridControl, szServiceName_GridControl, NULL );
+ GET_FACTORY( GridControlModel, szServiceName_GridControlModel, NULL );
+ GET_FACTORY( DefaultGridDataModel, szServiceName_DefaultGridDataModel, NULL );
+ GET_FACTORY( DefaultGridColumnModel, szServiceName_DefaultGridColumnModel, NULL );
+ GET_FACTORY_WITH_IMPL_PREFIX( GridColumn, "org.openoffice.comp.toolkit", szServiceName_GridColumn, NULL );
+ GET_FACTORY_WITH_IMPL_PREFIX( SortableGridDataModel, "org.openoffice.comp.toolkit", szServiceName_SortableGridDataModel, NULL );
+ GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControl, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControl, NULL )
+ GET_FACTORY_WITH_IMPL_PREFIX( AnimatedImagesControlModel, "org.openoffice.comp.toolkit", szServiceName_AnimatedImagesControlModel, NULL )
+ GET_FACTORY_WITH_IMPL_PREFIX( SpinningProgressControlModel, "org.openoffice.comp.toolkit", szServiceName_SpinningProgressControlModel, NULL )
+ GET_FACTORY( UnoControlTabPageModel, szServiceName_UnoControlTabPageModel, NULL )
+ GET_FACTORY( UnoControlTabPage, szServiceName_UnoControlTabPage, NULL )
+ GET_FACTORY( UnoControlTabPageContainerModel, szServiceName_UnoControlTabPageContainerModel, NULL )
+ GET_FACTORY( UnoControlTabPageContainer, szServiceName_UnoControlTabPageContainer, 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..293d257da832
--- /dev/null
+++ b/toolkit/source/helper/servicenames.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+// 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_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", szServiceName2_UnoSimpleAnimationControlModel[] = "com.sun.star.awt.UnoControlSimpleAnimationModel";
+const sal_Char __FAR_DATA szServiceName_AnimatedImagesControl[] = "com.sun.star.awt.AnimatedImagesControl";
+const sal_Char __FAR_DATA szServiceName_AnimatedImagesControlModel[] = "com.sun.star.awt.AnimatedImagesControlModel";
+const sal_Char __FAR_DATA szServiceName_SpinningProgressControlModel[] = "com.sun.star.awt.SpinningProgressControlModel";
+const sal_Char __FAR_DATA szServiceName_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoSimpleAnimationControl", szServiceName2_UnoSimpleAnimationControl[] = "com.sun.star.awt.UnoControlSimpleAnimation";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControlModel[] = "com.sun.star.awt.UnoThrobberControlModel", szServiceName2_UnoThrobberControlModel[] = "com.sun.star.awt.UnoControlThrobberModel";
+const sal_Char __FAR_DATA szServiceName_UnoThrobberControl[] = "com.sun.star.awt.UnoThrobberControl", szServiceName2_UnoThrobberControl[] = "com.sun.star.awt.UnoControlThrobber";
+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";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPage[] = "com.sun.star.awt.tab.UnoControlTabPage";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageModel[] = "com.sun.star.awt.tab.UnoControlTabPageModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainerModel[] = "com.sun.star.awt.tab.UnoControlTabPageContainerModel";
+const sal_Char __FAR_DATA szServiceName_UnoControlTabPageContainer[] = "com.sun.star.awt.tab.UnoControlTabPageContainer";
+const sal_Char __FAR_DATA szServiceName_SortableGridDataModel[] = "com.sun.star.awt.grid.SortableGridDataModel";
+
diff --git a/toolkit/source/helper/tkresmgr.cxx b/toolkit/source/helper/tkresmgr.cxx
new file mode 100644
index 000000000000..d0336c27bdf5
--- /dev/null
+++ b/toolkit/source/helper/tkresmgr.cxx
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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>
+#include <comphelper/processfactory.hxx>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#ifndef _TOOLS_RESMGR_HXX_
+#include <tools/resmgr.hxx>
+#endif
+#include <tools/diagnose_ex.h>
+
+#include <vcl/svapp.hxx>
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::graphic::XGraphic;
+using ::com::sun::star::graphic::XGraphicProvider;
+using namespace ::com::sun::star;
+// -----------------------------------------------------------------------------
+// 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;
+}
+
+// -----------------------------------------------------------------------------
+Image TkResMgr::getImageFromURL( const ::rtl::OUString& i_rImageURL )
+{
+ if ( !i_rImageURL.getLength() )
+ return Image();
+
+ try
+ {
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ Reference< XGraphicProvider > xProvider;
+ if ( aContext.createComponent( "com.sun.star.graphic.GraphicProvider", xProvider ) )
+ {
+ ::comphelper::NamedValueCollection aMediaProperties;
+ aMediaProperties.put( "URL", i_rImageURL );
+ Reference< XGraphic > xGraphic = xProvider->queryGraphic( aMediaProperties.getPropertyValues() );
+ return Image( xGraphic );
+ }
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return Image();
+}
+
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..8e2141033aab
--- /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_uLong)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..943723ea5910
--- /dev/null
+++ b/toolkit/source/helper/unowrapper.cxx
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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, sal_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( sal_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( sal_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( sal_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!" );
+
+ Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
+
+ //the window still could be on the stack, so we have to
+ // use lazy delete ( it will automatically
+ // disconnect from the currently destroyed parent window )
+ pTopWindowChild->doLazyDelete();
+
+ pTopWindowChild = pNextTopChild;
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+::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..600687a3633b
--- /dev/null
+++ b/toolkit/source/helper/vclunohelper.cxx
@@ -0,0 +1,800 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 )
+{
+ const uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+ UnoControlContainer* pContainer = new UnoControlContainer( xFactory, pWindow->GetComponentInterface( sal_True ) );
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > x = pContainer;
+
+ UnoControlModel* pContainerModel = new UnoControlContainerModel( xFactory );
+ 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..d203e63ce2ed
--- /dev/null
+++ b/toolkit/source/layout/core/box-base.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#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 )
+ {
+ ChildData* pRet = *it;
+ lst.erase( it );
+ return pRet;
+ }
+ }
+ 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..685e0e35e8b6
--- /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..1390d9405f71
--- /dev/null
+++ b/toolkit/source/layout/core/factory.cxx
@@ -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.
+ *
+ ************************************************************************/
+
+#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;
+ }
+
+// 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..c3a9bd8b122f
--- /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", sal_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..84e46f5b68f1
--- /dev/null
+++ b/toolkit/source/layout/core/import.cxx
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 );
+ }
+ } // DEBUG:
+ else if ( pParent == NULL )
+ {
+ DBG_ERROR( "Fatal error: top node isn't a dialog" );
+ }
+
+ 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/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..4e65bf7e0114
--- /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)\
+ {\
+ }\
+ sal_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..a8f6d4755a23
--- /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 sal_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/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..06423af6900c
--- /dev/null
+++ b/toolkit/source/layout/vcl/wrapper.cxx
@@ -0,0 +1,1620 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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 ();
+ }
+ rtl::OString ReadByteStringRes()
+ {
+ return Resource::ReadByteStringRes();
+ }
+ };
+
+ Resource_open_up r (res);
+#endif /* !RESOURCE_PUBLISH_PROTECTED */
+ sal_uInt32 mask = r.ReadLongRes ();
+ if (mask & WINDOW_HELPID)
+ SetHelpId (r.ReadByteStringRes());
+ 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( const rtl::OString& id )
+{
+ GetWindow()->SetHelpId( id );
+}
+
+const rtl::OString& Window::GetHelpId() const
+{
+ return GetWindow()->GetHelpId();
+}
+
+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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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, const rtl::OString& 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 (sal_uInt16 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..2bf5fced6fd3
--- /dev/null
+++ b/toolkit/src2xml/include.lst
@@ -0,0 +1,300 @@
+../../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
+../../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..a0e7245fc4f4
--- /dev/null
+++ b/toolkit/src2xml/src-sw.lst
@@ -0,0 +1,120 @@
+../../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/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..a402a6b633c9
--- /dev/null
+++ b/toolkit/src2xml/src.lst
@@ -0,0 +1,679 @@
+../../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/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/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/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/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/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/tk.component b/toolkit/util/tk.component
new file mode 100644
index 000000000000..690b3f324498
--- /dev/null
+++ b/toolkit/util/tk.component
@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--**********************************************************************
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* This file is part of OpenOffice.org.
+*
+* OpenOffice.org is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License version 3
+* only, as published by the Free Software Foundation.
+*
+* OpenOffice.org is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License version 3 for more details
+* (a copy is included in the LICENSE file that accompanied this code).
+*
+* You should have received a copy of the GNU Lesser General Public License
+* version 3 along with OpenOffice.org. If not, see
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+**********************************************************************-->
+
+<component loader="com.sun.star.loader.SharedLibrary"
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.awt.comp.AsyncCallback">
+ <service name="com.sun.star.awt.AsyncCallback"/>
+ </implementation>
+ <implementation name="com.sun.star.comp.awt.Layout">
+ <service name="com.sun.star.awt.Layout"/>
+ <service name="com.sun.star.comp.awt.Layout"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPage">
+ <service name="com.sun.star.awt.tab.UnoControlTabPage"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageModel">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageContainerModel">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageContainerModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTabPageContainer">
+ <service name="com.sun.star.awt.tab.UnoControlTabPageContainer"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.DefaultGridColumnModel">
+ <service name="com.sun.star.awt.grid.DefaultGridColumnModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.DefaultGridDataModel">
+ <service name="com.sun.star.awt.grid.DefaultGridDataModel"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.toolkit.GridColumn">
+ <service name="com.sun.star.awt.grid.GridColumn"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.toolkit.SortableGridDataModel">
+ <service name="com.sun.star.awt.grid.SortableGridDataModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.GridControl">
+ <service name="com.sun.star.awt.grid.UnoControlGrid"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.GridControlModel">
+ <service name="com.sun.star.awt.grid.UnoControlGridModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.MutableTreeDataModel">
+ <service name="com.sun.star.awt.tree.MutableTreeDataModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.StdTabController">
+ <service name="com.sun.star.awt.TabController"/>
+ <service name="stardiv.vcl.control.TabController"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.StdTabControllerModel">
+ <service name="com.sun.star.awt.TabControllerModel"/>
+ <service name="stardiv.vcl.controlmodel.TabController"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.TreeControl">
+ <service name="com.sun.star.awt.tree.TreeControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.TreeControlModel">
+ <service name="com.sun.star.awt.tree.TreeControlModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoButtonControl">
+ <service name="com.sun.star.awt.UnoControlButton"/>
+ <service name="stardiv.vcl.control.Button"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoCheckBoxControl">
+ <service name="com.sun.star.awt.UnoControlCheckBox"/>
+ <service name="stardiv.vcl.control.CheckBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoComboBoxControl">
+ <service name="com.sun.star.awt.UnoControlComboBox"/>
+ <service name="stardiv.vcl.control.ComboBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlButtonModel">
+ <service name="com.sun.star.awt.UnoControlButtonModel"/>
+ <service name="stardiv.vcl.controlmodel.Button"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlCheckBoxModel">
+ <service name="com.sun.star.awt.UnoControlCheckBoxModel"/>
+ <service name="stardiv.vcl.controlmodel.CheckBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlComboBoxModel">
+ <service name="com.sun.star.awt.UnoControlComboBoxModel"/>
+ <service name="stardiv.vcl.controlmodel.ComboBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlContainer">
+ <service name="com.sun.star.awt.UnoControlContainer"/>
+ <service name="stardiv.vcl.control.ControlContainer"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlContainerModel">
+ <service name="com.sun.star.awt.UnoControlContainerModel"/>
+ <service name="stardiv.vcl.controlmodel.ControlContainer"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlCurrencyFieldModel">
+ <service name="com.sun.star.awt.UnoControlCurrencyFieldModel"/>
+ <service name="stardiv.vcl.controlmodel.CurrencyField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlDateFieldModel">
+ <service name="com.sun.star.awt.UnoControlDateFieldModel"/>
+ <service name="stardiv.vcl.controlmodel.DateField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlDialogModel">
+ <service name="com.sun.star.awt.UnoControlDialogModel"/>
+ <service name="stardiv.vcl.controlmodel.Dialog"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlEditModel">
+ <service name="com.sun.star.awt.UnoControlEditModel"/>
+ <service name="stardiv.vcl.controlmodel.Edit"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlFileControlModel">
+ <service name="com.sun.star.awt.UnoControlFileControlModel"/>
+ <service name="stardiv.vcl.controlmodel.FileControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlFixedHyperlinkModel">
+ <service name="com.sun.star.awt.UnoControlFixedHyperlinkModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlFixedLineModel">
+ <service name="com.sun.star.awt.UnoControlFixedLineModel"/>
+ <service name="stardiv.vcl.controlmodel.FixedLine"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlFixedTextModel">
+ <service name="com.sun.star.awt.UnoControlFixedTextModel"/>
+ <service name="stardiv.vcl.controlmodel.FixedText"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlFormattedFieldModel">
+ <service name="com.sun.star.awt.UnoControlFormattedFieldModel"/>
+ <service name="stardiv.vcl.controlmodel.FormattedField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlGroupBoxModel">
+ <service name="com.sun.star.awt.UnoControlGroupBoxModel"/>
+ <service name="stardiv.vcl.controlmodel.GroupBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlImageControlModel">
+ <service name="com.sun.star.awt.UnoControlImageButtonModel"/>
+ <service name="com.sun.star.awt.UnoControlImageControlModel"/>
+ <service name="stardiv.vcl.controlmodel.ImageButton"/>
+ <service name="stardiv.vcl.controlmodel.ImageControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlListBoxModel">
+ <service name="com.sun.star.awt.UnoControlListBoxModel"/>
+ <service name="stardiv.vcl.controlmodel.ListBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlNumericFieldModel">
+ <service name="com.sun.star.awt.UnoControlNumericFieldModel"/>
+ <service name="stardiv.vcl.controlmodel.NumericField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlPatternFieldModel">
+ <service name="com.sun.star.awt.UnoControlPatternFieldModel"/>
+ <service name="stardiv.vcl.controlmodel.PatternField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlProgressBarModel">
+ <service name="com.sun.star.awt.UnoControlProgressBarModel"/>
+ <service name="stardiv.vcl.controlmodel.ProgressBar"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlRadioButtonModel">
+ <service name="com.sun.star.awt.UnoControlRadioButtonModel"/>
+ <service name="stardiv.vcl.controlmodel.RadioButton"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlRoadmapModel">
+ <service name="com.sun.star.awt.UnoControlRoadmapModel"/>
+ <service name="stardiv.vcl.controlmodel.Roadmap"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlScrollBarModel">
+ <service name="com.sun.star.awt.UnoControlScrollBarModel"/>
+ <service name="stardiv.vcl.controlmodel.ScrollBar"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoControlTimeFieldModel">
+ <service name="com.sun.star.awt.UnoControlTimeFieldModel"/>
+ <service name="stardiv.vcl.controlmodel.TimeField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoCurrencyFieldControl">
+ <service name="com.sun.star.awt.UnoControlCurrencyField"/>
+ <service name="stardiv.vcl.control.CurrencyField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoDateFieldControl">
+ <service name="com.sun.star.awt.UnoControlDateField"/>
+ <service name="stardiv.vcl.control.DateField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoDialogControl">
+ <service name="com.sun.star.awt.UnoControlDialog"/>
+ <service name="stardiv.vcl.control.Dialog"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoEditControl">
+ <service name="com.sun.star.awt.UnoControlEdit"/>
+ <service name="stardiv.vcl.control.Edit"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoFileControl">
+ <service name="com.sun.star.awt.UnoControlFileControl"/>
+ <service name="stardiv.vcl.control.FileControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoFixedHyperlinkControl">
+ <service name="com.sun.star.awt.UnoControlFixedHyperlink"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoFixedLineControl">
+ <service name="com.sun.star.awt.UnoControlFixedLine"/>
+ <service name="stardiv.vcl.control.FixedLine"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoFixedTextControl">
+ <service name="com.sun.star.awt.UnoControlFixedText"/>
+ <service name="stardiv.vcl.control.FixedText"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoFormattedFieldControl">
+ <service name="com.sun.star.awt.UnoControlFormattedField"/>
+ <service name="stardiv.vcl.control.FormattedField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoGroupBoxControl">
+ <service name="com.sun.star.awt.UnoControlGroupBox"/>
+ <service name="stardiv.vcl.control.GroupBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoImageControlControl">
+ <service name="com.sun.star.awt.UnoControlImageButton"/>
+ <service name="com.sun.star.awt.UnoControlImageControl"/>
+ <service name="stardiv.vcl.control.ImageButton"/>
+ <service name="stardiv.vcl.control.ImageControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoListBoxControl">
+ <service name="com.sun.star.awt.UnoControlListBox"/>
+ <service name="stardiv.vcl.control.ListBox"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoNumericFieldControl">
+ <service name="com.sun.star.awt.UnoControlNumericField"/>
+ <service name="stardiv.vcl.control.NumericField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoPatternFieldControl">
+ <service name="com.sun.star.awt.UnoControlPatternField"/>
+ <service name="stardiv.vcl.control.PatternField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoProgressBarControl">
+ <service name="com.sun.star.awt.UnoControlProgressBar"/>
+ <service name="stardiv.vcl.control.ProgressBar"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoRadioButtonControl">
+ <service name="com.sun.star.awt.UnoControlRadioButton"/>
+ <service name="stardiv.vcl.control.RadioButton"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoRoadmapControl">
+ <service name="com.sun.star.awt.UnoControlRoadmap"/>
+ <service name="stardiv.vcl.control.Roadmap"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoScrollBarControl">
+ <service name="com.sun.star.awt.UnoControlScrollBar"/>
+ <service name="stardiv.vcl.control.ScrollBar"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoSimpleAnimationControl">
+ <service name="com.sun.star.awt.UnoControlSimpleAnimation"/>
+ <service name="com.sun.star.awt.UnoSimpleAnimationControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoSimpleAnimationControlModel">
+ <service name="com.sun.star.awt.UnoControlSimpleAnimationModel"/>
+ <service name="com.sun.star.awt.UnoSimpleAnimationControlModel"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.toolkit.SpinningProgressControlModel">
+ <service name="com.sun.star.awt.SpinningProgressControlModel"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControlModel">
+ <service name="com.sun.star.awt.AnimatedImagesControlModel"/>
+ </implementation>
+ <implementation name="org.openoffice.comp.toolkit.AnimatedImagesControl">
+ <service name="com.sun.star.awt.AnimatedImagesControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoSpinButtonControl">
+ <service name="com.sun.star.awt.UnoControlSpinButton"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoSpinButtonModel">
+ <service name="com.sun.star.awt.UnoControlSpinButtonModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoThrobberControl">
+ <service name="com.sun.star.awt.UnoControlThrobber"/>
+ <service name="com.sun.star.awt.UnoThrobberControl"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoThrobberControlModel">
+ <service name="com.sun.star.awt.UnoControlThrobberModel"/>
+ <service name="com.sun.star.awt.UnoThrobberControlModel"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.UnoTimeFieldControl">
+ <service name="com.sun.star.awt.UnoControlTimeField"/>
+ <service name="stardiv.vcl.control.TimeField"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.VCLXMenuBar">
+ <service name="com.sun.star.awt.MenuBar"/>
+ <service name="stardiv.vcl.MenuBar"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.VCLXPointer">
+ <service name="com.sun.star.awt.Pointer"/>
+ <service name="stardiv.vcl.Pointer"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.VCLXPopupMenu">
+ <service name="com.sun.star.awt.PopupMenu"/>
+ <service name="stardiv.vcl.PopupMenu"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.VCLXPrinterServer">
+ <service name="com.sun.star.awt.PrinterServer"/>
+ <service name="stardiv.vcl.PrinterServer"/>
+ </implementation>
+ <implementation name="stardiv.Toolkit.VCLXToolkit">
+ <service name="com.sun.star.awt.Toolkit"/>
+ <service name="stardiv.vcl.VclToolkit"/>
+ </implementation>
+</component>
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/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..e9e2b7a0a26b
--- /dev/null
+++ b/toolkit/workben/layout/sortdlg.src
@@ -0,0 +1,339 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General 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
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT1";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 19 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP1
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP1";
+ Pos = MAP_APPFONT ( 172 , 14 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "~Ascending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN1
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS: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
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT2";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 60 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP2
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP2";
+ Pos = MAP_APPFONT ( 172 , 55 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "A~scending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN2
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS: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
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_FIELDS:LB_SORT3";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 12 , 101 ) ;
+ Size = MAP_APPFONT ( 154 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ RadioButton BTN_UP3
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS:BTN_UP3";
+ Pos = MAP_APPFONT ( 172 , 96 ) ;
+ Size = MAP_APPFONT ( 79 , 10 ) ;
+ Text [ en-US ] = "As~cending" ;
+ TabStop = TRUE ;
+ };
+ RadioButton BTN_DOWN3
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_FIELDS: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
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_CASESENSITIVE";
+ Pos = MAP_APPFONT ( 12 , 6 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Case ~sensitive" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_LABEL
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS: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
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_FORMATS";
+ Pos = MAP_APPFONT ( 12 , 34 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "Include ~formats" ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_NATURALSORT
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS: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
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS:BTN_COPYRESULT";
+ Pos = MAP_APPFONT ( 12 , 62 ) ;
+ Size = MAP_APPFONT ( 242 , 10 ) ;
+ Text [ en-US ] = "~Copy sort results to:" ;
+ TabStop = TRUE ;
+ };
+ ListBox LB_OUTAREA
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS:LB_OUTAREA";
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 20 , 73 ) ;
+ Size = MAP_APPFONT ( 93 , 90 ) ;
+ TabStop = TRUE ;
+ DropDown = TRUE ;
+ };
+ Edit ED_OUTAREA
+ {
+ HelpID = "toolkit:Edit:RID_SCPAGE_SORT_OPTIONS:ED_OUTAREA";
+ Disable = TRUE ;
+ Border = TRUE ;
+ Pos = MAP_APPFONT ( 119 , 73 ) ;
+ Size = MAP_APPFONT ( 132 , 12 ) ;
+ TabStop = TRUE ;
+ };
+ CheckBox BTN_SORT_USER
+ {
+ HelpID = "toolkit:CheckBox:RID_SCPAGE_SORT_OPTIONS: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
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS: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
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS: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
+ {
+ HelpID = "toolkit:ListBox:RID_SCPAGE_SORT_OPTIONS: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
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_OPTIONS: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
+ {
+ HelpID = "toolkit:RadioButton:RID_SCPAGE_SORT_OPTIONS: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/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 );
+}
+